/** * Constructor * * Initialize application. Potentially initializes include_paths, PHP * settings, and bootstrap class. * * @param string $environment * @param string|array|IfwPsn_Vendor_Zend_Config $options String path to configuration file, or array/IfwPsn_Vendor_Zend_Config of configuration options * @throws IfwPsn_Vendor_Zend_Application_Exception When invalid options are provided * @return void */ public function __construct($environment, $options = null) { $this->_environment = (string) $environment; require_once IFW_PSN_LIB_ROOT . 'IfwPsn/Vendor/Zend/Loader/Autoloader.php'; $this->_autoloader = IfwPsn_Vendor_Zend_Loader_Autoloader::getInstance(); if (null !== $options) { if (is_string($options)) { $options = $this->_loadConfig($options); } elseif ($options instanceof IfwPsn_Vendor_Zend_Config) { $options = $options->toArray(); } elseif (!is_array($options)) { throw new IfwPsn_Vendor_Zend_Application_Exception('Invalid options provided; must be location of config file, a config object, or an array'); } $this->setOptions($options); } }
/** * Constructor * * @param array|IfwPsn_Vendor_Zend_Config $options Configuration options for resource autoloader * @return void */ public function __construct($options) { if ($options instanceof IfwPsn_Vendor_Zend_Config) { $options = $options->toArray(); } if (!is_array($options)) { require_once IFW_PSN_LIB_ROOT . 'IfwPsn/Vendor/Zend/Loader/Exception.php'; throw new IfwPsn_Vendor_Zend_Loader_Exception('Options must be passed to resource loader constructor'); } $this->setOptions($options); $namespace = $this->getNamespace(); if (null === $namespace || null === $this->getBasePath()) { require_once IFW_PSN_LIB_ROOT . 'IfwPsn/Vendor/Zend/Loader/Exception.php'; throw new IfwPsn_Vendor_Zend_Loader_Exception('Resource loader requires both a namespace and a base path for initialization'); } if (!empty($namespace)) { $namespace .= '_'; } require_once IFW_PSN_LIB_ROOT . 'IfwPsn/Vendor/Zend/Loader/Autoloader.php'; IfwPsn_Vendor_Zend_Loader_Autoloader::getInstance()->unshiftAutoloader($this, $namespace); }
/** * Register {@link autoload()} with spl_autoload() * * @deprecated Since 1.8.0 * @param string $class (optional) * @param boolean $enabled (optional) * @return void * @throws IfwPsn_Vendor_Zend_Exception if spl_autoload() is not found * or if the specified class does not have an autoload() method. */ public static function registerAutoload($class = 'IfwPsn_Vendor_Zend_Loader', $enabled = true) { trigger_error(__CLASS__ . '::' . __METHOD__ . ' is deprecated as of 1.8.0 and will be removed with 2.0.0; use IfwPsn_Vendor_Zend_Loader_Autoloader instead', E_USER_NOTICE); require_once IFW_PSN_LIB_ROOT . 'IfwPsn/Vendor/Zend/Loader/Autoloader.php'; $autoloader = IfwPsn_Vendor_Zend_Loader_Autoloader::getInstance(); $autoloader->setFallbackAutoloader(true); if ('IfwPsn_Vendor_Zend_Loader' != $class) { self::loadClass($class); $methods = get_class_methods($class); if (!in_array('autoload', (array) $methods)) { require_once IFW_PSN_LIB_ROOT . 'IfwPsn/Vendor/Zend/Exception.php'; throw new IfwPsn_Vendor_Zend_Exception("The class \"{$class}\" does not have an autoload() method"); } $callback = array($class, 'autoload'); if ($enabled) { $autoloader->pushAutoloader($callback); } else { $autoloader->removeAutoloader($callback); } } }