4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Routing\Loader\Configurator\Traits;
14 use Symfony\Component\Routing\Route;
15 use Symfony\Component\Routing\RouteCollection;
20 * @var RouteCollection|Route
29 final public function defaults(array $defaults)
31 $this->route->addDefaults($defaults);
41 final public function requirements(array $requirements)
43 $this->route->addRequirements($requirements);
53 final public function options(array $options)
55 $this->route->addOptions($options);
63 * @param string $condition
67 final public function condition($condition)
69 $this->route->setCondition($condition);
75 * Sets the pattern for the host.
77 * @param string $pattern
81 final public function host($pattern)
83 $this->route->setHost($pattern);
89 * Sets the schemes (e.g. 'https') this route is restricted to.
90 * So an empty array means that any scheme is allowed.
92 * @param string[] $schemes
96 final public function schemes(array $schemes)
98 $this->route->setSchemes($schemes);
104 * Sets the HTTP methods (e.g. 'POST') this route is restricted to.
105 * So an empty array means that any method is allowed.
107 * @param string[] $methods
111 final public function methods(array $methods)
113 $this->route->setMethods($methods);
119 * Adds the "_controller" entry to defaults.
121 * @param callable|string $controller a callable or parseable pseudo-callable
125 final public function controller($controller)
127 $this->route->addDefaults(array('_controller' => $controller));