AppserverIo\Appserver\Core\GenericContainerFactory::factory PHP Method

factory() public static method

Factory method to create a new container instance.
public static factory ( AppserverIo\Appserver\Core\Interfaces\ApplicationServerInterface $applicationServer, AppserverIo\Appserver\Core\Api\Node\ContainerNodeInterface $configuration, integer $runlevel = ApplicationServerInterface::NETWORK ) : void
$applicationServer AppserverIo\Appserver\Core\Interfaces\ApplicationServerInterface The application instance to register the class loader with
$configuration AppserverIo\Appserver\Core\Api\Node\ContainerNodeInterface The class loader configuration
$runlevel integer The runlevel the container has been started in
return void
    public static function factory(ApplicationServerInterface $applicationServer, ContainerNodeInterface $configuration, $runlevel = ApplicationServerInterface::NETWORK)
    {
        // create a new reflection class instance
        $reflectionClass = new \ReflectionClass($configuration->getType());
        // initialize the container configuration with the base directory and pass it to the thread
        $params = array($applicationServer->getInitialContext(), $applicationServer->getNamingDirectory(), $configuration, $applicationServer->runlevelToString($runlevel));
        // create, initialize and return the container instance
        return $reflectionClass->newInstanceArgs($params);
    }
GenericContainerFactory