for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php declare(strict_types = 1);
namespace Venta\Routing;
use Psr\Http\Message\ServerRequestInterface;
use Venta\Contracts\Routing\Route as RouteContract;
use Venta\Contracts\Routing\RouteCollection as RouteCollectionContract;
use Venta\Contracts\Routing\RouteGroup as RouteGroupContract;
/**
* Class RequestRouteCollection
*
* @package Venta\Routing
*/
final class RequestRouteCollection implements RouteCollectionContract
{
* @var ServerRequestInterface
private $request;
* @var RouteCollectionContract
private $routes;
* RequestRouteCollection constructor.
* @param ServerRequestInterface $request
* @param RouteCollectionContract $routes
public function __construct(ServerRequestInterface $request, RouteCollectionContract $routes)
$this->request = $request;
$this->routes = $routes;
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
$a = "a"; $ab = "ab"; $abc = "abc";
will produce issues in the first and second line, while this second example
will produce no issues.
}
* @inheritDoc
public function addGroup(RouteGroupContract $group): RouteCollectionContract
$this->routes->addGroup($group);
return $this;
public function addRoute(RouteContract $route): RouteCollectionContract
$this->routes->addRoute($route);
public function getRoutes(): array
$routes = [];
foreach ($this->routes->getRoutes() as $route) {
if ((!$route->getHost() || $route->getHost() === $this->request->getUri()->getHost())
&& (!$route->getScheme() || $route->getScheme() === $this->request->getUri()->getScheme())
) {
$routes[] = $route;
return $routes;
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
will produce issues in the first and second line, while this second example
will produce no issues.