@@ -12,10 +12,10 @@ discard block |
||
| 12 | 12 | { |
| 13 | 13 | private $region; |
| 14 | 14 | /** |
| 15 | - * Method ini berfungsi untuk set tanggal dari config. |
|
| 16 | - * |
|
| 17 | - * @return boolean |
|
| 18 | - */ |
|
| 15 | + * Method ini berfungsi untuk set tanggal dari config. |
|
| 16 | + * |
|
| 17 | + * @return boolean |
|
| 18 | + */ |
|
| 19 | 19 | private function lang() |
| 20 | 20 | { |
| 21 | 21 | if(!empty($this->region)) |
@@ -32,10 +32,10 @@ discard block |
||
| 32 | 32 | $this->region = $region; |
| 33 | 33 | } |
| 34 | 34 | /** |
| 35 | - * Method ini berfungsi untuk mengambil data libur dari file json. |
|
| 36 | - * |
|
| 37 | - * @return boolean |
|
| 38 | - */ |
|
| 35 | + * Method ini berfungsi untuk mengambil data libur dari file json. |
|
| 36 | + * |
|
| 37 | + * @return boolean |
|
| 38 | + */ |
|
| 39 | 39 | public function holidayData($array = true) |
| 40 | 40 | { |
| 41 | 41 | if(function_exists('resource_path')) |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | $arr = file_get_contents($file); |
| 57 | 57 | if($this->isJson($arr)) |
| 58 | 58 | { |
| 59 | - return json_decode($arr,$array); |
|
| 59 | + return json_decode($arr,$array); |
|
| 60 | 60 | } else{ |
| 61 | 61 | throw new \Exception('Json data is invalid.'); |
| 62 | 62 | |
@@ -64,10 +64,10 @@ discard block |
||
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | /** |
| 67 | - * Method ini berfungsi untuk validasi json |
|
| 68 | - * |
|
| 69 | - * @return boolean |
|
| 70 | - */ |
|
| 67 | + * Method ini berfungsi untuk validasi json |
|
| 68 | + * |
|
| 69 | + * @return boolean |
|
| 70 | + */ |
|
| 71 | 71 | private function isJson($string) { |
| 72 | 72 | json_decode($string); |
| 73 | 73 | return (json_last_error() == JSON_ERROR_NONE); |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | private function lang() |
| 20 | 20 | { |
| 21 | - if(!empty($this->region)) |
|
| 21 | + if (!empty($this->region)) |
|
| 22 | 22 | { |
| 23 | 23 | return strtoupper($this->region); |
| 24 | 24 | } |
@@ -38,26 +38,26 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | public function holidayData($array = true) |
| 40 | 40 | { |
| 41 | - if(function_exists('resource_path')) |
|
| 41 | + if (function_exists('resource_path')) |
|
| 42 | 42 | { |
| 43 | 43 | $published_file = resource_path('irfa/php-hari-libur/'.$this->lang().'.json'); |
| 44 | - }else{ |
|
| 44 | + } else { |
|
| 45 | 45 | $published_file = __DIR__.'../../../../../../resources/irfa/php-hari-libur/'.$this->lang().'.json'; |
| 46 | 46 | } |
| 47 | - if(file_exists($published_file)) |
|
| 47 | + if (file_exists($published_file)) |
|
| 48 | 48 | { |
| 49 | 49 | $file = $published_file; |
| 50 | - } else{ |
|
| 50 | + } else { |
|
| 51 | 51 | $file = __DIR__.'/'.'../../Data/'.$this->lang().'.json'; |
| 52 | 52 | } |
| 53 | 53 | // dd($file); |
| 54 | 54 | |
| 55 | 55 | $this->checkFile($file); |
| 56 | 56 | $arr = file_get_contents($file); |
| 57 | - if($this->isJson($arr)) |
|
| 57 | + if ($this->isJson($arr)) |
|
| 58 | 58 | { |
| 59 | - return json_decode($arr,$array); |
|
| 60 | - } else{ |
|
| 59 | + return json_decode($arr, $array); |
|
| 60 | + } else { |
|
| 61 | 61 | throw new \Exception('Json data is invalid.'); |
| 62 | 62 | |
| 63 | 63 | return false; |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | private function checkFile($file) |
| 77 | 77 | { |
| 78 | - if(!file_exists($file)) |
|
| 78 | + if (!file_exists($file)) |
|
| 79 | 79 | { |
| 80 | 80 | throw new \Exception('Region "'.$this->lang().'" is not found.'); |
| 81 | 81 | return false; |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | if(function_exists('resource_path')) |
| 42 | 42 | { |
| 43 | 43 | $published_file = resource_path('irfa/php-hari-libur/'.$this->lang().'.json'); |
| 44 | - }else{ |
|
| 44 | + } else{ |
|
| 45 | 45 | $published_file = __DIR__.'../../../../../../resources/irfa/php-hari-libur/'.$this->lang().'.json'; |
| 46 | 46 | } |
| 47 | 47 | if(file_exists($published_file)) |