src/Library/ServiceContainer/ServiceContainer.php
public function init(
        array $initial_services     = array(),
        array $services_providers   = array(),
        array $services_protected   = array()
    ) {
        // object can only be initialized once
        if (!is_object($this->_services)) {
            $this->_services                = new Collection();
            $this->_services_protected      = new Collection();
            $this->_services_providers      = new Collection();
            if (!empty($initial_services)) {
                foreach ($initial_services as $_name=>$_service) {
                    $this->setService($_name, $_service);
                }
            }
            if (!empty($services_providers)) {
                foreach ($services_providers as $_name=>$_provider) {
                    $this->setProvider($_name, $_provider);
                }
            }
            if (!empty($services_protected)) {
                foreach ($services_protected as $_name) {
                    $this->setProtected($_name);
                }
            }
        }
        return $this;
    }
public function init(
        array $initial_services     = array(),
        array $services_providers   = array(),
        array $services_protected   = array()
    ) {
        // object can only be initialized once
        if (!is_object($this->_services)) {
            $this->_services                = new Collection();
            $this->_services_protected      = new Collection();
            $this->_services_providers      = new Collection();
            if (!empty($initial_services)) {
                foreach ($initial_services as $_name=>$_service) {
                    $this->setService($_name, $_service);
                }
            }
            if (!empty($services_providers)) {
                foreach ($services_providers as $_name=>$_provider) {
                    $this->setProvider($_name, $_provider);
                }
            }
            if (!empty($services_protected)) {
                foreach ($services_protected as $_name) {
                    $this->setProtected($_name);
                }
            }
        }
        return $this;
    }
public function init ( array $ initial_services = array ( ) , array $ services_providers = array ( ) , array $ services_protected = array ( ) ) { // object can only be initialized once if ( ! is_object ( $ this -> _services ) ) { $ this -> _services = new Collection ( ) ; $ this -> _services_protected = new Collection ( ) ; $ this -> _services_providers = new Collection ( ) ; if ( ! empty ( $ initial_services ) ) { foreach ( $ initial_services as $ _name => $ _service ) { $ this -> setService ( $ _name , $ _service ) ; } } if ( ! empty ( $ services_providers ) ) { foreach ( $ services_providers as $ _name => $ _provider ) { $ this -> setProvider ( $ _name , $ _provider ) ; } } if ( ! empty ( $ services_protected ) ) { foreach ( $ services_protected as $ _name ) { $ this -> setProtected ( $ _name ) ; } } } return $ this ; }
Initialize the service container system

@param   array $initial_services
@param   array $services_providers
@param   array $services_protected
@return  $this
Initialize the service container system