Invalid route definition with invalid attribute parameter.

@param Input $definition
@param string $parameter
@return InvalidRoute
12255
private static function emptyAttributeParameter(Input $definition, string $parameter): self
    {
        $pointer = self::createPointerString($definition->getInput(), $definition->getIndex());

        return new self("The attribute $parameter is missing:\n$pointer");
    }
801477
public function redirectRoute($route, $parameters = [], $absolute = true)
    {
        $this->url = route($route, $parameters, $absolute);

        return $this;
    }
167021
private function parseAttribute(Input $definition, TypeCollection $types, array $attributes): AttributePath
    {
        $definition->expect("{");

        $name = $this->parseAttributeName($definition);
        $type = $this->parseAttributeType($definition) ?? "";

        $definition->expect("}");

        if (in_array($name, $attributes)) {
            throw InvalidRoute::ambiguousAttribute($definition, $name);
        }

        if (!$types->hasNamed($type)) {
            throw InvalidRoute::unknownAttributeType($definition, $name, $type);
        }

        $type = $types->getNamed($type);

        $attributes[] = $name;

        $next = $this->parseRoute($definition, $types, $attributes);

        return new AttributePath($name, $type, $next);
    }
602649
private function getCompilerPass(Definition $definition)
    {
        $driver = $this->getResourceDriver($definition);

        if ($driver === null) {
            return;
        }

        $class = $this->getCompilerPassClass($driver);
        $method = $this->getCompilerPassMethod($this->getResourceDriverMappingFormat($definition));
        $path = $this->getResourceDriverMappingPath($definition);
        $model = $this->getResourceModel($definition);

        return $class::$method([$path => ClassUtils::getRealNamespace($model)], []);
    }
516620
public static function route( $name, $parameters = [], $absolute = true )
	{
		return static::__do( __FUNCTION__, args_with_keys( func_get_args(), __CLASS__, __FUNCTION__ ) );
	}
864199
protected function toRoute($route, $parameters, $absolute)
    {
        $parameters = $this->formatParameters($parameters);

        $domain = $this->getRouteDomain($route, $parameters);

        // Verificar se ainda tem parametros par atraduzir
        $params_orign = $parameters;
        $parameters = [];
        preg_match_all('%\\{(.*?)\\}%', $route->uri(), $params, PREG_PATTERN_ORDER);
        for ($i = 0; $i < count($params[0]); $i++) {
            $key = str_replace('?', '', $params[1][$i]);
            $val = $this->getParameterContext($key);
            if (array_key_exists($key, $params_orign)) {
                $parameters[$key] = $params_orign[$key];
            } elseif (! is_null($val)) {
                $parameters[$key] = $val;
            }
        }

        $uri = $this->addQueryString($this->trimUrl(
            $root = $this->replaceRoot($route, $domain, $parameters),
            $this->replaceRouteParameters($route->uri(), $parameters)
        ), $parameters);

        // Se ainda tiver parametros gerar erro
        if (preg_match('/\{.*?\}/', $uri)) {
            throw UrlGenerationException::forMissingParameters($route);
        }

        $uri = strtr(rawurlencode($uri), $this->dontEncode);

        return $absolute ? $uri : '/' . ltrim(str_replace($root, '', $uri), '/');
    }
807036
public function validate(Config\Interfaces\ItemRouter $RouteItem, Interfaces\Request $Request)
    {
        $method = $RouteItem->getMethod();
        if ($method !== null && strcasecmp($method, $Request->getMethod()) !== 0) {
            throw new Exception\RequestValidator('Invalid request method: "%s", expected: "%s" for url: "%s"', [$Request->getMethod(), $method, $RouteItem->getName()]);
        }

        $this->errors = null;

        $parsed_query_parameters = $this->validateQuery($RouteItem, $Request->getPath(), $Request->getQueryCollection()->toArray());
        $this->validateRoute(
            $RouteItem->getName(),
            (array) $RouteItem->getQueryRegex(),
            $parsed_query_parameters,
            true //so 404 can be thrown
        );

        $parsed_get_parameters = $this->validateGet($RouteItem, $Request->getGetCollection()->toArray());
        $this->validateRoute(
            $RouteItem->getName(),
            (array) $RouteItem->getGetRegex(),
            $parsed_get_parameters,
            false
        );

        $parsed_post_parameters = $this->validatePost($RouteItem, $Request->getPostCollection()->toArray());
        $this->validateRoute(
            $RouteItem->getName(),
            (array) $RouteItem->getPostRegex(),
            $parsed_post_parameters,
            false
        );

        return [$parsed_query_parameters, $parsed_get_parameters, $parsed_post_parameters];
    }
1326180
protected function _validate($attribute, $rule, $parameters, $value)
    {
        $srcValue = $value;

        if (isset($this->_validators[$rule])) {
            /** @noinspection VariableFunctionsUsageInspection */
            $value = call_user_func_array($this->_validators[$rule], [$value, $parameters]);
        } elseif (function_exists($rule)) {
            $value = call_user_func_array($rule, array_merge([$value], $parameters));
        } else {
            throw new FilterException(['`:name` rule is not be recognized', 'name' => $rule]);
        }

        if ($value === null) {
            if (is_string($this->_messages)) {
                if (strpos($this->_messages, '.') === false) {
                    $file = '@manaphp/Http/Validator/Messages/' . $this->_messages . '.php';
                } else {
                    $file = $this->_messages;
                }

                if (!$this->filesystem->fileExists($file)) {
                    throw new FilterException(['`:file` rule message template file is not exists', 'file' => $file]);
                }

                /** @noinspection PhpIncludeInspection */
                $this->_messages = require $this->alias->resolve($file);
            }

            if (isset($this->_messages[$rule])) {
                $message = [$this->_messages[$rule]];
            } else {
                $message = [$this->_defaultMessage];
            }

            $message['rule'] = $rule;
            $message['attribute'] = isset($this->_attributes[$attribute]) ? $this->_attributes[$attribute] : $attribute;
            $message['value'] = $srcValue;
            foreach ($parameters as $k => $parameter) {
                $message['parameters[' . $k . ']'] = $parameter;
            }

            throw new FilterException($message);
        }

        return $value;
    }
1313178
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $io = new SymfonyStyle($input, $output);
        $name = $input->getArgument('name');
        $helper = new DescriptorHelper($this->fileLinkFormatter);
        $routes = $this->router->getRouteCollection();

        if ($name) {
            if (!($route = $routes->get($name)) && $matchingRoutes = $this->findRouteNameContaining($name, $routes)) {
                $default = 1 === \count($matchingRoutes) ? $matchingRoutes[0] : null;
                $name = $io->choice('Select one of the matching routes', $matchingRoutes, $default);
                $route = $routes->get($name);
            }

            if (!$route) {
                throw new InvalidArgumentException(sprintf('The route "%s" does not exist.', $name));
            }

            $helper->describe($io, $route, [
                'format' => $input->getOption('format'),
                'raw_text' => $input->getOption('raw'),
                'name' => $name,
                'output' => $io,
            ]);
        } else {
            $helper->describe($io, $routes, [
                'format' => $input->getOption('format'),
                'raw_text' => $input->getOption('raw'),
                'show_controllers' => $input->getOption('show-controllers'),
                'output' => $io,
            ]);
        }
    }
694861
public function addRouteDefinition(RouteDefinition $definition): void
    {
        $name = $definition->getName();

        if (isset($this->routesByName[$name])) {
            throw new \InvalidArgumentException("Route with name '$name' already exists");
        }

        $routeId = \count($this->routeDefinitions);
        $segments = $definition->getSegments();

        $this->routeDefinitions[$routeId] = $definition->getDefinitionCache();
        $this->routesByName[$name] = $routeId;

        if ($definition->isStatic()) {
            $this->staticRoutes[implode('/', $segments)][] = $routeId;
            return;
        }

        foreach ($segments as $i => $segment) {
            $this->segmentValues[$i][$segment][$routeId] = $routeId;

            if (!isset($this->segmentCounts[$i])) {
                $this->segmentCounts[$i] = [];
            }
        }

        $this->segmentCounts[\count($segments)][$routeId] = $routeId;
    }
110335
public function validateCurrent(InputRequest $request) {
		return $this->validate($request->getInputValue(self::HTML_PREFIX.$this->name));
// 		return $this->validate(POST(self::HTML_PREFIX.$this->name));
	}
870695
public static function longAttributeType(Input $definition, int $maxLength): self
    {
        return self::longAttributeParameter($definition, $maxLength, "type");
    }
641135
public function route(
        string $method,
        string $definition,
        RequestHandlerInterface $handler,
        ?string $name = null,
        $data = null
    ): Route {
        $route = $this->factory->create($method, $definition, $handler, $name, $data);

        $this->routes[] = $route;

        if ($name !== null) {
            $this->named[$name] = $route;
        }

        return $route;
    }
910595
public function routeIf($condition, string $name, string $text, array $parameters = [], bool $absolute = true)
    {
        return $this->addIf($condition, Link::toRoute($name, $text, $parameters, $absolute));
    }
573955
public function validateForm(InputRequest $request, $domain=null) {
		if( !$this->validateCurrent($request) ) {
			throw new UserException(self::ERROR_INVALIDTOKEN, $domain);
		}
	}
882451
public function newInputFilter(array $definition = array())
    {
        if (!empty($definition)) {
            $this->_definition = $definition;
        }
        $this->_inputFilter = new InputFilter();

        foreach ($this->_definition as $key => $item) {
            if (!is_string($key)) {
                $key = $item['name'];
            }
            $this->_addInput($item, $key);
        }

        return $this->_inputFilter;
    }
1204788
protected function getRoutedParameter($parameter, $default = null)
    {
        $output = $default;

        $parameters = $this->route->getParameters();

        if (!empty($parameters->$parameter))
        {
            $output = $parameters->$parameter;
        }

        $validatedData = $this->route->getValidatedData();

        if (!empty($validatedData->$parameter))
        {
            $output = $validatedData->$parameter;
        }

        return $output;
    }