[ Index ]

PHP Cross Reference of phpBB-3.3.12-deutsch

title

Body

[close]

/vendor/zendframework/zend-code/src/Scanner/ -> FileScanner.php (source)

   1  <?php
   2  /**
   3   * Zend Framework (http://framework.zend.com/)
   4   *
   5   * @link      http://github.com/zendframework/zf2 for the canonical source repository
   6   * @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
   7   * @license   http://framework.zend.com/license/new-bsd New BSD License
   8   */
   9  
  10  namespace Zend\Code\Scanner;
  11  
  12  use Zend\Code\Annotation\AnnotationManager;
  13  use Zend\Code\Exception;
  14  
  15  use function file_exists;
  16  use function file_get_contents;
  17  use function sprintf;
  18  use function token_get_all;
  19  
  20  class FileScanner extends TokenArrayScanner implements ScannerInterface
  21  {
  22      /**
  23       * @var string
  24       */
  25      protected $file;
  26  
  27      /**
  28       * @param  string $file
  29       * @param  null|AnnotationManager $annotationManager
  30       * @throws Exception\InvalidArgumentException
  31       */
  32      public function __construct($file, AnnotationManager $annotationManager = null)
  33      {
  34          $this->file = $file;
  35          if (! file_exists($file)) {
  36              throw new Exception\InvalidArgumentException(sprintf(
  37                  'File "%s" not found',
  38                  $file
  39              ));
  40          }
  41          parent::__construct(token_get_all(file_get_contents($file)), $annotationManager);
  42      }
  43  
  44      /**
  45       * @return string
  46       */
  47      public function getFile()
  48      {
  49          return $this->file;
  50      }
  51  }


Generated: Sun Jun 23 12:25:44 2024 Cross-referenced by PHPXref 0.7.1