Passed
Branch 2.0.0 (c5bb78)
by Chubarov
09:06
created

helpers.php ➔ JsonHandler()   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 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
use Illuminate\Container\Container;
4
5
if (! function_exists('config')) {
6
    /**
7
     * Get / set the specified configuration value.
8
     *
9
     * If an array is passed as the key, we will assume you want to set an array of values.
10
     *
11
     * @param  array|string  $key
12
     * @param  mixed  $default
13
     * @return mixed
14
     */
15
    function config($key = null, $default = null)
16
    {
17
        if (is_null($key)) {
18
            return app('config');
19
        }
20
21
        if (is_array($key)) {
22
            return app('config')->set($key);
0 ignored issues
show
Bug introduced by
The method set() does not seem to exist on object<Illuminate\Container\Container>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
23
        }
24
25
        return app('config')->get($key, $default);
0 ignored issues
show
Bug introduced by
The method get() does not seem to exist on object<Illuminate\Container\Container>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
26
    }
27
}
28
29
if (! function_exists('app')) {
30
    /**
31
     * Get the available container instance.
32
     *
33
     * @param  string  $abstract
34
     * @param  array   $parameters
35
     * @return Illuminate\Container\Container
36
     */
37
    function app($abstract = null, array $parameters = [])
38
    {
39
        if (is_null($abstract)) {
40
            return Container::getInstance();
41
        }
42
43
        return empty($parameters)
44
            ? Container::getInstance()->make($abstract)
45
            : Container::getInstance()->makeWith($abstract, $parameters);
46
    }
47
}