@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | public function convertDate($date) |
| 11 | 11 | { |
| 12 | - return date('Y-m-d',strtotime($date)); |
|
| 12 | + return date('Y-m-d', strtotime($date)); |
|
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | public function convertToDayName($date) |
@@ -22,9 +22,9 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | public function greaterThanDate($neddle, $haystack) |
| 24 | 24 | { |
| 25 | - $b =[]; |
|
| 25 | + $b = []; |
|
| 26 | 26 | foreach ($haystack as $k => $v) { |
| 27 | - if(strtotime($k) > strtotime($neddle)){ |
|
| 27 | + if (strtotime($k) > strtotime($neddle)) { |
|
| 28 | 28 | $b[] = (object) ['date' => $k, 'description' => $v]; |
| 29 | 29 | } |
| 30 | 30 | } |
@@ -35,9 +35,9 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | public function lessThanDate($neddle, $haystack) |
| 37 | 37 | { |
| 38 | - $b =[]; |
|
| 38 | + $b = []; |
|
| 39 | 39 | foreach ($haystack as $k => $v) { |
| 40 | - if(strtotime($k) < strtotime($neddle)){ |
|
| 40 | + if (strtotime($k) < strtotime($neddle)) { |
|
| 41 | 41 | $b[] = (object) ['date' => $k, 'description' => $v]; |
| 42 | 42 | } |
| 43 | 43 | } |
@@ -42,9 +42,9 @@ discard block |
||
| 42 | 42 | { |
| 43 | 43 | $dt = new DateHelpers(); |
| 44 | 44 | |
| 45 | - $days = ['Saturday','Sunday']; |
|
| 45 | + $days = ['Saturday', 'Sunday']; |
|
| 46 | 46 | $day = $dt->convertToDayName($date); |
| 47 | - if(in_array($day, $days)) |
|
| 47 | + if (in_array($day, $days)) |
|
| 48 | 48 | { |
| 49 | 49 | return true; |
| 50 | 50 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | protected function checkOffDay($date) |
| 62 | 62 | { |
| 63 | - if($this->checkHoliday($date) || $this->checkWeekend($date)) |
|
| 63 | + if ($this->checkHoliday($date) || $this->checkWeekend($date)) |
|
| 64 | 64 | { |
| 65 | 65 | return true; |
| 66 | 66 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | protected function gettingInfo($date) |
| 71 | 71 | { |
| 72 | 72 | $this->populateHoliday(); |
| 73 | - if(array_key_exists($date, $this->holidays)) |
|
| 73 | + if (array_key_exists($date, $this->holidays)) |
|
| 74 | 74 | { |
| 75 | 75 | return $this->holidays[$date]; |
| 76 | 76 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | private function populateHoliday() |
| 81 | 81 | { |
| 82 | 82 | $get_holidays = $this->fetchHolidays(); |
| 83 | - foreach($get_holidays as $h) |
|
| 83 | + foreach ($get_holidays as $h) |
|
| 84 | 84 | { |
| 85 | 85 | $this->holidays[$h->date] = $h->description; |
| 86 | 86 | } |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | public function region() |
| 16 | 16 | { |
| 17 | - if(file_exists(__DIR__.'../../../../../../config/irfa/hari_libur.php') && function_exists('app')){ |
|
| 17 | + if (file_exists(__DIR__.'../../../../../../config/irfa/hari_libur.php') && function_exists('app')) { |
|
| 18 | 18 | |
| 19 | 19 | return strtoupper(config('irfa.hari_libur.region')); |
| 20 | 20 | |
@@ -119,7 +119,7 @@ |
||
| 119 | 119 | */ |
| 120 | 120 | private function checkDate() |
| 121 | 121 | { |
| 122 | - if(empty($this->date)) |
|
| 122 | + if (empty($this->date)) |
|
| 123 | 123 | { |
| 124 | 124 | throw new \Exception('Parameter date must be provided.'); |
| 125 | 125 | return false; |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | |
| 7 | 7 | class HariLiburServiceProvider extends ServiceProvider |
| 8 | 8 | { |
| 9 | - protected $namespace='AppLicenseServer\Controllers'; |
|
| 9 | + protected $namespace = 'AppLicenseServer\Controllers'; |
|
| 10 | 10 | /** |
| 11 | 11 | * Register services. |
| 12 | 12 | * |
@@ -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 | } |
@@ -39,19 +39,19 @@ discard block |
||
| 39 | 39 | public function holidayData($array = true) |
| 40 | 40 | { |
| 41 | 41 | $published_file = __DIR__.'../../../../../../resources/irfa/php-hari-libur/'.$this->lang().'.json'; |
| 42 | - if(file_exists($published_file)) |
|
| 42 | + if (file_exists($published_file)) |
|
| 43 | 43 | { |
| 44 | 44 | $file = $published_file; |
| 45 | - } else{ |
|
| 45 | + } else { |
|
| 46 | 46 | $file = __DIR__.'../../Data/'.$this->lang().'.json'; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | $this->checkFile($file); |
| 50 | 50 | $arr = file_get_contents($file); |
| 51 | - if($this->isJson($arr)) |
|
| 51 | + if ($this->isJson($arr)) |
|
| 52 | 52 | { |
| 53 | - return json_decode($arr,$array); |
|
| 54 | - } else{ |
|
| 53 | + return json_decode($arr, $array); |
|
| 54 | + } else { |
|
| 55 | 55 | throw new \Exception('Json data is invalid.'); |
| 56 | 56 | |
| 57 | 57 | return false; |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | private function checkFile($file) |
| 71 | 71 | { |
| 72 | - if(!file_exists($file)) |
|
| 72 | + if (!file_exists($file)) |
|
| 73 | 73 | { |
| 74 | 74 | throw new \Exception('Region "'.$this->lang().'" is not found.'); |
| 75 | 75 | return false; |