RouteUrlGenerator::addQueryString()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 13
rs 9.8333
cc 3
nc 4
nop 2
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