Hoa central
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Hoa\Dispatcher\Dispatcher Class Reference
Inheritance diagram for Hoa\Dispatcher\Dispatcher:

Public Member Functions

 __construct (Array $parameters=[])
 
 getParameters ()
 
 dispatch (Router $router, View\Viewable $view=null)
 
 setKitName ($kit)
 
 getKitName ()
 

Protected Member Functions

 resolve (Array $rule, Router $router, View\Viewable $view=null)
 

Protected Attributes

 $_parameters = null
 
 $_currentView = null
 
 $_kit = 'Hoa\Dispatcher\Kit'
 

Detailed Description

Class .

Abstract dispatcher.

Definition at line 51 of file Dispatcher.php.

Constructor & Destructor Documentation

Hoa\Dispatcher\Dispatcher::__construct ( Array  $parameters = [])

Build a new dispatcher.

Parameters
array$parametersParameters.
Returns
void

Router variables.

'variables.…' => …

Definition at line 82 of file Dispatcher.php.

83  {
84  $this->_parameters = new Core\Parameter(
85  __CLASS__,
86  [
87  'call' => 'main',
88  'able' => 'main'
89  ],
90  [
91  'synchronous.call' => '(:call:U:)',
92  'synchronous.able' => '(:able:U:)',
93 
94  'asynchronous.call' => '(:%synchronous.call:)',
95  'asynchronous.able' => '(:%synchronous.able:)Async',
96 
102  ]
103  );
104  $this->_parameters->setParameters($parameters);
105 
106  return;
107  }

Member Function Documentation

Hoa\Dispatcher\Dispatcher::dispatch ( Router  $router,
View\Viewable  $view = null 
)

Dispatch a router rule.

Parameters
\Hoa\Router$routerRouter.
\Hoa\View\Viewable$viewView.
Returns
mixed
Exceptions

Definition at line 127 of file Dispatcher.php.

128  {
129  $rule = $router->getTheRule();
130 
131  if (null === $rule) {
132  $router->route();
133  $rule = $router->getTheRule();
134  }
135 
136  if (null === $view) {
137  $view = $this->_currentView;
138  } else {
139  $this->_currentView = $view;
140  }
141 
142  $parameters = $this->_parameters;
143  $this->_parameters = clone $this->_parameters;
144 
145  foreach ($rule[Router::RULE_VARIABLES] as $key => $value) {
146  $this->_parameters->setParameter('variables.' . $key, $value);
147  }
148 
149  $out = $this->resolve($rule, $router, $view);
150  unset($this->_parameters);
151  $this->_parameters = $parameters;
152 
153  return $out;
154  }
const RULE_VARIABLES
Definition: Router.php:112
resolve(Array $rule, Router $router, View\Viewable $view=null)

Here is the call graph for this function:

Hoa\Dispatcher\Dispatcher::getKitName ( )

Get kit's name.

Returns
string

Definition at line 191 of file Dispatcher.php.

192  {
193  return $this->_kit;
194  }

Here is the caller graph for this function:

Hoa\Dispatcher\Dispatcher::getParameters ( )

Get parameters.

Returns

Implements Hoa\Core\Parameter\Parameterizable.

Definition at line 114 of file Dispatcher.php.

115  {
116  return $this->_parameters;
117  }
Hoa\Dispatcher\Dispatcher::resolve ( Array  $rule,
Router  $router,
View\Viewable  $view = null 
)
abstractprotected

Resolve the dispatch call.

Parameters
array$ruleRule.
\Hoa\Router$routerRouter.
\Hoa\View\Viewable$viewView.
Returns
mixed
Exceptions

Here is the caller graph for this function:

Hoa\Dispatcher\Dispatcher::setKitName (   $kit)

Set kit's name.

Parameters
string$kitKit's name.
Returns
string
Exceptions

Definition at line 178 of file Dispatcher.php.

179  {
180  $old = $this->_kit;
181  $this->_kit = $kit;
182 
183  return $old;
184  }

Member Data Documentation

Hoa\Dispatcher\Dispatcher::$_currentView = null
protected

Definition at line 65 of file Dispatcher.php.

Hoa\Dispatcher\Dispatcher::$_kit = 'Hoa\Dispatcher\Kit'
protected

Definition at line 72 of file Dispatcher.php.

Hoa\Dispatcher\Dispatcher::$_parameters = null
protected

Definition at line 58 of file Dispatcher.php.


The documentation for this class was generated from the following file: