Conditions | 4 |
Paths | 8 |
Total Lines | 25 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
39 | public function holidayData($array = true) |
||
40 | { |
||
41 | if(function_exists('resource_path')) |
||
42 | { |
||
43 | $published_file = resource_path('irfa/php-hari-libur/'.$this->lang().'.json'); |
||
44 | }else{ |
||
45 | $published_file = __DIR__.'../../../../../../resources/irfa/php-hari-libur/'.$this->lang().'.json'; |
||
46 | } |
||
47 | if(file_exists($published_file)) |
||
48 | { |
||
49 | $file = $published_file; |
||
50 | } else{ |
||
51 | $file = __DIR__.'/'.'../../Data/'.$this->lang().'.json'; |
||
52 | } |
||
53 | // dd($file); |
||
54 | |||
55 | $this->checkFile($file); |
||
56 | $arr = file_get_contents($file); |
||
57 | if($this->isJson($arr)) |
||
58 | { |
||
59 | return json_decode($arr,$array); |
||
60 | } else{ |
||
61 | throw new \Exception('Json data is invalid.'); |
||
62 | |||
63 | return false; |
||
64 | } |
||
86 |