Example #1
0
 /**
  * Constructor.
  *
  * @return  void
  */
 public function __construct(array $parameters = [])
 {
     $this->_parameters = new Core\Parameter($this, [], ['prefix' => null, 'rules.public' => [], 'rules.private' => []]);
     $this->_parameters->setParameters($parameters);
     if (null === ($prefix = $this->_parameters->getParameter('prefix'))) {
         $this->setPrefix('\\' === ($_ = dirname($this->getBootstrap())) ? '/' : $_);
     } else {
         $this->setPrefix($prefix);
     }
     foreach ($this->_parameters->getParameter('rules.public') as $id => $rule) {
         @(list($methods, $pattern, $call, $able, $variables) = $rule);
         if (null === $variables) {
             $variables = [];
         }
         $this->addRule($id, $methods, $pattern, $call, $able, $variables);
     }
     foreach ($this->_parameters->getParameter('rules.private') as $id => $rule) {
         @(list($methods, $pattern, $call, $able, $variables) = $rule);
         if (null === $variables) {
             $variables = [];
         }
         $this->addPrivateRule($id, $methods, $pattern, $call, $able, $variables);
     }
     $this->setDefaultPort(static::getPort(), static::isSecure());
     return;
 }
Example #2
0
 /**
  * Construct an abstract sampler.
  *
  * @param   array  $parameters    Parameters.
  * @return  void
  */
 public function __construct(array $parameters = [])
 {
     $this->_parameters = new Core\Parameter(__CLASS__, [], ['integer.min' => -16, 'integer.max' => 15, 'float.min' => -128.0, 'float.max' => 127.0]);
     $this->_parameters->setParameters($parameters);
     if (null === $this->_parameters->getParameter('integer.min')) {
         $this->_parameters->setParameter('integer.min', PHP_INT_MIN);
     }
     if (null === $this->_parameters->getParameter('integer.max')) {
         $this->_parameters->setParameter('integer.max', PHP_INT_MAX);
     }
     if (null === $this->_parameters->getParameter('float.min')) {
         $this->_parameters->setParameter('float.min', PHP_INT_MIN);
     }
     if (null === $this->_parameters->getParameter('float.max')) {
         $this->_parameters->setParameter('float.max', PHP_INT_MAX);
     }
     $this->construct();
     return;
 }
Example #3
0
 /**
  * Constructor.
  *
  * @return  void
  */
 public function __construct(array $parameters = [])
 {
     $this->_parameters = new Core\Parameter($this, [], ['rules.public' => [], 'rules.private' => []]);
     $this->_parameters->setParameters($parameters);
     foreach ($this->_parameters->getParameter('rules.public') as $id => $rule) {
         @(list($methods, $pattern, $call, $able, $variables) = $rule);
         if (null === $variables) {
             $variables = [];
         }
         $this->addRule($id, $methods, $pattern, $call, $able, $variables);
     }
     foreach ($this->_parameters->getParameter('rules.private') as $id => $rule) {
         @(list($methods, $pattern, $call, $able, $variables) = $rule);
         if (null === $variables) {
             $variables = [];
         }
         $this->addPrivateRule($id, $methods, $pattern, $call, $able, $variables);
     }
     return;
 }
Example #4
0
 /**
  * Initialize the core.
  *
  * @param   array   $parameters    Parameters of \Hoa\Core.
  * @return  \Hoa\Core
  */
 public function initialize(array $parameters = [])
 {
     $root = dirname(dirname(__DIR__));
     $cwd = 'cli' === PHP_SAPI ? dirname(realpath($_SERVER['argv'][0])) : getcwd();
     $this->_parameters = new Parameter\Parameter($this, ['root' => $root, 'cwd' => $cwd], ['root.hoa' => '(:root:)', 'root.application' => '(:cwd:h:)', 'root.data' => '(:%root.application:h:)' . DS . 'Data' . DS, 'protocol.Application' => '(:%root.application:)' . DS, 'protocol.Application/Public' => 'Public' . DS, 'protocol.Data' => '(:%root.data:)', 'protocol.Data/Etc' => 'Etc' . DS, 'protocol.Data/Etc/Configuration' => 'Configuration' . DS, 'protocol.Data/Etc/Locale' => 'Locale' . DS, 'protocol.Data/Library' => 'Library' . DS . 'Hoathis' . DS . RS . 'Library' . DS . 'Hoa' . DS, 'protocol.Data/Lost+found' => 'Lost+found' . DS, 'protocol.Data/Temporary' => 'Temporary' . DS, 'protocol.Data/Variable' => 'Variable' . DS, 'protocol.Data/Variable/Cache' => 'Cache' . DS, 'protocol.Data/Variable/Database' => 'Database' . DS, 'protocol.Data/Variable/Log' => 'Log' . DS, 'protocol.Data/Variable/Private' => 'Private' . DS, 'protocol.Data/Variable/Run' => 'Run' . DS, 'protocol.Data/Variable/Test' => 'Test' . DS, 'protocol.Library' => '(:%protocol.Data:)Library' . DS . 'Hoathis' . DS . RS . '(:%protocol.Data:)Library' . DS . 'Hoa' . DS . RS . '(:%root.hoa:)' . DS . 'Hoathis' . DS . RS . '(:%root.hoa:)' . DS . 'Hoa' . DS, 'namespace.prefix.*' => '(:%protocol.Data:)Library' . DS . RS . '(:%root.hoa:)' . DS, 'namespace.prefix.Application' => '(:%root.application:h:)' . DS]);
     $this->_parameters->setKeyword('root', $root);
     $this->_parameters->setKeyword('cwd', $cwd);
     $this->_parameters->setParameters($parameters);
     $this->setProtocol();
     return $this;
 }
Example #5
0
 /**
  * Initialize parameters.
  *
  * @param   array  $parameters    Parameters.
  * @return  void
  */
 public static function initializeParameters(array $parameters = [])
 {
     self::$_parameters = new Core\Parameter(__CLASS__, [], ['connection.autoload' => null]);
     self::$_parameters->setParameters($parameters);
     return;
 }
Example #6
0
 /**
  * Constructor.
  *
  * @param   array   $parameters    Parameters.
  * @return  void
  */
 public function __construct(array $parameters = [])
 {
     $this->_parameters = new Core\Parameter(__CLASS__, ['id' => null], ['lifetime' => 3600, 'serialize_content' => true, 'make_id_with.cookie' => true, 'make_id_with.files' => true, 'make_id_with.get' => true, 'make_id_with.post' => true, 'make_id_with.server' => false, 'make_id_with.session' => true, 'apc' => '', 'eaccelerator' => '', 'file.cache_directory' => 'hoa://Data/Variable/Cache/(:id:).ca', 'file.compress.active' => true, 'file.compress.level' => true, 'memcache.compress.active' => true, 'memcache.database.host' => '127.0.0.1', 'memcache.database.port' => 11211, 'memcache.database.persistent' => true, 'sqlite.cache_directory' => 'hoa://Data/Variable/Cache/Cache.db', 'sqlite.database.host' => '127.0.0.1', 'xcache' => '', 'zendplatform' => '']);
     $this->_parameters->setParameters($parameters);
     return;
 }
Example #7
0
 /**
  * Build a new dispatcher.
  *
  * @param   array   $parameters    Parameters.
  * @return  void
  */
 public function __construct(array $parameters = [])
 {
     $this->_parameters = new Core\Parameter(__CLASS__, ['call' => 'main', 'able' => 'main'], ['synchronous.call' => '(:call:U:)', 'synchronous.able' => '(:able:U:)', 'asynchronous.call' => '(:%synchronous.call:)', 'asynchronous.able' => '(:%synchronous.able:)Async']);
     $this->_parameters->setParameters($parameters);
     return;
 }