@@ -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; |