RouteUrlGenerator   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 24
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A addQueryString() 0 13 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cortex\Foundation\Overrides\Illuminate\Routing;
6
7
use Illuminate\Routing\RouteUrlGenerator as BaseRouteUrlGenerator;
8
9
class RouteUrlGenerator extends BaseRouteUrlGenerator
10
{
11
    /**
12
     * Add a query string to the URI.
13
     *
14
     * @param string $uri
15
     * @param array  $parameters
16
     *
17
     * @return mixed|string
0 ignored issues
show
Documentation introduced by
Consider making the return type a bit more specific; maybe use string.

This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.

Loading history...
18
     */
19
    protected function addQueryString($uri, array $parameters)
20
    {
21
        // If the URI has a fragment we will move it to the end of this URI since it will
22
        // need to come after any query string that may be added to the URL else it is
23
        // not going to be available. We will remove it then append it back on here.
24
        if (! is_null($fragment = parse_url($uri, PHP_URL_FRAGMENT))) {
25
            $uri = preg_replace('/#.*/', '', $uri);
26
        }
27
28
        $uri .= '/'.$this->getRouteQueryString($parameters);
29
30
        return is_null($fragment) ? $uri : $uri."#{$fragment}";
31
    }
32
}
33