vendor/vich/uploader-bundle/src/Twig/Extension/UploaderExtensionRuntime.php line 32

Open in your IDE?
  1. <?php
  2. namespace Vich\UploaderBundle\Twig\Extension;
  3. use Twig\Extension\RuntimeExtensionInterface;
  4. use Vich\UploaderBundle\Templating\Helper\UploaderHelperInterface;
  5. /**
  6.  * @author Massimiliano Arione <garakkio@gmail.com>
  7.  */
  8. final class UploaderExtensionRuntime implements RuntimeExtensionInterface
  9. {
  10.     /**
  11.      * @var UploaderHelperInterface
  12.      */
  13.     private $helper;
  14.     public function __construct(UploaderHelperInterface $helper)
  15.     {
  16.         $this->helper $helper;
  17.     }
  18.     /**
  19.      * Gets the public path for the file associated with the uploadable object.
  20.      *
  21.      * @param object|array $object    The object or array
  22.      * @param string|null  $fieldName The field name
  23.      * @param string|null  $className The class name with the uploadable field. Mandatory if $object is an array
  24.      *
  25.      * @return string|null The public path or null if file not stored
  26.      */
  27.     public function asset($object, ?string $fieldName null, ?string $className null): ?string
  28.     {
  29.         // @phpstan-ignore-next-line
  30.         return $this->helper->asset($object$fieldName$className);
  31.     }
  32. }