private function traveller($directory, Intent $intent = null)
 {
     if (!($dirOpen = opendir($directory))) {
         return false;
     }
     $files = [];
     while ($fileName = readdir($dirOpen)) {
         if ($fileName === "." || $fileName === "..") {
             continue;
         }
         $fileIns = new File($directory . "/" . $fileName);
         if ($fileIns->isDirectory() === true && $fileIns->isReadable() === true) {
             $this->traveller($fileIns->getPath(), $intent);
             $this->callback->onCallback(pathinfo($fileIns->getPath()), $intent);
         } elseif ($fileIns->isFile()) {
             if ($this->mode == self::MODE_SAMETIME) {
                 $this->callback->onCallback(pathinfo($fileIns->getPath()), $intent);
             } elseif ($this->mode == self::MODE_SEPERATE_FILES) {
                 $this->files[] = $fileIns;
                 continue;
             } elseif ($fileIns->isReadable() === false) {
                 $this->errorStack->putError(self::TAG, self::ERROR_CANNOT_BE_READ);
             }
         }
     }
     closedir($dirOpen);
     return true;
 }
Esempio n. 2
0
 public static function getPattenFromFile(File $file)
 {
     if (!$file->isFile() || !$file->isReadable()) {
         return false;
     }
     return new Pattern($file->getIndex());
 }
Esempio n. 3
0
 function readCache($cacheName)
 {
     if (!$this->isCached($cacheName)) {
         return false;
     }
     $file = new File($this->cacheDirectory . "/" . $cacheName);
     if (!$file->isFile() || !$file->isReadable()) {
         return false;
     }
     return $file->getIndex();
 }