private static function setRoutes() { $routesFilePath = Application::getConfigPath() . self::ROUTES_FILENAME; if (!file_exists($routesFilePath)) { throw new \Exception(self::ROUTES_FILENAME . ' config file can not be found'); } $routesArray = (require $routesFilePath); if (!is_array($routesArray)) { throw new \Exception(self::ROUTES_FILENAME . ' config file should return an array'); } if (sizeof($routesArray) == 0) { throw new \Exception(self::ROUTES_FILENAME . ' config file should contain at least one route'); } foreach ($routesArray as $key => $value) { if ($key[0] != '/') { throw new \Exception('Each route in routes config file should starts from slash'); } } self::$routes = $routesArray; return; }