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