Passed
Push — 0.7.0 ( 418a4b...b5eec6 )
by Alexander
02:57
created

env()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 2
b 0
f 0
nc 1
nop 2
dl 0
loc 3
rs 10
1
<?php 
2
3
/**
4
 * Lenevor Framework
5
 *
6
 * LICENSE
7
 *
8
 * This source file is subject to the new BSD license that is bundled
9
 * with this package in the file license.md.
10
 * It is also available through the world-wide-web at this URL:
11
 * https://lenevor.com/license
12
 * If you did not receive a copy of the license and are unable to
13
 * obtain it through the world-wide-web, please send an email
14
 * to [email protected] so we can send you a copy immediately.
15
 *
16
 * @package     Lenevor
17
 * @subpackage  Base
18
 * @link        https://lenevor.com
19
 * @copyright   Copyright (c) 2019 - 2021 Alexander Campo <[email protected]>
20
 * @license     https://opensource.org/licenses/BSD-3-Clause New BSD license or see https://lenevor.com/license or see /license.md
21
 * @since       0.7.3
22
 */
23
24
use Syscodes\Version;
25
use Syscodes\Support\Str;
26
use Syscodes\Support\Environment;
27
28
if ( ! function_exists('camel_case'))
29
{
30
    /**
31
     * Convert the string with spaces or underscore in camelcase notation.
32
     *
33
     * @param  string  $string  
34
     *
35
     * @return string
36
     * 
37
     * @uses   Str::camelcase
38
     */
39
    function camel_case($string)
40
    {
41
        return Str::camelcase($string);
42
    }
43
}
44
45
if ( ! function_exists('classBasename')) 
46
{
47
    /**
48
     * Get the class "basename" of the given object / class.
49
     *
50
     * @param  string|object  $class
51
     * 
52
     * @return string
53
     */
54
    function classBasename($class)
55
    {
56
        $class = is_object($class) ? get_class($class) : $class;
57
58
        return basename(str_replace('\\', '/', $class));
59
    }
60
}
61
62
if ( ! function_exists('dd')) 
63
{
64
    /**
65
     * Generate test of variables.
66
     * 
67
     * @param  mixed
68
     * 
69
     * @return void
70
     */
71
    function dd()
72
    {
73
        array_map(function ($x)
74
        {
75
            var_dump($x);
0 ignored issues
show
Security Debugging Code introduced by
var_dump($x) looks like debug code. Are you sure you do not want to remove it?
Loading history...
76
        },  func_get_args());
77
            
78
        die(1);
0 ignored issues
show
Best Practice introduced by
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
79
    }
80
}
81
82
if ( ! function_exists('env')) 
83
{
84
    /**
85
     * Gets the value of an environment variable.
86
     * 
87
     * @param  string  $key
88
     * @param  mixed  $default  (null by default)
89
     * 
90
     * @return mixed
91
     */
92
    function env($key, $default = null)
93
    {
94
        return Environment::get($key, $default);
95
    }
96
}
97
98
if ( ! function_exists('str_dash'))
99
{
100
    /**
101
     * Replace in the chain the spaces by dashes.
102
     *
103
     * @param  string  $string  
104
     *
105
     * @return string
106
     *
107
     * @uses   Str::dash
108
     */
109
    function str_dash($string)
110
    {
111
        return Str::dash($string);
112
    }
113
}
114
115
if ( ! function_exists('str_humanize'))
116
{
117
    /**
118
     * Replace in an string the underscore or dashed by spaces.
119
     *
120
     * @param  string  $string
121
     *
122
     * @return string
123
     *
124
     * @uses   Str::humanize
125
     */
126
    function str_humanize($string)
127
    {
128
        return Str::humanize($string);
129
    }
130
}
131
132
if ( ! function_exists('str_smallcase'))
133
{
134
    /**
135
     * Converts the CamelCase string into smallcase notation.
136
     *
137
     * @param  string  $string
138
     *
139
     * @return string
140
     *
141
     * @uses   Str::smallcase
142
     */
143
    function str_smallcase($string)
144
    {
145
        return Str::smallcase($string);
146
    }
147
}
148
149
if ( ! function_exists('str_underscore'))
150
{
151
  /**
152
     * Replace in the string the spaces by low dashes.
153
     *
154
     * @param  string  $string
155
     *
156
     * @return string
157
     *
158
     * @uses   Str::underscore
159
     */
160
    function str_underscore($string)
161
    {
162
        return Str::underscore($string);
163
    }
164
}
165
166
if ( ! function_exists('studly_caps'))
167
{
168
  /**
169
     * Convert the string with spaces or underscore in StudlyCaps. 
170
     *
171
     * @param  string  $string
172
     *
173
     * @return string
174
     *
175
     * @uses   Str::studlycaps
176
     */
177
    function studly_caps($string)
178
    {
179
        return Str::studlycaps($string);
180
    }
181
}
182
183
if ( ! function_exists('version'))
184
{
185
    /**
186
     * Return number version of the Lenevor.
187
     * 
188
     * @return string
189
     */
190
    function version()
191
    {
192
        return Version::RELEASE.'-'.Version::STATUS;
193
    }
194
}
195
196
if ( ! function_exists('winOS'))
197
{
198
    /**
199
     * Determine whether the current envrionment is Windows based.
200
     *
201
     * @return bool
202
     */
203
    function winOS()
204
    {
205
        return strtolower(substr(PHP_OS, 0, 3)) === 'win';
206
    }
207
}