Exemplo n.º 1
0
 /**
  * @return LibraryInformationInterface
  */
 public function getLibraryInformation()
 {
     if ($this->information === null) {
         if (($path = $this->getOption('libraryDataPath')) !== null) {
             return $this->information = LibraryInformation::createFromFile($path);
         }
         $this->information = LibraryInformation::createWithDefaults();
     }
     return $this->information;
 }
Exemplo n.º 2
0
 /**
  * @param string $librarySourceOption
  * @param int $mode
  * @return \Pvra\Analysers\LanguageFeatureAnalyser[]
  */
 protected function createNodeWalkerInstances($librarySourceOption = null, $mode = LanguageFeatureAnalyser::MODE_ADDITION)
 {
     $analysers = [];
     foreach ($this->expectedWalkers as $walker) {
         if (in_array(LibraryInformationAwareInterface::class, class_implements($walker))) {
             if (is_string($librarySourceOption)) {
                 $info = new LibraryInformation($this->getArrayFromFile($librarySourceOption)[1]);
             } else {
                 $info = LibraryInformation::createWithDefaults();
             }
             $analysers[] = (new $walker(['mode' => $mode]))->setLibraryInformation($info);
         } else {
             $analysers[] = new $walker(['mode' => $mode]);
         }
     }
     return $analysers;
 }