[ Index ]

PHP Cross Reference of phpBB-3.3.11-deutsch

title

Body

[close]

/vendor/symfony/dependency-injection/Config/ -> AutowireServiceResource.php (source)

   1  <?php
   2  
   3  /*
   4   * This file is part of the Symfony package.
   5   *
   6   * (c) Fabien Potencier <fabien@symfony.com>
   7   *
   8   * For the full copyright and license information, please view the LICENSE
   9   * file that was distributed with this source code.
  10   */
  11  
  12  namespace Symfony\Component\DependencyInjection\Config;
  13  
  14  @trigger_error('The '.__NAMESPACE__.'\AutowireServiceResource class is deprecated since Symfony 3.3 and will be removed in 4.0. Use ContainerBuilder::getReflectionClass() instead.', \E_USER_DEPRECATED);
  15  
  16  use Symfony\Component\Config\Resource\SelfCheckingResourceInterface;
  17  use Symfony\Component\DependencyInjection\Compiler\AutowirePass;
  18  
  19  /**
  20   * @deprecated since version 3.3, to be removed in 4.0. Use ContainerBuilder::getReflectionClass() instead.
  21   */
  22  class AutowireServiceResource implements SelfCheckingResourceInterface, \Serializable
  23  {
  24      private $class;
  25      private $filePath;
  26      private $autowiringMetadata = [];
  27  
  28      public function __construct($class, $path, array $autowiringMetadata)
  29      {
  30          $this->class = $class;
  31          $this->filePath = $path;
  32          $this->autowiringMetadata = $autowiringMetadata;
  33      }
  34  
  35      public function isFresh($timestamp)
  36      {
  37          if (!file_exists($this->filePath)) {
  38              return false;
  39          }
  40  
  41          // has the file *not* been modified? Definitely fresh
  42          if (@filemtime($this->filePath) <= $timestamp) {
  43              return true;
  44          }
  45  
  46          try {
  47              $reflectionClass = new \ReflectionClass($this->class);
  48          } catch (\ReflectionException $e) {
  49              // the class does not exist anymore!
  50              return false;
  51          }
  52  
  53          return (array) $this === (array) AutowirePass::createResourceForClass($reflectionClass);
  54      }
  55  
  56      public function __toString()
  57      {
  58          return 'service.autowire.'.$this->class;
  59      }
  60  
  61      /**
  62       * @internal
  63       */
  64      public function serialize()
  65      {
  66          return serialize([$this->class, $this->filePath, $this->autowiringMetadata]);
  67      }
  68  
  69      /**
  70       * @internal
  71       */
  72      public function unserialize($serialized)
  73      {
  74          if (\PHP_VERSION_ID >= 70000) {
  75              list($this->class, $this->filePath, $this->autowiringMetadata) = unserialize($serialized, ['allowed_classes' => false]);
  76          } else {
  77              list($this->class, $this->filePath, $this->autowiringMetadata) = unserialize($serialized);
  78          }
  79      }
  80  
  81      /**
  82       * @deprecated Implemented for compatibility with Symfony 2.8
  83       */
  84      public function getResource()
  85      {
  86          return $this->filePath;
  87      }
  88  }


Generated: Sat Nov 4 14:26:03 2023 Cross-referenced by PHPXref 0.7.1