[ Index ]

PHP Cross Reference of phpBB-3.2.11-deutsch

title

Body

[close]

/vendor/symfony/finder/Adapter/ -> AbstractAdapter.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\Finder\Adapter;
  13  
  14  @trigger_error('The '.__NAMESPACE__.'\AbstractAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  15  
  16  /**
  17   * Interface for finder engine implementations.
  18   *
  19   * @author Jean-François Simon <contact@jfsimon.fr>
  20   *
  21   * @deprecated since 2.8, to be removed in 3.0. Use Finder instead.
  22   */
  23  abstract class AbstractAdapter implements AdapterInterface
  24  {
  25      protected $followLinks = false;
  26      protected $mode = 0;
  27      protected $minDepth = 0;
  28      protected $maxDepth = PHP_INT_MAX;
  29      protected $exclude = array();
  30      protected $names = array();
  31      protected $notNames = array();
  32      protected $contains = array();
  33      protected $notContains = array();
  34      protected $sizes = array();
  35      protected $dates = array();
  36      protected $filters = array();
  37      protected $sort = false;
  38      protected $paths = array();
  39      protected $notPaths = array();
  40      protected $ignoreUnreadableDirs = false;
  41  
  42      private static $areSupported = array();
  43  
  44      /**
  45       * {@inheritdoc}
  46       */
  47      public function isSupported()
  48      {
  49          $name = $this->getName();
  50  
  51          if (!array_key_exists($name, self::$areSupported)) {
  52              self::$areSupported[$name] = $this->canBeUsed();
  53          }
  54  
  55          return self::$areSupported[$name];
  56      }
  57  
  58      /**
  59       * {@inheritdoc}
  60       */
  61      public function setFollowLinks($followLinks)
  62      {
  63          $this->followLinks = $followLinks;
  64  
  65          return $this;
  66      }
  67  
  68      /**
  69       * {@inheritdoc}
  70       */
  71      public function setMode($mode)
  72      {
  73          $this->mode = $mode;
  74  
  75          return $this;
  76      }
  77  
  78      /**
  79       * {@inheritdoc}
  80       */
  81      public function setDepths(array $depths)
  82      {
  83          $this->minDepth = 0;
  84          $this->maxDepth = PHP_INT_MAX;
  85  
  86          foreach ($depths as $comparator) {
  87              switch ($comparator->getOperator()) {
  88                  case '>':
  89                      $this->minDepth = $comparator->getTarget() + 1;
  90                      break;
  91                  case '>=':
  92                      $this->minDepth = $comparator->getTarget();
  93                      break;
  94                  case '<':
  95                      $this->maxDepth = $comparator->getTarget() - 1;
  96                      break;
  97                  case '<=':
  98                      $this->maxDepth = $comparator->getTarget();
  99                      break;
 100                  default:
 101                      $this->minDepth = $this->maxDepth = $comparator->getTarget();
 102              }
 103          }
 104  
 105          return $this;
 106      }
 107  
 108      /**
 109       * {@inheritdoc}
 110       */
 111      public function setExclude(array $exclude)
 112      {
 113          $this->exclude = $exclude;
 114  
 115          return $this;
 116      }
 117  
 118      /**
 119       * {@inheritdoc}
 120       */
 121      public function setNames(array $names)
 122      {
 123          $this->names = $names;
 124  
 125          return $this;
 126      }
 127  
 128      /**
 129       * {@inheritdoc}
 130       */
 131      public function setNotNames(array $notNames)
 132      {
 133          $this->notNames = $notNames;
 134  
 135          return $this;
 136      }
 137  
 138      /**
 139       * {@inheritdoc}
 140       */
 141      public function setContains(array $contains)
 142      {
 143          $this->contains = $contains;
 144  
 145          return $this;
 146      }
 147  
 148      /**
 149       * {@inheritdoc}
 150       */
 151      public function setNotContains(array $notContains)
 152      {
 153          $this->notContains = $notContains;
 154  
 155          return $this;
 156      }
 157  
 158      /**
 159       * {@inheritdoc}
 160       */
 161      public function setSizes(array $sizes)
 162      {
 163          $this->sizes = $sizes;
 164  
 165          return $this;
 166      }
 167  
 168      /**
 169       * {@inheritdoc}
 170       */
 171      public function setDates(array $dates)
 172      {
 173          $this->dates = $dates;
 174  
 175          return $this;
 176      }
 177  
 178      /**
 179       * {@inheritdoc}
 180       */
 181      public function setFilters(array $filters)
 182      {
 183          $this->filters = $filters;
 184  
 185          return $this;
 186      }
 187  
 188      /**
 189       * {@inheritdoc}
 190       */
 191      public function setSort($sort)
 192      {
 193          $this->sort = $sort;
 194  
 195          return $this;
 196      }
 197  
 198      /**
 199       * {@inheritdoc}
 200       */
 201      public function setPath(array $paths)
 202      {
 203          $this->paths = $paths;
 204  
 205          return $this;
 206      }
 207  
 208      /**
 209       * {@inheritdoc}
 210       */
 211      public function setNotPath(array $notPaths)
 212      {
 213          $this->notPaths = $notPaths;
 214  
 215          return $this;
 216      }
 217  
 218      /**
 219       * {@inheritdoc}
 220       */
 221      public function ignoreUnreadableDirs($ignore = true)
 222      {
 223          $this->ignoreUnreadableDirs = (bool) $ignore;
 224  
 225          return $this;
 226      }
 227  
 228      /**
 229       * Returns whether the adapter is supported in the current environment.
 230       *
 231       * This method should be implemented in all adapters. Do not implement
 232       * isSupported in the adapters as the generic implementation provides a cache
 233       * layer.
 234       *
 235       * @see isSupported()
 236       *
 237       * @return bool Whether the adapter is supported
 238       */
 239      abstract protected function canBeUsed();
 240  }


Generated: Wed Nov 11 20:33:01 2020 Cross-referenced by PHPXref 0.7.1