Completed
Branch stable (378b09)
by Nuno
04:07 queued 02:17
created

helpers.php ➔ storage_path()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 2
nc 2
nop 1
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('app')) {
6
    /**
7
     * Get the available container instance.
8
     *
9
     * @param  string $make
10
     *
11
     * @return mixed|\Laravel\Lumen\Application
12
     */
13
    function app($make = null)
14
    {
15
        if (is_null($make)) {
16
            return Container::getInstance();
17
        }
18
19
        return Container::getInstance()
20
            ->make($make);
21
    }
22
}
23
24
if (! function_exists('config')) {
25
    /**
26
     * Get / set the specified configuration value.
27
     *
28
     * If an array is passed as the key, we will assume you want to set an array of values.
29
     *
30
     * @param  array|string $key
31
     * @param  mixed $default
32
     *
33
     * @return mixed
34
     */
35
    function config($key = null, $default = null)
36
    {
37
        if (is_null($key)) {
38
            return app('config');
39
        }
40
41
        if (is_array($key)) {
42
            return app('config')->set($key);
43
        }
44
45
        return app('config')->get($key, $default);
46
    }
47
}
48
49
if (! function_exists('event')) {
50
    /**
51
     * Fire an event and call the listeners.
52
     *
53
     * @param  object|string $event
54
     * @param  mixed $payload
55
     * @param  bool $halt
56
     *
57
     * @return array|null
58
     */
59
    function event($event, $payload = [], $halt = false)
60
    {
61
        return app('events')->fire($event, $payload, $halt);
62
    }
63
}
64
65
if (! function_exists('base_path')) {
66
    /**
67
     * Get the path to the base of the install.
68
     *
69
     * @param  string $path
70
     *
71
     * @return string
72
     */
73
    function base_path($path = '')
74
    {
75
        return app()->basePath().($path ? DIRECTORY_SEPARATOR.$path : $path);
76
    }
77
}
78
79
if (! function_exists('config_path')) {
80
    /**
81
     * Get the configuration path.
82
     *
83
     * @param  string $path
84
     *
85
     * @return string
86
     */
87
    function config_path($path = '')
88
    {
89
        return app()->basePath().DIRECTORY_SEPARATOR.'config'.($path ? DIRECTORY_SEPARATOR.$path : $path);
90
    }
91
}
92
93
if (! function_exists('storage_path')) {
94
    /**
95
     * Get the path to the storage folder.
96
     *
97
     * @param  string $path
98
     *
99
     * @return string
100
     */
101
    function storage_path($path = '')
102
    {
103
        return app('path.storage').($path ? DIRECTORY_SEPARATOR.$path : $path);
104
    }
105
}
106
107