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

helpers.php ➔ str_studly()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
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