/** * Wraps the module/package/bundle setup method. * * @return void */ private function _setup() { if (!$this->setupCalled) { $this->jaxon = jaxon(); $this->response = $this->jaxon->getGlobalResponse(); // Use the Composer autoloader $this->jaxon->useComposerAutoloader(); // Call the module/package/bundle specific setup() method $this->setup(); $this->setupCalled = true; } }
/** * Read and set Jaxon options from a PHP config file * * @param array $sConfigFile The full path to the config file * @param string $sKeys The keys of the options in the file * * @return array */ public static function read($sConfigFile, $sKeys = '') { $sConfigFile = realpath($sConfigFile); if (!is_readable($sConfigFile)) { throw new \Jaxon\Exception\Config\File('access', $sConfigFile); } $aConfigOptions = (include $sConfigFile); if (!is_array($aConfigOptions)) { throw new \Jaxon\Exception\Config\File('content', $sConfigFile); } // Setup the config options into the library. $jaxon = jaxon(); $jaxon->setOptions($aConfigOptions, $sKeys); return $aConfigOptions; }
/** * Read and set Jaxon options from a YAML formatted config file * * @param array $sConfigFile The full path to the config file * @param string $sKeys The keys of the options in the file * * @return array */ public static function read($sConfigFile, $sKeys = '') { $sConfigFile = realpath($sConfigFile); if (!extension_loaded('yaml')) { throw new \Jaxon\Exception\Config\Yaml('install'); } if (!is_readable($sConfigFile)) { throw new \Jaxon\Exception\Config\File('access', $sConfigFile); } $aConfigOptions = yaml_parse_file($sConfigFile); if (!is_array($aConfigOptions)) { throw new \Jaxon\Exception\Config\File('content', $sConfigFile); } // Setup the config options into the library. $jaxon = jaxon(); $jaxon->setOptions($aConfigOptions, $sKeys); return $aConfigOptions; }