| @@ 270-302 (lines=33) @@ | ||
| 267 | * @return AbstractViewHelper |
|
| 268 | * @throws ViewHelperException |
|
| 269 | */ |
|
| 270 | public function __call($name, $arguments) |
|
| 271 | { |
|
| 272 | // Search in custom view helpers |
|
| 273 | ||
| 274 | /** @var Config $config */ |
|
| 275 | $config = ServiceLocator::instance()->get(Config::class); |
|
| 276 | $namespace = '\\' . $config->get('namespacePrefix'); |
|
| 277 | ||
| 278 | $customViewHelper = $namespace . '\\View\\Helper\\' . ucfirst($name); |
|
| 279 | ||
| 280 | if (class_exists($customViewHelper)) { |
|
| 281 | ||
| 282 | $class = new $customViewHelper; |
|
| 283 | array_unshift($arguments, $this); |
|
| 284 | ||
| 285 | return call_user_func_array($class, $arguments); |
|
| 286 | ||
| 287 | } |
|
| 288 | ||
| 289 | // No custom view helper found, search in core view helpers |
|
| 290 | ||
| 291 | $coreViewHelper = __NAMESPACE__ . '\Helper\\' . ucfirst($name); |
|
| 292 | ||
| 293 | if (class_exists($coreViewHelper)) { |
|
| 294 | ||
| 295 | $class = new $coreViewHelper; |
|
| 296 | array_unshift($arguments, $this); |
|
| 297 | ||
| 298 | return call_user_func_array($class, $arguments); |
|
| 299 | ||
| 300 | } |
|
| 301 | ||
| 302 | throw new ViewHelperException('No view helper for "' . $name . '" found.'); |
|
| 303 | } |
|
| 304 | ||
| 305 | /** |
|
| @@ 261-293 (lines=33) @@ | ||
| 258 | * |
|
| 259 | * @codeCoverageIgnore Not implemented yet |
|
| 260 | */ |
|
| 261 | public function __call($name, $arguments) |
|
| 262 | { |
|
| 263 | // Search in core view helpers first |
|
| 264 | $corePlugin = 'Faulancer\Plugin\\' . ucfirst($name); |
|
| 265 | ||
| 266 | if (class_exists($corePlugin)) { |
|
| 267 | ||
| 268 | $class = new $corePlugin; |
|
| 269 | array_unshift($arguments, $this); |
|
| 270 | ||
| 271 | return call_user_func_array($class, $arguments); |
|
| 272 | ||
| 273 | } |
|
| 274 | ||
| 275 | // No core implementations found; search in custom view helpers |
|
| 276 | ||
| 277 | /** @var Config $config */ |
|
| 278 | $config = ServiceLocator::instance()->get(Config::class); |
|
| 279 | $namespace = '\\' . $config->get('namespacePrefix'); |
|
| 280 | ||
| 281 | $customPlugin = $namespace . '\Plugin\\' . ucfirst($name); |
|
| 282 | ||
| 283 | if (class_exists($customPlugin)) { |
|
| 284 | ||
| 285 | $class = new $customPlugin; |
|
| 286 | array_unshift($arguments, $this); |
|
| 287 | ||
| 288 | return call_user_func_array($class, $arguments); |
|
| 289 | ||
| 290 | } |
|
| 291 | ||
| 292 | throw new PluginException('No plugin for "' . $name . '" found.'); |
|
| 293 | } |
|
| 294 | ||
| 295 | } |
|