Codexshaper /
laravel-database-manager
| 1 | <?php |
||
| 2 | |||
| 3 | if (! function_exists('dbm_asset')) { |
||
| 4 | function dbm_asset($path, $secure = null) |
||
|
0 ignored issues
–
show
|
|||
| 5 | { |
||
| 6 | return url(config('dbm.prefix').'/assets?path='.urlencode($path)); |
||
| 7 | } |
||
| 8 | } |
||
| 9 | |||
| 10 | if (! function_exists('dbm_driver')) { |
||
| 11 | function dbm_driver() |
||
| 12 | { |
||
| 13 | return config('dbm.driver', 'mysql'); |
||
| 14 | } |
||
| 15 | } |
||
| 16 | |||
| 17 | if (! function_exists('dbm_prefix')) { |
||
| 18 | function dbm_prefix() |
||
| 19 | { |
||
| 20 | return (config('dbm.prefix') != '') ? config('dbm.prefix') : ''; |
||
| 21 | } |
||
| 22 | } |
||
| 23 | |||
| 24 | if (! function_exists('dbm_base_path')) { |
||
| 25 | function dbm_base_path() |
||
| 26 | { |
||
| 27 | return rtrim(config('dbm.base_path'), '/') ?? ''; |
||
| 28 | } |
||
| 29 | } |
||
| 30 | |||
| 31 | if (! function_exists('is_json')) { |
||
| 32 | function is_json($string) |
||
| 33 | { |
||
| 34 | return is_string($string) && is_array(json_decode($string, true)) && (json_last_error() == JSON_ERROR_NONE) ? true : false; |
||
| 35 | } |
||
| 36 | } |
||
| 37 | |||
| 38 | if (! function_exists('save_json')) { |
||
| 39 | function save_json(array $arr) |
||
| 40 | { |
||
| 41 | $jsonArr = []; |
||
| 42 | $i = 1; |
||
| 43 | foreach ($arr as $key => $value) { |
||
| 44 | $jsonArr['key_'.$i++] = $value; |
||
| 45 | } |
||
| 46 | |||
| 47 | return json_encode($jsonArr); |
||
| 48 | } |
||
| 49 | } |
||
| 50 | |||
| 51 | if (! function_exists('retreive_json')) { |
||
| 52 | function retreive_json(string $str) |
||
| 53 | { |
||
| 54 | $jsonData = json_decode($str, true); |
||
| 55 | $jsonResults = []; |
||
| 56 | |||
| 57 | foreach ($jsonData as $data) { |
||
| 58 | $jsonResults[] = $data; |
||
| 59 | } |
||
| 60 | |||
| 61 | return $jsonResults; |
||
| 62 | } |
||
| 63 | } |
||
| 64 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.