Verzeichnisstruktur phpBB-3.3.15


Veröffentlicht
28.08.2024

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

CachingFileScanner.php

Zuletzt modifiziert: 02.04.2025, 15:03 - Dateigröße: 3.56 KiB


001  <?php
002  /**
003   * Zend Framework (http://framework.zend.com/)
004   *
005   * @link      http://github.com/zendframework/zf2 for the canonical source repository
006   * @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
007   * @license   http://framework.zend.com/license/new-bsd New BSD License
008   */
009   
010  namespace Zend\Code\Scanner;
011   
012  use Zend\Code\Annotation\AnnotationManager;
013  use Zend\Code\Exception;
014  use Zend\Code\NameInformation;
015   
016  use function file_exists;
017  use function md5;
018  use function realpath;
019  use function spl_object_hash;
020  use function sprintf;
021   
022  class CachingFileScanner extends FileScanner
023  {
024      /**
025       * @var array
026       */
027      protected static $cache = [];
028   
029      /**
030       * @var null|FileScanner
031       */
032      protected $fileScanner;
033   
034      /**
035       * @param  string $file
036       * @param  AnnotationManager $annotationManager
037       * @throws Exception\InvalidArgumentException
038       */
039      public function __construct($file, AnnotationManager $annotationManager = null)
040      {
041          if (! file_exists($file)) {
042              throw new Exception\InvalidArgumentException(sprintf(
043                  'File "%s" not found',
044                  $file
045              ));
046          }
047   
048          $file = realpath($file);
049   
050          $cacheId = md5($file) . '/' . (isset($annotationManager)
051              ? spl_object_hash($annotationManager)
052              : 'no-annotation');
053   
054          if (isset(static::$cache[$cacheId])) {
055              $this->fileScanner = static::$cache[$cacheId];
056          } else {
057              $this->fileScanner       = new FileScanner($file, $annotationManager);
058              static::$cache[$cacheId] = $this->fileScanner;
059          }
060      }
061   
062      /**
063       * @return void
064       */
065      public static function clearCache()
066      {
067          static::$cache = [];
068      }
069   
070      /**
071       * @return AnnotationManager
072       */
073      public function getAnnotationManager()
074      {
075          return $this->fileScanner->getAnnotationManager();
076      }
077   
078      /**
079       * @return array|null|string
080       */
081      public function getFile()
082      {
083          return $this->fileScanner->getFile();
084      }
085   
086      /**
087       * @return null|string
088       */
089      public function getDocComment()
090      {
091          return $this->fileScanner->getDocComment();
092      }
093   
094      /**
095       * @return array
096       */
097      public function getNamespaces()
098      {
099          return $this->fileScanner->getNamespaces();
100      }
101   
102      /**
103       * @param  null|string $namespace
104       * @return array|null
105       */
106      public function getUses($namespace = null)
107      {
108          return $this->fileScanner->getUses($namespace);
109      }
110   
111      /**
112       * @return array
113       */
114      public function getIncludes()
115      {
116          return $this->fileScanner->getIncludes();
117      }
118   
119      /**
120       * @return array
121       */
122      public function getClassNames()
123      {
124          return $this->fileScanner->getClassNames();
125      }
126   
127      /**
128       * @return array
129       */
130      public function getClasses()
131      {
132          return $this->fileScanner->getClasses();
133      }
134   
135      /**
136       * @param  int|string $className
137       * @return ClassScanner
138       */
139      public function getClass($className)
140      {
141          return $this->fileScanner->getClass($className);
142      }
143   
144      /**
145       * @param  string $className
146       * @return bool|null|NameInformation
147       */
148      public function getClassNameInformation($className)
149      {
150          return $this->fileScanner->getClassNameInformation($className);
151      }
152   
153      /**
154       * @return array
155       */
156      public function getFunctionNames()
157      {
158          return $this->fileScanner->getFunctionNames();
159      }
160   
161      /**
162       * @return array
163       */
164      public function getFunctions()
165      {
166          return $this->fileScanner->getFunctions();
167      }
168  }
169