Deprecated: Constant E_STRICT is deprecated in /home/pastorz/old-espace-client/vendor/symfony/error-handler/ErrorHandler.php on line 58

Deprecated: Constant E_STRICT is deprecated in /home/pastorz/old-espace-client/vendor/symfony/error-handler/ErrorHandler.php on line 76
Symfony Profiler

vendor/liip/imagine-bundle/Imagine/Cache/Signer.php line 29

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the `liip/LiipImagineBundle` project.
  4.  *
  5.  * (c) https://github.com/liip/LiipImagineBundle/graphs/contributors
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE.md
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace Liip\ImagineBundle\Imagine\Cache;
  11. class Signer implements SignerInterface
  12. {
  13.     /**
  14.      * @var string
  15.      */
  16.     private $secret;
  17.     /**
  18.      * @param string $secret
  19.      */
  20.     public function __construct($secret)
  21.     {
  22.         $this->secret $secret;
  23.     }
  24.     public function sign($path, array $runtimeConfig null)
  25.     {
  26.         if ($runtimeConfig) {
  27.             array_walk_recursive($runtimeConfig, function (&$value) {
  28.                 $value = (string) $value;
  29.             });
  30.         }
  31.         return mb_substr(preg_replace('/[^a-zA-Z0-9-_]/'''base64_encode(hash_hmac('sha256'ltrim($path'/').(null === $runtimeConfig ?: serialize($runtimeConfig)), $this->secrettrue))), 08);
  32.     }
  33.     public function check($hash$path, array $runtimeConfig null)
  34.     {
  35.         return $hash === $this->sign($path$runtimeConfig);
  36.     }
  37. }