Initialize the service container system

@param   array $initial_services
@param   array $services_providers
@param   array $services_protected
@return  $this
193519
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;
    }
460059
protected function setInitialProviders()
    {
        $app = $this->getBaseApp();
        $providers = $this->config->get('swoole_http.providers', []);

        foreach ($providers as $provider) {
            if (class_exists($provider) && ! in_array($provider, $this->providers)) {
                $providerClass = new $provider($app);
                $this->providers[$provider] = $providerClass;
            }
        }
    }
1216145
private function initializeServiceDefinitions(array $mergedConfig, ContainerBuilder $container)
    {
        $initManager = $container->get(ServiceNames::SERVICE_DEFINITION_INITIALIZATION_MANAGER);
        $initManager->initializeServiceDefinitions($mergedConfig, $container);
    }
22930
public final void initialize() {
        if (m_state.isInitialized()) {
            m_logger.warn("initialize(): Service is already initialized -- ignoring");
        } else {
            logParams("Initializing with the following service parameters:");
            this.initService();
            setState(State.INITIALIZED);
        }
    }
34974
public function setupServices()
    {
        $settings = $this->getApp()->container->get('settings');

        if (!empty($settings['services'])) {
            if (!is_array($settings['services'])) {
                throw InvalidServiceConfigException::build([], ['serviceConfig' => $settings['services']]);
            }

            foreach ($settings['services'] as $service => $config) {
                $this->setupService($service, $config);
            }
        }
    }
345448
public function init()
    {
        // Retrieve the default service container.
        $container = $this->getContainer();

        // Now load the additional service configurations.
        $this->loadServiceConfigurations($container);

        // Finally call the HOOKs to allow additional handling.
        $this->callHooks($container);
    }
664542
protected function initializeBaseServices()
    {
        foreach ($this->serviceClass as $serviceClass) {
            $this->container->register($serviceClass::getServiceName(), $serviceClass);
        }
    }
951766
protected function registerServiceProviders( $service_providers, Container $container ) {
		foreach ( $service_providers as $provider ) {
			$provider->register( $container );
		}
	}
932060
protected function initServices()
    {
        $dependencies = $this->config->get('dependencies', null);
        $this->getDI()->setShared('registrant', new Registrant($dependencies));
        $this->getDI()->setShared('config', $this->config);
        $this->getDI()->get('registrant')->registration();
    }
1315933
public function setService($services)
    {
        if (!is_array($services)) {
            throw new \Exception(__METHOD__.' accept parameter as array.');
        }

        foreach ($services as $key => $alias) {
            $this[$key] = $alias;
        }

        return $this;
    }
476323
public function addByArray(array $services = [])
  {
    if (!empty($services)) {
      foreach ($services as $name => $methods) {
        if (!$this->has($name)) {
          $service = new Service();

          foreach ($methods as $method => $value) {
            if (method_exists($service, $method)) {
              $service->{$method}($value);
            } else {
                throw new ServiceMethodNotExists(sprintf(
                  "Method '%s' does not exists on the %s service.",
                  $method,
                  $name
                ));
              }
          }

          $this->services[$name] = $service;

          continue;
        }

        throw new ServiceAlreadyExists(sprintf(
          "Service '%s' already exists.",
          $name
        ));
      }
    }

    return $this;
  }
849154
private void initEmbeddedServices(String[] requestedServices) {
        Set<String> serviceSet = new LinkedHashSet<>();
        if (requestedServices != null) {
            serviceSet.addAll(Arrays.asList(requestedServices));
        }
        addRequiredServices(serviceSet);
        initServices(serviceSet);
    }
771479
protected function loadProviders($providers)
	{
		foreach ((array) $providers as $provider) {
			$provider = $this->container->get($provider);

			if (!$provider instanceof ServiceProviderInterface) {
				$providerName = get_class($provider);
				throw new \Exception(
					"$providerName does not implement required \\TitaPHP\\Foundation\\ServiceProviderInterface Interface"
				);
			}

			$provider->register($this);
		}
	}
1050766
function withServices(array $services) {
        foreach ($services as $method => $type) {
            $this->bind($method, $type);
        }
        return $this;
    }
1006338
public function init()
    {
        // initialize the service class
        $this->service = $this->newService('AppserverIo\Appserver\Core\Api\ContainerService');

        //We will check the distribution type by it's release file, as we have problems doing so using php_uname('s').
        //These mappings are for the most common platforms. If others are needed see the link below
        //@link http://linuxmafia.com/faq/Admin/release-files.html
        $this->distroMapping = array(
            "Arch" => "arch-release",
            "Debian" => "debian_version",
            "Fedora" => "fedora-release",
            "Ubuntu" => "lsb-release",
            'Redhat' => 'redhat-release',
            'CentOS' => 'centos-release'
        );

        // initialize the available restart commands
        $this->restartCommands = array(
            DeploymentScanner::DARWIN => DeploymentScanner::LAUNCHD_INIT_STRING,
            DeploymentScanner::WINDOWS_NT => DeploymentScanner::WIN_NT_INIT_STRING,
            'Debian' . DeploymentScanner::LINUX => array(
                6 => DeploymentScanner::SYSTEMV_INIT_STRING,
                7 => DeploymentScanner::SYSTEMV_INIT_STRING,
                'default' => DeploymentScanner::SYSTEMD_INIT_STRING
            ),
            'Ubuntu' . DeploymentScanner::LINUX => array(
                12 => DeploymentScanner::SYSTEMV_INIT_STRING,
                13 => DeploymentScanner::SYSTEMV_INIT_STRING,
                14 => DeploymentScanner::SYSTEMV_INIT_STRING,
                'default' => DeploymentScanner::SYSTEMD_INIT_STRING
            ),
            'CentOS' . DeploymentScanner::LINUX => array(
                5 => DeploymentScanner::SYSTEMV_INIT_STRING,
                6 => DeploymentScanner::SYSTEMV_INIT_STRING,
                'default' => DeploymentScanner::SYSTEMD_INIT_STRING
            ),
            'Fedora' . DeploymentScanner::LINUX => DeploymentScanner::SYSTEMD_INIT_STRING
        );
    }
136054
public function init()
    {
        $config = new Config($this->getSetting('config'), $this->getEnvironment());

        $this->container = (new Container)
            ->setConfig($config)
            ->setInstance('core', $this)
            ->setInstance('config', $config);

        $services = $this->loadServices();
        $this->container->setServices($services);

        $this->modules = $this->loadModules();
        $this->loadRoutesAndServices();

        $this->router = (new Router($this->routes, $this->modules))
            ->setRequest($this->request)
            ->setBasePath($this->request->getBasePath());

        $this->container->addServices($this->services)
            ->setInstance('router', $this->router);

        foreach ($this->modules as $module) {
            $module->setContainer($this->container);
        }

        return $this;
    }
1199824
function withScoped(array $services) {
        foreach ($services as $method => $type) {
            $this->bind($method, $type, self::SCOPED);
        }
        return $this;
    }