public function visit(Dir $dir) { $files = $dir->listFiles(); foreach ($files as $f) { if ($f instanceof File && $f->getFullExtension() == "blade.php") { $content = $f->getContent(); $broken_list = array(); $matches = array(); preg_match_all("/\\@require_local_js\\(['\"](?P<path>[^'\"]+)['\"]\\)/", $content, $matches, PREG_SET_ORDER); foreach ($matches as $m) { if (!$this->check_path($m["path"])) { $broken_list[] = $m[0]; } } preg_match_all("/\\@require_local_css\\(['\"](?P<path>[^'\"]+)['\"]\\)/", $content, $matches, PREG_SET_ORDER); foreach ($matches as $m) { if (!$this->check_path($m["path"])) { $broken_list[] = $m[0]; } } if (!empty($broken_list)) { $this->has_broken_paths = true; $this->info(""); $this->error("Broken paths inside file " . $f->getPath() . " : "); foreach ($broken_list as $bk) { $this->info($bk . " is broken."); } } } } return true; }
public function __construct(Dir $d) { $this->name = $d->getFullName(); $folders = $d->listFolders(); foreach ($folders as $fld) { $this->folders[$fld->getName()] = new LangFolder($fld); } $files = $d->listFiles(); foreach ($files as $fl) { $this->files[$fl->getName()] = new LangFile($fl); } }
function testListFiles() { $d = new Dir("/test/properties_dir/"); $results = $d->listFiles(); $this->assertEquals(3, count($results), "Il numero dei risultati non corrisponde!!"); }