/** * Find the route that uses the given action. * * @param string $action * @return array */ public static function uses($action) { // If the action has already been reverse routed before, we'll just // grab the previously found route to save time. They are cached // in a static array on the class. if (isset(static::$uses[$action])) { return static::$uses[$action]; } Bundle::routes(Bundle::name($action)); // To find the route, we'll simply spin through the routes looking // for a route with a "uses" key matching the action, and if we // find one, we cache and return it. foreach (static::routes() as $method => $routes) { foreach ($routes as $key => $value) { if (isset($value['uses']) and $value['uses'] === $action) { return static::$uses[$action] = array($key => $value); } } } }
public static function uses($action) { if (isset(static::$uses[$action])) { return static::$uses[$action]; } Bundle::routes(Bundle::name($action)); foreach (static::routes() as $method => $routes) { foreach ($routes as $key => $value) { if (isset($value['uses']) and $value['uses'] === $action) { return static::$uses[$action] = array($key => $value); } } } }