for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace MinasRouter\Helpers;
use MinasRouter\Router\Route;
class Functions
{
/**
* Method responsible for returning the
* active RouteCollection instance.
*
* @return null|\MinasRouter\Router\RouteCollection
*/
protected function collection()
return Route::$collection;
}
* Method responsible for returning a route.
* @param string $name
* @return null|\MinasRouter\Router\RouteManager
public function get(String $routerName)
return $this->collection()->getByName($routerName);
public function getStructuredRoute(String $routerName, $params)
$params
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function getStructuredRoute(String $routerName, /** @scrutinizer ignore-unused */ $params)
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
$params = (array) func_get_arg(1);
if(!$router = $this->get($routerName)) {
return null;
$originalRoute = $router->getOriginalRoute();
preg_match_all("/{\w+\??}/", $originalRoute, $matches);
if(empty($matches[0])) {
return $originalRoute;
if(count($matches[0]) != count($params)) {
foreach($matches[0] as $index => $match) {
$paramForReplace = isset($params[$index]) ? $params[$index] : 'undefined';
$originalRoute = str_replace($match, $paramForReplace, $originalRoute);
* current route.
public function current()
return $this->collection()->getCurrentRoute();
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.