mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-17 00:37:52 +00:00
[CLEANUP] Added qualifier import.
This commit is contained in:
@@ -51,7 +51,7 @@ abstract class Route implements IRoute
|
||||
*/
|
||||
public function renderRoute(Request $request, Router $router): ?string
|
||||
{
|
||||
$router->debug('Starting rendering route "%s"', \get_class($this));
|
||||
$router->debug('Starting rendering route "%s"', get_class($this));
|
||||
|
||||
$callback = $this->getCallback();
|
||||
|
||||
@@ -73,7 +73,7 @@ abstract class Route implements IRoute
|
||||
}
|
||||
|
||||
/* Render callback function */
|
||||
if (\is_callable($callback) === true) {
|
||||
if (is_callable($callback) === true) {
|
||||
$router->debug('Executing callback');
|
||||
|
||||
/* When the callback is a function */
|
||||
@@ -99,7 +99,7 @@ abstract class Route implements IRoute
|
||||
|
||||
$router->debug('Executing callback');
|
||||
|
||||
return \call_user_func_array([$class, $method], $parameters);
|
||||
return call_user_func_array([$class, $method], $parameters);
|
||||
}
|
||||
|
||||
protected function parseParameters($route, $url, $parameterRegex = null): ?array
|
||||
@@ -126,7 +126,7 @@ abstract class Route implements IRoute
|
||||
|
||||
$regex = '';
|
||||
|
||||
if ($key < \count($parameters[1])) {
|
||||
if ($key < count($parameters[1])) {
|
||||
|
||||
$name = $parameters[1][$key];
|
||||
|
||||
@@ -157,7 +157,7 @@ abstract class Route implements IRoute
|
||||
/* Only take matched parameters with name */
|
||||
foreach ((array)$parameters[1] as $name) {
|
||||
|
||||
// Skip parent parameters
|
||||
// Ignore parent parameters
|
||||
if(isset($groupParameters[$name]) === true) {
|
||||
continue;
|
||||
}
|
||||
@@ -180,7 +180,7 @@ abstract class Route implements IRoute
|
||||
*/
|
||||
public function getIdentifier(): string
|
||||
{
|
||||
if (\is_string($this->callback) === true && strpos($this->callback, '@') !== false) {
|
||||
if (is_string($this->callback) === true && strpos($this->callback, '@') !== false) {
|
||||
return $this->callback;
|
||||
}
|
||||
|
||||
@@ -239,7 +239,6 @@ abstract class Route implements IRoute
|
||||
$this->group = $group;
|
||||
|
||||
/* Add/merge parent settings with child */
|
||||
|
||||
return $this->setSettings($group->toArray(), true);
|
||||
}
|
||||
|
||||
@@ -279,11 +278,11 @@ abstract class Route implements IRoute
|
||||
|
||||
public function getMethod(): ?string
|
||||
{
|
||||
if (\is_array($this->callback) === true && \count($this->callback) > 1) {
|
||||
if (is_array($this->callback) === true && count($this->callback) > 1) {
|
||||
return $this->callback[1];
|
||||
}
|
||||
|
||||
if (\is_string($this->callback) === true && strpos($this->callback, '@') !== false) {
|
||||
if (is_string($this->callback) === true && strpos($this->callback, '@') !== false) {
|
||||
$tmp = explode('@', $this->callback);
|
||||
|
||||
return $tmp[1];
|
||||
@@ -294,11 +293,11 @@ abstract class Route implements IRoute
|
||||
|
||||
public function getClass(): ?string
|
||||
{
|
||||
if (\is_array($this->callback) === true && \count($this->callback) > 0) {
|
||||
if (is_array($this->callback) === true && count($this->callback) > 0) {
|
||||
return $this->callback[0];
|
||||
}
|
||||
|
||||
if (\is_string($this->callback) === true && strpos($this->callback, '@') !== false) {
|
||||
if (is_string($this->callback) === true && strpos($this->callback, '@') !== false) {
|
||||
$tmp = explode('@', $this->callback);
|
||||
|
||||
return $tmp[0];
|
||||
@@ -369,15 +368,15 @@ abstract class Route implements IRoute
|
||||
$values['namespace'] = $this->namespace;
|
||||
}
|
||||
|
||||
if (\count($this->requestMethods) !== 0) {
|
||||
if (count($this->requestMethods) !== 0) {
|
||||
$values['method'] = $this->requestMethods;
|
||||
}
|
||||
|
||||
if (\count($this->where) !== 0) {
|
||||
if (count($this->where) !== 0) {
|
||||
$values['where'] = $this->where;
|
||||
}
|
||||
|
||||
if (\count($this->middlewares) !== 0) {
|
||||
if (count($this->middlewares) !== 0) {
|
||||
$values['middleware'] = $this->middlewares;
|
||||
}
|
||||
|
||||
@@ -471,7 +470,7 @@ abstract class Route implements IRoute
|
||||
/* Sort the parameters after the user-defined param order, if any */
|
||||
$parameters = [];
|
||||
|
||||
if (\count($this->originalParameters) !== 0) {
|
||||
if (count($this->originalParameters) !== 0) {
|
||||
$parameters = $this->originalParameters;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user