1 | <?php namespace Knot\Dict; |
||
7 | class HelperManager { |
||
8 | |||
9 | /** |
||
10 | * Helper Manager Object. |
||
11 | */ |
||
12 | protected static $instance = null; |
||
13 | |||
14 | /** |
||
15 | * Helper list. |
||
16 | */ |
||
17 | private $helperList = [ ]; |
||
18 | |||
19 | /** |
||
20 | * Functions Routes. |
||
21 | */ |
||
22 | private $functionRoutes = [ ]; |
||
23 | |||
24 | |||
25 | /** |
||
26 | * Return instance of Self! |
||
27 | */ |
||
28 | public static function getInstance() |
||
37 | |||
38 | |||
39 | public function __construct() |
||
49 | |||
50 | |||
51 | public static function getBaseHelpers() |
||
59 | |||
60 | |||
61 | /** |
||
62 | * Add new functions to static function list. |
||
63 | * |
||
64 | * @param $functionRoute |
||
65 | * @param Callable $function |
||
66 | * |
||
67 | * @return false|Callable |
||
68 | */ |
||
69 | public function addRoute($functionRoute, callable $function) |
||
78 | |||
79 | |||
80 | /** |
||
81 | * @param string $functionName |
||
82 | * |
||
83 | * @return bool |
||
84 | */ |
||
85 | public function isRoute($functionName) |
||
89 | |||
90 | |||
91 | /** |
||
92 | * Load Helper! |
||
93 | * |
||
94 | * @param HelperInterface $helperObject |
||
95 | * |
||
96 | * @return false|HelperInterface |
||
97 | */ |
||
98 | public function loadHelper(HelperInterface $helperObject) |
||
111 | |||
112 | |||
113 | /** |
||
114 | * @param string $functionName |
||
115 | * @param array $arguments |
||
116 | * @param \Knot\ParentArray |
||
117 | * |
||
118 | * @return mixed |
||
119 | * @throws WrongFunctionException|FunctionExecuteException |
||
120 | */ |
||
121 | public function execute($functionName, $arguments, $knot) |
||
141 | |||
142 | |||
143 | public function getRoute($staticFunctionName) |
||
147 | |||
148 | |||
149 | public function isHelper($helperName) |
||
153 | } |
||
154 |