for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Jarvis\Skill\Routing;
/**
* @author Eric Chau <[email protected]>
*/
class Route
{
* @var string|null
private $name;
* @var array
private $method = ['get'];
* @var string
private $pattern = '/';
* @var mixed
private $handler;
* @var Router
private $router;
public function __construct(Router $router, string $name = null)
$this->name = $name;
$this->router = $router;
}
public function name(): ?string
return $this->name;
public function method(): array
return $this->method;
public function setMethod($method): Route
$this->method = array_map('strtolower', (array) $method);
return $this;
public function pattern(): string
return $this->pattern;
public function setPattern(string $pattern): Route
$this->pattern = $pattern;
public function handler()
return $this->handler;
public function setHandler($handler): Route
$this->handler = $handler;
public function end(): Router
$this->router->addRoute($this);
return $this->router;