Verzeichnisstruktur phpBB-3.2.0


Veröffentlicht
06.01.2017

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: 09.10.2024, 12:57 - Dateigröße: 3.44 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-2015 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  class CachingFileScanner extends FileScanner
 017  {
 018      /**
 019       * @var array
 020       */
 021      protected static $cache = array();
 022   
 023      /**
 024       * @var null|FileScanner
 025       */
 026      protected $fileScanner = null;
 027   
 028      /**
 029       * @param  string $file
 030       * @param  AnnotationManager $annotationManager
 031       * @throws Exception\InvalidArgumentException
 032       */
 033      public function __construct($file, AnnotationManager $annotationManager = null)
 034      {
 035          if (!file_exists($file)) {
 036              throw new Exception\InvalidArgumentException(sprintf(
 037                  'File "%s" not found',
 038                  $file
 039              ));
 040          }
 041   
 042          $file = realpath($file);
 043   
 044          $cacheId = md5($file) . '/' . ((isset($annotationManager) ? spl_object_hash($annotationManager) : 'no-annotation'));
 045   
 046          if (isset(static::$cache[$cacheId])) {
 047              $this->fileScanner = static::$cache[$cacheId];
 048          } else {
 049              $this->fileScanner       = new FileScanner($file, $annotationManager);
 050              static::$cache[$cacheId] = $this->fileScanner;
 051          }
 052      }
 053   
 054      /**
 055       * @return void
 056       */
 057      public static function clearCache()
 058      {
 059          static::$cache = array();
 060      }
 061   
 062      /**
 063       * @return AnnotationManager
 064       */
 065      public function getAnnotationManager()
 066      {
 067          return $this->fileScanner->getAnnotationManager();
 068      }
 069   
 070      /**
 071       * @return array|null|string
 072       */
 073      public function getFile()
 074      {
 075          return $this->fileScanner->getFile();
 076      }
 077   
 078      /**
 079       * @return null|string
 080       */
 081      public function getDocComment()
 082      {
 083          return $this->fileScanner->getDocComment();
 084      }
 085   
 086      /**
 087       * @return array
 088       */
 089      public function getNamespaces()
 090      {
 091          return $this->fileScanner->getNamespaces();
 092      }
 093   
 094      /**
 095       * @param  null|string $namespace
 096       * @return array|null
 097       */
 098      public function getUses($namespace = null)
 099      {
 100          return $this->fileScanner->getUses($namespace);
 101      }
 102   
 103      /**
 104       * @return array
 105       */
 106      public function getIncludes()
 107      {
 108          return $this->fileScanner->getIncludes();
 109      }
 110   
 111      /**
 112       * @return array
 113       */
 114      public function getClassNames()
 115      {
 116          return $this->fileScanner->getClassNames();
 117      }
 118   
 119      /**
 120       * @return array
 121       */
 122      public function getClasses()
 123      {
 124          return $this->fileScanner->getClasses();
 125      }
 126   
 127      /**
 128       * @param  int|string $className
 129       * @return ClassScanner
 130       */
 131      public function getClass($className)
 132      {
 133          return $this->fileScanner->getClass($className);
 134      }
 135   
 136      /**
 137       * @param  string $className
 138       * @return bool|null|NameInformation
 139       */
 140      public function getClassNameInformation($className)
 141      {
 142          return $this->fileScanner->getClassNameInformation($className);
 143      }
 144   
 145      /**
 146       * @return array
 147       */
 148      public function getFunctionNames()
 149      {
 150          return $this->fileScanner->getFunctionNames();
 151      }
 152   
 153      /**
 154       * @return array
 155       */
 156      public function getFunctions()
 157      {
 158          return $this->fileScanner->getFunctions();
 159      }
 160  }
 161