vendor/pimcore/pimcore/lib/Templating/HelperBroker/TemplatingHelper.php line 44

Open in your IDE?
  1. <?php
  2. /**
  3.  * Pimcore
  4.  *
  5.  * This source file is available under two different licenses:
  6.  * - GNU General Public License version 3 (GPLv3)
  7.  * - Pimcore Enterprise License (PEL)
  8.  * Full copyright and license information is available in
  9.  * LICENSE.md which is distributed with this source code.
  10.  *
  11.  * @copyright  Copyright (c) Pimcore GmbH (http://www.pimcore.org)
  12.  * @license    http://www.pimcore.org/license     GPLv3 and PEL
  13.  */
  14. namespace Pimcore\Templating\HelperBroker;
  15. use Pimcore\Templating\PhpEngine;
  16. class TemplatingHelper implements HelperBrokerInterface
  17. {
  18.     /**
  19.      * @inheritDoc
  20.      */
  21.     public function supports(PhpEngine $engine$method)
  22.     {
  23.         if ($engine->has($method)) {
  24.             return true;
  25.         }
  26.         return false;
  27.     }
  28.     /**
  29.      * Run or return a native view helper
  30.      *
  31.      * @inheritDoc
  32.      */
  33.     public function helper(PhpEngine $engine$method, array $arguments)
  34.     {
  35.         $helper $engine->get($method);
  36.         // helper implements __invoke -> run it directly
  37.         if (is_callable($helper)) {
  38.             return call_user_func_array($helper$arguments);
  39.         }
  40.         return $helper;
  41.     }
  42. }