1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
use Sfneal\Helpers\Laravel\LaravelHelpers; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Return the alphabet in array form. |
7
|
|
|
* |
8
|
|
|
* @return array |
9
|
|
|
*/ |
10
|
|
|
function alphabet(): array |
11
|
|
|
{ |
12
|
|
|
return LaravelHelpers::alphabet(); |
13
|
|
|
} |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* Return the index of a letter in the alphabet. |
17
|
|
|
* |
18
|
|
|
* @param int $index |
19
|
|
|
* @return string |
20
|
|
|
*/ |
21
|
|
|
function alphabetIndex(int $index): string |
22
|
|
|
{ |
23
|
|
|
return LaravelHelpers::alphabetIndex($index); |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Retrieve a class's short name (without namespace). |
28
|
|
|
* |
29
|
|
|
* @param $class |
30
|
|
|
* @param bool $short Full name or short name |
31
|
|
|
* @param string|null $default |
32
|
|
|
* @return string |
33
|
|
|
*/ |
34
|
|
|
function getClassName($class, $short = false, $default = null): string |
35
|
|
|
{ |
36
|
|
|
return LaravelHelpers::getClassName($class, $short, $default); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Determine if the Application is running in a 'production' environment. |
41
|
|
|
* |
42
|
|
|
* @return bool |
43
|
|
|
*/ |
44
|
|
|
function isProductionEnvironment(): bool |
45
|
|
|
{ |
46
|
|
|
return LaravelHelpers::isProductionEnvironment(); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Determine if the Application is running in a 'development' environment. |
51
|
|
|
* |
52
|
|
|
* @return bool |
53
|
|
|
*/ |
54
|
|
|
function isDevelopmentEnvironment(): bool |
55
|
|
|
{ |
56
|
|
|
return LaravelHelpers::isDevelopmentEnvironment(); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Serialize and simple hash a value to create a unique ID. |
61
|
|
|
* |
62
|
|
|
* @param $value |
63
|
|
|
* @return int |
64
|
|
|
*/ |
65
|
|
|
function serializeHash($value): int |
66
|
|
|
{ |
67
|
|
|
return LaravelHelpers::serializeHash($value); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* Retrieve a random float between two values with a specified number of decimals. |
72
|
|
|
* |
73
|
|
|
* @param $min |
74
|
|
|
* @param $max |
75
|
|
|
* @param int $decimals |
76
|
|
|
* @return float |
77
|
|
|
*/ |
78
|
|
|
function randomFloat(int $min, int $max, int $decimals = 2): float |
79
|
|
|
{ |
80
|
|
|
return LaravelHelpers::randomFloat($min, $max, $decimals); |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* Determine if a string is a Binary String |
85
|
|
|
* |
86
|
|
|
* @param string $string |
87
|
|
|
* @return bool |
88
|
|
|
*/ |
89
|
|
|
function isBinary(string $string): bool |
90
|
|
|
{ |
91
|
|
|
return LaravelHelpers::isBinary($string); |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* Determine if a string is serialized. |
96
|
|
|
* |
97
|
|
|
* https://stackoverflow.com/questions/1369936/check-to-see-if-a-string-is-serialized/4994628 |
98
|
|
|
* |
99
|
|
|
* @param $data |
100
|
|
|
* @return bool |
101
|
|
|
*/ |
102
|
|
|
function isSerialized($data): bool |
103
|
|
|
{ |
104
|
|
|
return LaravelHelpers::isSerialized($data); |
105
|
|
|
} |
106
|
|
|
|