jablonka.czprosek.czf

freenet-router

Subversion Repositories:
[/] [trunk/] [freenet-router/] [var/] [www/] [freenet-router/] [Application/] [Models/] [System/] [Service.php] - Rev 2

Compare with Previous - Blame - Download


<?php

namespace FreenetRouter\Models\System;

use FreenetRouter\Libraries\ServiceManagers\IServiceManager;
use Phem\Core\Object;

/**
 * @author Jakub PetrŞílka <kubapet@lbcfree.net>
 */
class Service extends Object
{  
    
    private $name;
    private $caption;
    private $enabled;
    private $active;
    private $serviceManager;
    
    public function __construct($name,$caption, IServiceManager $sm)
    {
        $this->name = $name;
        $this->caption = $caption;
        $this->serviceManager = $sm;
    }
    
    public function getName()
    {
        return $this->name;
    }

    public function getCaption()
    {
        return $this->caption;
    }

    public function getEnabled()
    {
        if ($this->enabled === null)
        {
            $this->enabled = $this->serviceManager->isEnabled();
        }
        return $this->enabled;
    }

    public function getActive()
    {
        if ($this->active === null)
        {
            $this->active = $this->serviceManager->isActive();
        }        
        return $this->active;
    }

    public function setName($name)
    {
        $this->name = $name;
    }

    public function setCaption($caption)
    {
        $this->caption = $caption;
    }

    public function setEnabled(boolean $enabled)
    {
        $this->serviceManager->setEnabled($enabled);
        $this->enabled = $this->serviceManager->isEnabled();
    }

    public function setActive(boolean $active)
    {
        $this->serviceManager->setActive($active);
        $this->active = $this->serviceManager->isActive();        
    }
}

Powered by WebSVN 2.2.1