@@ -7,12 +7,12 @@ |
||
7 | 7 | class DateHelpers |
8 | 8 | { |
9 | 9 | |
10 | - public function convertDate($date) |
|
11 | - { |
|
12 | - return date('Y-m-d',strtotime($date)); |
|
13 | - } |
|
10 | + public function convertDate($date) |
|
11 | + { |
|
12 | + return date('Y-m-d',strtotime($date)); |
|
13 | + } |
|
14 | 14 | |
15 | - public function convertToDayName($date) |
|
15 | + public function convertToDayName($date) |
|
16 | 16 | { |
17 | 17 | $time = strtotime($date); |
18 | 18 | $day = date('l', $time); |
@@ -8,10 +8,10 @@ |
||
8 | 8 | class ConfigLoader |
9 | 9 | { |
10 | 10 | /** |
11 | - * Method ini berfungsi memuat file konfigurasi region. |
|
12 | - * |
|
13 | - * @return string |
|
14 | - */ |
|
11 | + * Method ini berfungsi memuat file konfigurasi region. |
|
12 | + * |
|
13 | + * @return string |
|
14 | + */ |
|
15 | 15 | public function region() |
16 | 16 | { |
17 | 17 | if(file_exists(__DIR__.'../../../../../../config/irfa/hari_libur.php') && function_exists('app')){ |
@@ -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 | $published_file = __DIR__.'../../../../../../resources/data-libur-nasional/'.$this->lang().'.json'; |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $arr = file_get_contents($file); |
51 | 51 | if($this->isJson($arr)) |
52 | 52 | { |
53 | - return json_decode($arr,$array); |
|
53 | + return json_decode($arr,$array); |
|
54 | 54 | } else{ |
55 | 55 | throw new \Exception('Json data is invalid.'); |
56 | 56 | |
@@ -58,10 +58,10 @@ discard block |
||
58 | 58 | } |
59 | 59 | } |
60 | 60 | /** |
61 | - * Method ini berfungsi untuk validasi json |
|
62 | - * |
|
63 | - * @return boolean |
|
64 | - */ |
|
61 | + * Method ini berfungsi untuk validasi json |
|
62 | + * |
|
63 | + * @return boolean |
|
64 | + */ |
|
65 | 65 | private function isJson($string) { |
66 | 66 | json_decode($string); |
67 | 67 | return (json_last_error() == JSON_ERROR_NONE); |
@@ -13,117 +13,117 @@ |
||
13 | 13 | class HariLibur extends Libur |
14 | 14 | { |
15 | 15 | private $date; |
16 | - /** |
|
17 | - * Method ini berfungsi sebagai setter untuk $date |
|
18 | - * |
|
19 | - * @param string $date |
|
20 | - * @return object |
|
21 | - */ |
|
22 | - public function date($date) |
|
23 | - { |
|
24 | - $date_helper = new DateHelpers(); |
|
25 | - $this->date = $date_helper->convertDate($date); |
|
26 | - return $this; |
|
27 | - } |
|
16 | + /** |
|
17 | + * Method ini berfungsi sebagai setter untuk $date |
|
18 | + * |
|
19 | + * @param string $date |
|
20 | + * @return object |
|
21 | + */ |
|
22 | + public function date($date) |
|
23 | + { |
|
24 | + $date_helper = new DateHelpers(); |
|
25 | + $this->date = $date_helper->convertDate($date); |
|
26 | + return $this; |
|
27 | + } |
|
28 | 28 | |
29 | - /** |
|
30 | - * Method ini berfungsi untuk mengecek hari libur nasional |
|
31 | - * |
|
32 | - * @return boolean |
|
33 | - */ |
|
34 | - public function isHoliday() |
|
35 | - { |
|
36 | - $this->checkDate(); |
|
37 | - return $this->checkHoliday($this->date); |
|
38 | - } |
|
29 | + /** |
|
30 | + * Method ini berfungsi untuk mengecek hari libur nasional |
|
31 | + * |
|
32 | + * @return boolean |
|
33 | + */ |
|
34 | + public function isHoliday() |
|
35 | + { |
|
36 | + $this->checkDate(); |
|
37 | + return $this->checkHoliday($this->date); |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * Method ini berfungsi untuk mengecek akhir pekan (sabtu, minggu) |
|
42 | - * |
|
43 | - * @return boolean |
|
44 | - */ |
|
45 | - public function isWeekend() |
|
46 | - { |
|
47 | - $this->checkDate(); |
|
48 | - return $this->checkWeekend($this->date); |
|
49 | - } |
|
40 | + /** |
|
41 | + * Method ini berfungsi untuk mengecek akhir pekan (sabtu, minggu) |
|
42 | + * |
|
43 | + * @return boolean |
|
44 | + */ |
|
45 | + public function isWeekend() |
|
46 | + { |
|
47 | + $this->checkDate(); |
|
48 | + return $this->checkWeekend($this->date); |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * Method ini berfungsi untuk mengecek hari akhir pekan dan hari libur nasional |
|
53 | - * |
|
54 | - * @return boolean |
|
55 | - */ |
|
56 | - public function isDayOff() |
|
57 | - { |
|
58 | - $this->checkDate(); |
|
59 | - return $this->checkOffDay($this->date); |
|
60 | - } |
|
51 | + /** |
|
52 | + * Method ini berfungsi untuk mengecek hari akhir pekan dan hari libur nasional |
|
53 | + * |
|
54 | + * @return boolean |
|
55 | + */ |
|
56 | + public function isDayOff() |
|
57 | + { |
|
58 | + $this->checkDate(); |
|
59 | + return $this->checkOffDay($this->date); |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * Method ini berfungsi untuk mengambil data hari libur nasional |
|
64 | - * |
|
65 | - * @return object |
|
66 | - */ |
|
67 | - public function get() |
|
68 | - { |
|
69 | - return $this->fetchHolidays(); |
|
70 | - } |
|
62 | + /** |
|
63 | + * Method ini berfungsi untuk mengambil data hari libur nasional |
|
64 | + * |
|
65 | + * @return object |
|
66 | + */ |
|
67 | + public function get() |
|
68 | + { |
|
69 | + return $this->fetchHolidays(); |
|
70 | + } |
|
71 | 71 | |
72 | - /** |
|
73 | - * Method ini berfungsi untuk mengambil informasi libur |
|
74 | - * @return string |
|
75 | - */ |
|
76 | - public function getInfo() |
|
77 | - { |
|
78 | - $this->checkDate(); |
|
79 | - return $this->gettingInfo($this->date); |
|
80 | - } |
|
72 | + /** |
|
73 | + * Method ini berfungsi untuk mengambil informasi libur |
|
74 | + * @return string |
|
75 | + */ |
|
76 | + public function getInfo() |
|
77 | + { |
|
78 | + $this->checkDate(); |
|
79 | + return $this->gettingInfo($this->date); |
|
80 | + } |
|
81 | 81 | |
82 | - /** |
|
83 | - * Method ini berfungsi untuk mengecek tanggal sudah diisi apa belum |
|
84 | - * |
|
85 | - * @return mixed |
|
86 | - */ |
|
87 | - public function region($region) |
|
88 | - { |
|
89 | - $this->setRegion($region); |
|
90 | - return $this; |
|
91 | - } |
|
82 | + /** |
|
83 | + * Method ini berfungsi untuk mengecek tanggal sudah diisi apa belum |
|
84 | + * |
|
85 | + * @return mixed |
|
86 | + */ |
|
87 | + public function region($region) |
|
88 | + { |
|
89 | + $this->setRegion($region); |
|
90 | + return $this; |
|
91 | + } |
|
92 | 92 | |
93 | - /** |
|
94 | - * Method ini berfungsi untuk menampilkan data libur sebelum tanggal yang telah di atur di parameter date. |
|
95 | - * |
|
96 | - * @return object |
|
97 | - */ |
|
98 | - public function nextHoliday() |
|
99 | - { |
|
100 | - $next = $this->getnextHolidays($this->date); |
|
101 | - return $next; |
|
102 | - } |
|
93 | + /** |
|
94 | + * Method ini berfungsi untuk menampilkan data libur sebelum tanggal yang telah di atur di parameter date. |
|
95 | + * |
|
96 | + * @return object |
|
97 | + */ |
|
98 | + public function nextHoliday() |
|
99 | + { |
|
100 | + $next = $this->getnextHolidays($this->date); |
|
101 | + return $next; |
|
102 | + } |
|
103 | 103 | |
104 | - /** |
|
105 | - * Method ini berfungsi untuk menampilkan data libur setelah tanggal yang telah di atur di parameter date. |
|
106 | - * |
|
107 | - * @return object |
|
108 | - */ |
|
109 | - public function prevHoliday() |
|
110 | - { |
|
111 | - $prev = $this->getPrevHolidays($this->date); |
|
112 | - return $prev; |
|
113 | - } |
|
104 | + /** |
|
105 | + * Method ini berfungsi untuk menampilkan data libur setelah tanggal yang telah di atur di parameter date. |
|
106 | + * |
|
107 | + * @return object |
|
108 | + */ |
|
109 | + public function prevHoliday() |
|
110 | + { |
|
111 | + $prev = $this->getPrevHolidays($this->date); |
|
112 | + return $prev; |
|
113 | + } |
|
114 | 114 | |
115 | - /** |
|
116 | - * Method ini berfungsi untuk mengecek tanggal sudah diisi apa belum |
|
117 | - * |
|
118 | - * @return mixed |
|
119 | - */ |
|
120 | - private function checkDate() |
|
121 | - { |
|
122 | - if(empty($this->date)) |
|
123 | - { |
|
124 | - throw new \Exception('Parameter date must be provided.'); |
|
125 | - return false; |
|
126 | - } |
|
127 | - } |
|
115 | + /** |
|
116 | + * Method ini berfungsi untuk mengecek tanggal sudah diisi apa belum |
|
117 | + * |
|
118 | + * @return mixed |
|
119 | + */ |
|
120 | + private function checkDate() |
|
121 | + { |
|
122 | + if(empty($this->date)) |
|
123 | + { |
|
124 | + throw new \Exception('Parameter date must be provided.'); |
|
125 | + return false; |
|
126 | + } |
|
127 | + } |
|
128 | 128 | |
129 | 129 | } |
@@ -10,13 +10,13 @@ |
||
10 | 10 | |
11 | 11 | class HariLibur extends Facade |
12 | 12 | { |
13 | - /** |
|
14 | - * Get the registered name of the component. |
|
15 | - * |
|
16 | - * @return string |
|
17 | - */ |
|
18 | - protected static function getFacadeAccessor() |
|
19 | - { |
|
20 | - return \Irfa\HariLibur\Func\HariLibur::class; |
|
21 | - } |
|
13 | + /** |
|
14 | + * Get the registered name of the component. |
|
15 | + * |
|
16 | + * @return string |
|
17 | + */ |
|
18 | + protected static function getFacadeAccessor() |
|
19 | + { |
|
20 | + return \Irfa\HariLibur\Func\HariLibur::class; |
|
21 | + } |
|
22 | 22 | } |
@@ -6,26 +6,26 @@ |
||
6 | 6 | |
7 | 7 | class HariLiburServiceProvider extends ServiceProvider |
8 | 8 | { |
9 | - protected $namespace='AppLicenseServer\Controllers'; |
|
10 | - /** |
|
11 | - * Register services. |
|
12 | - * |
|
13 | - * @return void |
|
14 | - */ |
|
15 | - public function register() |
|
16 | - { |
|
9 | + protected $namespace='AppLicenseServer\Controllers'; |
|
10 | + /** |
|
11 | + * Register services. |
|
12 | + * |
|
13 | + * @return void |
|
14 | + */ |
|
15 | + public function register() |
|
16 | + { |
|
17 | 17 | |
18 | - } |
|
18 | + } |
|
19 | 19 | |
20 | - /** |
|
21 | - * Bootstrap services. |
|
22 | - * |
|
23 | - * @return void |
|
24 | - */ |
|
25 | - public function boot() |
|
26 | - { |
|
27 | - $this->publishes([ |
|
28 | - __DIR__.'/../laravel-config/hari_libur.php' => config_path('irfa/hari_libur.php'), |
|
29 | - __DIR__.'/../src/Data' => resource_path('irfa/php-hari-libur'), ], 'hari-libur'); |
|
30 | - } |
|
20 | + /** |
|
21 | + * Bootstrap services. |
|
22 | + * |
|
23 | + * @return void |
|
24 | + */ |
|
25 | + public function boot() |
|
26 | + { |
|
27 | + $this->publishes([ |
|
28 | + __DIR__.'/../laravel-config/hari_libur.php' => config_path('irfa/hari_libur.php'), |
|
29 | + __DIR__.'/../src/Data' => resource_path('irfa/php-hari-libur'), ], 'hari-libur'); |
|
30 | + } |
|
31 | 31 | } |