Completed
Push — master ( a76360...3b8ebd )
by Manuel
04:51 queued 03:32
created

RouteGenerator::generate()   A

Complexity

Conditions 5
Paths 16

Size

Total Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 16
rs 9.4222
c 0
b 0
f 0
cc 5
nc 16
nop 1
1
<?php
2
3
namespace Oscer\Cms\Backend\Routing;
4
5
use Tightenco\Ziggy\BladeRouteGenerator;
6
7
class RouteGenerator extends BladeRouteGenerator
8
{
9
    public function generate($group = false)
10
    {
11
        $url = url('/');
12
        $parsedUrl = parse_url($url);
13
14
        return [
15
            'namedRoutes' => $this->getRoutePayload($group),
16
            'baseUrl' => $url.'/',
17
            'baseProtocol' => array_key_exists('scheme', $parsedUrl) ? $parsedUrl['scheme'] : 'http',
18
            'baseDomain' => array_key_exists('host', $parsedUrl) ? $parsedUrl['host'] : '',
19
            'basePort' => array_key_exists('port', $parsedUrl) ? $parsedUrl['port'] : 'false',
20
            'defaultParameters' => method_exists(app('url'), 'getDefaultParameters')
21
                ? app('url')->getDefaultParameters()
22
                : [],
23
        ];
24
    }
25
}
26