/** * See if we can access this route * @return boolean */ public function access() { if (empty($this->before)) { return true; } foreach ($this->before as $before) { if (is_callable($before) && !$before()) { return false; } elseif (!Routes::before($before)) { return false; } } return true; }
/** * Get route from string * @param string $part * @return Route */ public function getRouteFromPart($part) { foreach (Routes::getRoutes() as $route) { if ($route->getUrl() == $part) { return $route; } } return NULL; }
<?php use Virge\Routes; /** * * @author Michael Kramer */ Routes::add('api', '\\Virge\\Api\\Controller\\ApiController', 'entry');