"Fossies" - the Fresh Open Source Software Archive

Member "drupal-8.9.10/core/lib/Drupal/Component/Annotation/Reflection/MockFileFinder.php" (26 Nov 2020, 838 Bytes) of package /linux/www/drupal-8.9.10.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "MockFileFinder.php" see the Fossies "Dox" file reference documentation.

    1 <?php
    2 
    3 namespace Drupal\Component\Annotation\Reflection;
    4 
    5 use Doctrine\Common\Reflection\ClassFinderInterface;
    6 
    7 /**
    8  * Defines a mock file finder that only returns a single filename.
    9  *
   10  * This can be used with Doctrine\Common\Reflection\StaticReflectionParser if
   11  * the filename is known and inheritance is not a concern (for example, if
   12  * only the class annotation is needed).
   13  */
   14 class MockFileFinder implements ClassFinderInterface {
   15 
   16   /**
   17    * The only filename this finder ever returns.
   18    *
   19    * @var string
   20    */
   21   protected $filename;
   22 
   23   /**
   24    * {@inheritdoc}
   25    */
   26   public function findFile($class) {
   27     return $this->filename;
   28   }
   29 
   30   /**
   31    * Creates new mock file finder objects.
   32    */
   33   public static function create($filename) {
   34     $object = new static();
   35     $object->filename = $filename;
   36     return $object;
   37   }
   38 
   39 }