Ejemplo n.º 1
0
 /**
  * Constructor
  *
  * Prevent creating instances of this class by making the constructor private
  */
 private final function __construct(KObjectConfig $config)
 {
     //Initialise the object
     $this->_initialize($config);
     // Set the class loader
     if (!$config->class_loader instanceof KClassLoaderInterface) {
         throw new InvalidArgumentException('class_loader [KClassLoaderInterface] config option is required, "' . gettype($config->class_loader) . '" given.');
     }
     //Set the class loader
     $this->setClassLoader($config->class_loader);
     //Create the object registry
     if ($config->cache && KObjectRegistryCache::isSupported()) {
         $this->__registry = new KObjectRegistryCache();
         $this->__registry->setNamespace($config->cache_namespace);
     } else {
         $this->__registry = new KObjectRegistry();
     }
     //Create the object identifier
     $this->__object_identifier = $this->getIdentifier('object.manager');
     //Manually register the koowa loader
     $config = new KObjectConfig(array('object_manager' => $this, 'object_identifier' => new KObjectIdentifier('lib:object.locator.koowa')));
     $this->registerLocator(new KObjectLocatorLibrary($config));
     //Register self and set a 'manager' alias
     $this->setObject('object.manager', $this);
     $this->registerAlias('object.manager', 'manager');
 }