public function __call($name, array $arguments) { $route = $arguments[0]; if (!$route instanceof RouteInterface) { if (strpos($route, ':') !== false) { $route = new PlaceholderRoute(...$arguments); } else { $route = new LiteralRoute(...$arguments); } } $route->allows([strtoupper($name)]); return $this->addRoute($route); }
public function __invoke(array $data) { $path = $data['path']; $name = !empty($data['name']) ? $data['name'] : null; $i18n = !empty($data['i18n']) ? $data['i18n'] : null; $values = !empty($data['values']) ? $data['values'] : []; $allows = !empty($data['allows']) ? $data['allows'] : []; $allows = is_array($allows) ? $allows : [$allows]; $route = new LiteralRoute($path); if ($name) { $route->setName($name); } $route->values($values)->allows($allows); if ($i18n) { $route = $route->i18n($i18n); } return $route; }