for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace PTS\Routing;
use Psr\Http\Message\RequestInterface;
use PTS\Routing\Traits\MiddlewaresTrait;
class Route
{
use MiddlewaresTrait;
/** @var string */
protected $path;
/** @var callable */
protected $endPoint;
/** @var array */
protected $methods = [];
protected $restrictions = [];
protected $matches = [];
/**
* @param string $path
* @param callable $handler
*/
public function __construct(string $path, callable $handler)
$this->path = $path;
$this->endPoint = new EndPoint($handler);
}
* @param RequestInterface $request
* @return mixed
public function __invoke(RequestInterface $request)
if (count($this->getMiddlewares()) === 0) {
return $this->endPoint();
endPoint()
PTS\Routing\Route
getEndPoint()
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.
return $this->invoke($request);
* @return EndPoint
public function getEndPoint() : EndPoint
return $this->endPoint;
* @param array $restrictions
* @return $this
public function setRestrictions(array $restrictions)
$this->restrictions = $restrictions;
return $this;
* @return array
public function getRestrictions() : array
return $this->restrictions;
* @return string
public function getPath() : string
return $this->path;
* @param array $values
public function setMatches(array $values = [])
$this->matches = $values;
public function getMatches() : array
return $this->matches;
public function getMethods() : array
return $this->methods;
* @param array $methods
public function setMethods(array $methods)
$this->methods = $methods;
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.