Completed
Pull Request — master (#16)
by ARCANEDEV
09:57
created

helpers.php ➔ request()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 2
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
if ( ! function_exists('laravel_version')) {
4
    /**
5
     * Get laravel version or check if the same version
6
     *
7
     * @param  string|null $version
8
     *
9
     * @return string
10
     */
11
    function laravel_version($version = null) {
12
        $app = app();
13
        $appVersion = $app::VERSION;
14
        if (is_null($version)) {
15
            return $appVersion;
16
        }
17
        return substr($appVersion, 0, strlen($version)) === $version;
18
    }
19
}
20
21
if ( ! function_exists('route_is')) {
22
    /**
23
     * Check if route(s) is the current route.
24
     *
25
     * @param  array|string  $routes
26
     *
27
     * @return bool
28
     */
29
    function route_is($routes)
30
    {
31
        if ( ! is_array($routes)) {
32
            $routes = [$routes];
33
        }
34
35
        /** @var Illuminate\Routing\Router $router */
36
        $router = app('router');
37
38
        return call_user_func_array([$router, 'is'], $routes);
39
    }
40
}
41