Exemple #1
0
 private function _doFind($rootDirectory, $suffix)
 {
     $rootDirectory = $rootDirectory . DIRECTORY_SEPARATOR . 'templates';
     if ($this->shouldLog()) {
         $this->_logDebug(sprintf('Looking for <code>%s</code> files in <code>%s</code>', $suffix, $rootDirectory));
     }
     if (!is_dir($rootDirectory)) {
         if ($this->shouldLog()) {
             $this->_logDebug(sprintf('<code>%s</code> does not exist', $rootDirectory));
         }
         return array();
     }
     $finder = $this->_finderFactory->createFinder()->files()->in($rootDirectory)->name('*' . $suffix);
     $toReturn = array();
     /**
      * @var $file SplFileInfo
      */
     foreach ($finder as $file) {
         $toReturn[] = ltrim(str_replace($rootDirectory, '', $file->getRealPath()), DIRECTORY_SEPARATOR);
     }
     if ($this->shouldLog()) {
         $this->_logDebug(sprintf('Found <code>%d</code> <code>%s</code> templates in <code>%s</code>', count($toReturn), $suffix, $rootDirectory));
     }
     return $toReturn;
 }
 public function __findManifestPathsInDirectory($directory)
 {
     if (!is_dir($directory)) {
         return array();
     }
     $finder = $this->_finderFactory->createFinder();
     $toReturn = array();
     if ($this->_shouldLog) {
         $this->_logDebug(sprintf('Searching for manifests in <code>%s</code>', $directory));
     }
     /** @noinspection PhpUndefinedMethodInspection */
     $finder = $finder->followLinks()->files()->in($directory)->name($this->_manifestName)->depth('< 2');
     /**
      * @var $infoFile SplFileInfo
      */
     foreach ($finder as $infoFile) {
         $toReturn[] = $infoFile->getRealPath();
     }
     if ($this->_shouldLog) {
         $this->_logDebug(sprintf('Found <code>%d</code> manifest(s) inside <code>%s</code>', count($toReturn), $directory));
     }
     return $toReturn;
 }