1
|
|
|
<?php |
2
|
|
|
use Illuminate\Container\Container; |
3
|
|
|
|
4
|
|
|
if (! function_exists('config')) { |
5
|
|
|
/** |
6
|
|
|
* Get / set the specified configuration value. |
7
|
|
|
* |
8
|
|
|
* If an array is passed as the key, we will assume you want to set an array of values. |
9
|
|
|
* |
10
|
|
|
* @param array|string $key |
11
|
|
|
* @param mixed $default |
12
|
|
|
* @return mixed |
13
|
|
|
*/ |
14
|
|
|
function config($key = null, $default = null) |
15
|
|
|
{ |
16
|
19 |
|
if (is_null($key)) { |
17
|
1 |
|
return app('config'); |
18
|
|
|
} |
19
|
19 |
|
if (is_array($key)) { |
20
|
1 |
|
return app('config')->set($key); |
|
|
|
|
21
|
|
|
} |
22
|
18 |
|
return app('config')->get($key, $default); |
|
|
|
|
23
|
|
|
} |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
if (! function_exists('app')) { |
27
|
|
|
/** |
28
|
|
|
* Get the available container instance. |
29
|
|
|
* |
30
|
|
|
* @param string $abstract |
31
|
|
|
* @param array $parameters |
32
|
|
|
* @return Illuminate\Container\Container |
33
|
|
|
*/ |
34
|
|
|
function app($abstract = null, array $parameters = []) |
35
|
|
|
{ |
36
|
23 |
|
if (is_null($abstract)) { |
37
|
23 |
|
return Container::getInstance(); |
38
|
|
|
} |
39
|
19 |
|
return empty($parameters) |
40
|
19 |
|
? Container::getInstance()->make($abstract) |
41
|
19 |
|
: Container::getInstance()->makeWith($abstract, $parameters); |
42
|
|
|
} |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
if (! function_exists('inJson')) { |
46
|
|
|
/** |
47
|
|
|
* Sugar json_encode |
48
|
|
|
* |
49
|
|
|
* @param array $values |
50
|
|
|
* @return string |
51
|
|
|
*/ |
52
|
|
|
function inJson(array $values = []) : string |
53
|
|
|
{ |
54
|
7 |
|
return json_encode($values); |
55
|
|
|
} |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
if (! function_exists('fromJson')) { |
59
|
|
|
/** |
60
|
|
|
* Sugar json_encode |
61
|
|
|
* |
62
|
|
|
* @param string $json |
63
|
|
|
* @param bool $assoc |
64
|
|
|
* @param int $depth |
65
|
|
|
* @return mixed |
66
|
|
|
*/ |
67
|
|
|
function fromJson(string $json = '', bool $assoc = false, int $depth = 512) |
68
|
|
|
{ |
69
|
9 |
|
return json_decode($json, $assoc, $depth); |
70
|
|
|
} |
71
|
|
|
} |
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.