[ Index ]

PHP Cross Reference of phpBB-3.1.12-deutsch

title

Body

[close]

/vendor/symfony/config/Symfony/Component/Config/Resource/ -> FileResource.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\Config\Resource;
  13  
  14  /**
  15   * FileResource represents a resource stored on the filesystem.
  16   *
  17   * The resource can be a file or a directory.
  18   *
  19   * @author Fabien Potencier <fabien@symfony.com>
  20   */
  21  class FileResource implements ResourceInterface, \Serializable
  22  {
  23      /**
  24       * @var string|false
  25       */
  26      private $resource;
  27  
  28      /**
  29       * Constructor.
  30       *
  31       * @param string $resource The file path to the resource
  32       */
  33      public function __construct($resource)
  34      {
  35          $this->resource = realpath($resource);
  36      }
  37  
  38      /**
  39       * {@inheritdoc}
  40       */
  41      public function __toString()
  42      {
  43          return (string) $this->resource;
  44      }
  45  
  46      /**
  47       * {@inheritdoc}
  48       */
  49      public function getResource()
  50      {
  51          return $this->resource;
  52      }
  53  
  54      /**
  55       * {@inheritdoc}
  56       */
  57      public function isFresh($timestamp)
  58      {
  59          if (false === $this->resource || !file_exists($this->resource)) {
  60              return false;
  61          }
  62  
  63          return filemtime($this->resource) <= $timestamp;
  64      }
  65  
  66      public function serialize()
  67      {
  68          return serialize($this->resource);
  69      }
  70  
  71      public function unserialize($serialized)
  72      {
  73          $this->resource = unserialize($serialized);
  74      }
  75  }


Generated: Thu Jan 11 00:25:41 2018 Cross-referenced by PHPXref 0.7.1