/** * Constructor * * Prevent creating instances of this class by making the constructor private */ public function __construct(ObjectConfig $config) { //Set the class loader if (!$config->class_loader instanceof ClassLoaderInterface) { throw new \InvalidArgumentException('class_loader [ClassLoaderInterface] config option is required, "' . gettype($config->class_loader) . '" given.'); } else { $this->setClassLoader($config['class_loader']); } //Create the object registry if ($config->cache_enabled) { $this->_registry = new ObjectRegistryCache(); $this->_registry->setCachePrefix($config->cache_prefix); } else { $this->_registry = new ObjectRegistry(); } //Create the object identifier $this->__object_identifier = $this->getIdentifier('lib:object.manager'); //Manually register the library loader $config = new ObjectConfig(array('object_manager' => $this, 'object_identifier' => new ObjectIdentifier('lib:object.locator.library'))); $this->registerLocator(new ObjectLocatorLibrary($config)); //Register the component locator $this->registerLocator('lib:object.locator.component'); //Register self and set a 'manager' alias $this->setObject('lib:object.manager', $this); $this->registerAlias('manager', 'lib:object.manager'); }