-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelpers.php
51 lines (40 loc) · 1.18 KB
/
helpers.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
function array_merge_recursive_distinct(array $array1, array $array2) {
$merged = $array1;
foreach ($array2 as $key => $value) {
if (is_array($value) && isset($merged[$key]) && is_array($merged[$key])) {
$merged[$key] = array_merge_recursive_distinct($merged[$key], $value);
} else {
$merged[$key] = $value;
}
}
return $merged;
}
function object_to_array($d) {
if (is_object($d)) {
$d = get_object_vars($d);
}
if (is_array($d)) {
return array_map(__FUNCTION__, $d);
} else {
return $d;
}
}
function base_path($file = '') {
return __DIR__ . DIRECTORY_SEPARATOR . $file;
}
function output_path($file = '') {
return base_path('output' . DIRECTORY_SEPARATOR . $file);
}
function settings_path($file = '') {
return base_path('settings' . DIRECTORY_SEPARATOR . $file);
}
function config_path($file = '') {
return base_path('config' . DIRECTORY_SEPARATOR . $file);
}
function resource_path($file = '') {
return base_path('resources' . DIRECTORY_SEPARATOR . $file);
}
function font_path($file = '') {
return resource_path('fonts' . DIRECTORY_SEPARATOR . $file);
}