/** * @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; }