/** * @param File $file * @return ViewFile * @throws ViewFileException */ public function setFile(File $file) { if (!$file->isFile()) { throw new ViewFileException(FileException::ERROR_LOADING_FILE, $this, $file->getFilePath()); } $this->file = $file; return $this; }
/** * @param File $iniFile * @return RouteManager * @throws FileException */ public function setRouteManagerFromIniFile(File $iniFile) { if (!$iniFile->isFile()) { throw new FileException(FileException::ERROR_LOADING_FILE, $this, $iniFile); } foreach (parse_ini_file($iniFile->getFilePath(), true) as $routeName => $routeArray) { $route = new Route($routeName); $route->serialize($routeArray); $this->getRouteManager()->add($route); } return $this; }
/** * @param Directory $directory * @return FileManager */ public function getFilesFromDirectory(Directory $directory) { $this->removeAll(); if ($directory->isDir()) { foreach (scandir($directory->getPath()) as $file) { if (substr($file, 0, 1) != ".") { $File = new File(rtrim($directory->getPath(), "/") . "/" . $file); if ($File->isFile()) { $this->add($File); } } } } return $this; }
/** * @param File $file * @return Mail */ public function setBodyFromFile(File $file) { $this->body = $file->getContent(); return $this; }