[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/vendor/symfony/config/ -> ConfigCache.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;
  13  
  14  use Symfony\Component\Config\Resource\SelfCheckingResourceChecker;
  15  
  16  /**
  17   * ConfigCache caches arbitrary content in files on disk.
  18   *
  19   * When in debug mode, those metadata resources that implement
  20   * \Symfony\Component\Config\Resource\SelfCheckingResourceInterface will
  21   * be used to check cache freshness.
  22   *
  23   * @author Fabien Potencier <fabien@symfony.com>
  24   * @author Matthias Pigulla <mp@webfactory.de>
  25   */
  26  class ConfigCache extends ResourceCheckerConfigCache
  27  {
  28      private $debug;
  29  
  30      /**
  31       * @param string $file  The absolute cache path
  32       * @param bool   $debug Whether debugging is enabled or not
  33       */
  34      public function __construct($file, $debug)
  35      {
  36          $this->debug = (bool) $debug;
  37  
  38          $checkers = [];
  39          if (true === $this->debug) {
  40              $checkers = [new SelfCheckingResourceChecker()];
  41          }
  42  
  43          parent::__construct($file, $checkers);
  44      }
  45  
  46      /**
  47       * Checks if the cache is still fresh.
  48       *
  49       * This implementation always returns true when debug is off and the
  50       * cache file exists.
  51       *
  52       * @return bool true if the cache is fresh, false otherwise
  53       */
  54      public function isFresh()
  55      {
  56          if (!$this->debug && is_file($this->getPath())) {
  57              return true;
  58          }
  59  
  60          return parent::isFresh();
  61      }
  62  }


Generated: Mon Nov 25 19:05:08 2024 Cross-referenced by PHPXref 0.7.1