Completed
Push — master ( 01907b...5981e6 )
by mehdi
03:03
created
src/Convert.php 4 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -64,6 +64,10 @@
 block discarded – undo
64 64
     *
65 65
     *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
66 66
     */
67
+
68
+    /**
69
+     * @param \DateTime $date_time
70
+     */
67 71
     public function __construct( $date_time = null ) 
68 72
     {
69 73
 
Please login to merge, or discard this patch.
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -12,48 +12,48 @@  discard block
 block discarded – undo
12 12
 {
13 13
 
14 14
     /**
15
-   * @var integer
16
-   */
15
+     * @var integer
16
+     */
17 17
     protected $year;
18 18
 
19 19
     /**
20
-   * @var integer
21
-   */
20
+     * @var integer
21
+     */
22 22
     protected $month;
23 23
 
24 24
     /**
25
-   * @var $day
26
-   */
25
+     * @var $day
26
+     */
27 27
     protected $day;
28 28
 
29 29
     /**
30
-   * @var DateTime
31
-   */
30
+     * @var DateTime
31
+     */
32 32
     public $date_time;
33 33
 
34 34
     /**
35
-   * @var array
36
-   */
35
+     * @var array
36
+     */
37 37
     protected $config;
38 38
 
39 39
     /**
40
-   * @var integer
41
-   */
40
+     * @var integer
41
+     */
42 42
     protected $leap;
43 43
 
44 44
     /**
45
-   * @var integer
46
-   */
45
+     * @var integer
46
+     */
47 47
     protected $temp_day;
48 48
 
49 49
     /**
50
-   * @var DateTime
51
-   */
50
+     * @var DateTime
51
+     */
52 52
     protected $date;
53 53
 
54 54
     /**
55
-   * @var array
56
-   */
55
+     * @var array
56
+     */
57 57
     protected $calendar_file;
58 58
 
59 59
     /************************************************************
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
     }
105 105
 
106 106
     /**
107
-   *convert jalali year to gregorian year
108
- *
109
-   * @since  Oct, 16 2015
110
-   * @return object
111
-   */
107
+     *convert jalali year to gregorian year
108
+     *
109
+     * @since  Oct, 16 2015
110
+     * @return object
111
+     */
112 112
     public function jalaliToGregorian( $date_time ) 
113 113
     {
114 114
 
@@ -172,16 +172,16 @@  discard block
 block discarded – undo
172 172
           $this->date_time->setDate($gregorian_year, $gregorian_month, $gregorian_day);
173 173
 
174 174
 
175
-         return $this->date_time;
175
+          return $this->date_time;
176 176
 
177 177
     }
178 178
 
179 179
     /**
180
-   *convert jalali year to hijri year
181
- *
182
-   * @since  Oct, 17 2015
183
-   * @return object
184
-   */
180
+     *convert jalali year to hijri year
181
+     *
182
+     * @since  Oct, 17 2015
183
+     * @return object
184
+     */
185 185
     public function jalaliToHijri( $date_time ) 
186 186
     {
187 187
 
@@ -203,9 +203,9 @@  discard block
 block discarded – undo
203 203
 
204 204
         }
205 205
 
206
-         $this->temp_day += $this->day;
206
+          $this->temp_day += $this->day;
207 207
 
208
-         $this->leap = new Leap($this->year);
208
+          $this->leap = new Leap($this->year);
209 209
 
210 210
         if ($this->leap->get() && $this->month > 11 ) { $this->temp_day++; 
211 211
         }
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 
219 219
         $_month = $_year[1];
220 220
 
221
-         $var_temp = '0.0';
221
+          $var_temp = '0.0';
222 222
 
223 223
         for ( $i = strlen($_month); $i > 2; $i-- ) {
224 224
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 
227 227
         }
228 228
 
229
-         $var_temp .= '1';
229
+          $var_temp .= '1';
230 230
 
231 231
         $_month = $_month * $var_temp ;
232 232
 
@@ -256,18 +256,18 @@  discard block
 block discarded – undo
256 256
 
257 257
         $this->day = $_day[0];
258 258
 
259
-           $this->date_time->setDate($this->year, $this->month, $this->day);
259
+            $this->date_time->setDate($this->year, $this->month, $this->day);
260 260
 
261
-           return $this->date_time;
261
+            return $this->date_time;
262 262
 
263 263
     }
264 264
 
265 265
     /**
266
-   *convert hijri year to jalali year
267
- *
268
-   * @since  Oct, 17 2015
269
-   * @return object
270
-   */
266
+     *convert hijri year to jalali year
267
+     *
268
+     * @since  Oct, 17 2015
269
+     * @return object
270
+     */
271 271
     public function hijriToJalali( $date_time ) 
272 272
     {
273 273
 
@@ -320,16 +320,16 @@  discard block
 block discarded – undo
320 320
 
321 321
           $this->date_time->setDate($jalali_year, $jalali_month, $jalali_day);
322 322
 
323
-         return $this->date_time;
323
+          return $this->date_time;
324 324
 
325 325
     }
326 326
 
327 327
     /**
328
-    * convert hijri year to gregorian year
329
-   *
330
-    * @since  Oct, 17 2015
331
-    * @return object
332
-    */
328
+     * convert hijri year to gregorian year
329
+     *
330
+     * @since  Oct, 17 2015
331
+     * @return object
332
+     */
333 333
     public function hijriToGregorian( $date_time ) 
334 334
     {
335 335
 
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 
383 383
         $this->date_time->setDate($gregorian_year, $gregorian_month, $gregorian_day);
384 384
 
385
-         return $this->date_time;
385
+          return $this->date_time;
386 386
 
387 387
     }
388 388
 
Please login to merge, or discard this patch.
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
     *
65 65
     *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
66 66
     */
67
-    public function __construct( $date_time = null ) 
67
+    public function __construct($date_time = null) 
68 68
     {
69 69
 
70
-        if ($date_time !== null ) {
70
+        if ($date_time !== null) {
71 71
 
72 72
             $this->date_time = $date_time;
73 73
 
@@ -77,12 +77,12 @@  discard block
 block discarded – undo
77 77
 
78 78
     }
79 79
 
80
-    public function from( $calendar ) 
80
+    public function from($calendar) 
81 81
     {
82 82
 
83
-        $this->calendar_file = include 'CalendarSettings/' . ucfirst($calendar) . '.php';
83
+        $this->calendar_file = include 'CalendarSettings/'.ucfirst($calendar).'.php';
84 84
 
85
-        return $this->calendar_file[ 'convert_from' ]( $this->date_time );
85
+        return $this->calendar_file['convert_from']($this->date_time);
86 86
 
87 87
     }
88 88
 
@@ -94,12 +94,12 @@  discard block
 block discarded – undo
94 94
     *
95 95
     *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
96 96
     */
97
-    public function to( $calendar ) 
97
+    public function to($calendar) 
98 98
     {
99 99
 
100
-        $this->calendar_file = include 'CalendarSettings/' . ucfirst($calendar) . '.php';
100
+        $this->calendar_file = include 'CalendarSettings/'.ucfirst($calendar).'.php';
101 101
 
102
-        return $this->calendar_file[ 'convert_to' ]( $this->date_time );
102
+        return $this->calendar_file['convert_to']($this->date_time);
103 103
 
104 104
     }
105 105
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
    * @since  Oct, 16 2015
110 110
    * @return object
111 111
    */
112
-    public function jalaliToGregorian( $date_time ) 
112
+    public function jalaliToGregorian($date_time) 
113 113
     {
114 114
 
115 115
           $this->config = include 'Jalali.php';
@@ -124,42 +124,42 @@  discard block
 block discarded – undo
124 124
 
125 125
           $days_of_year = 0;
126 126
 
127
-        foreach ( $this->config[ 'month_days_number' ] as $month => $value ) {
127
+        foreach ($this->config['month_days_number'] as $month => $value) {
128 128
 
129
-            if ($this->month > $month ) { $days_of_year += $value; 
129
+            if ($this->month > $month) { $days_of_year += $value; 
130 130
             }
131 131
 
132 132
         }
133 133
 
134 134
           $days_of_year += $this->day;
135 135
 
136
-          $days_of_leap_years =  intval(( ( $this->year - 1 ) / 4 ));
136
+          $days_of_leap_years = intval((($this->year - 1) / 4));
137 137
 
138
-          $days_of_jalali_years = ( ( ( $this->year - 1 ) * 365 ) + $days_of_year + $days_of_leap_years );
138
+          $days_of_jalali_years = ((($this->year - 1) * 365) + $days_of_year + $days_of_leap_years);
139 139
 
140 140
           $days_of_gregorain_years = $days_of_jalali_years + 226899;
141 141
 
142
-        if ($this->month < 10 ) {
142
+        if ($this->month < 10) {
143 143
 
144
-            $days_of_gregorain_years = $days_of_gregorain_years - intval(( ( $this->year + 621 ) / 4 ));
144
+            $days_of_gregorain_years = $days_of_gregorain_years - intval((($this->year + 621) / 4));
145 145
 
146 146
         }
147 147
 
148
-        elseif (( ( 10 == $this->month ) && ( $this->day > 10 ) ) || ( $this->month > 10 ) ) {
148
+        elseif (((10 == $this->month) && ($this->day > 10)) || ($this->month > 10)) {
149 149
 
150
-            $days_of_gregorain_years = $days_of_gregorain_years - intval(( ( $this->year + 622 ) / 4 ));
150
+            $days_of_gregorain_years = $days_of_gregorain_years - intval((($this->year + 622) / 4));
151 151
 
152 152
         }
153 153
 
154
-            $gregorian_month = ( $days_of_gregorain_years % 365 );
154
+            $gregorian_month = ($days_of_gregorain_years % 365);
155 155
 
156 156
             $gregorian_year = intval($days_of_gregorain_years / 365) + 1;
157 157
 
158 158
             $this->config = include 'Gregorian.php';
159 159
 
160
-        foreach ($this->config[ 'month_days_number' ] as $month => $value) {
160
+        foreach ($this->config['month_days_number'] as $month => $value) {
161 161
 
162
-            if ($gregorian_month < $value ) { break; 
162
+            if ($gregorian_month < $value) { break; 
163 163
             }
164 164
 
165 165
             $gregorian_month -= $value;
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
    * @since  Oct, 17 2015
183 183
    * @return object
184 184
    */
185
-    public function jalaliToHijri( $date_time ) 
185
+    public function jalaliToHijri($date_time) 
186 186
     {
187 187
 
188 188
         $this->date_time = $date_time;
@@ -193,11 +193,11 @@  discard block
 block discarded – undo
193 193
 
194 194
         $this->day = $this->date_time->format('d');
195 195
 
196
-        $this->temp_day = 0 ;
196
+        $this->temp_day = 0;
197 197
 
198 198
         $this->config = include 'Jalali.php';
199 199
 
200
-        for ( $i = 1 ; $i < $this->month ; $i++ ) {
200
+        for ($i = 1; $i < $this->month; $i++) {
201 201
 
202 202
             $this->temp_day += $this->config['month_days_number'][$i];
203 203
 
@@ -207,10 +207,10 @@  discard block
 block discarded – undo
207 207
 
208 208
          $this->leap = new Leap($this->year);
209 209
 
210
-        if ($this->leap->get() && $this->month > 11 ) { $this->temp_day++; 
210
+        if ($this->leap->get() && $this->month > 11) { $this->temp_day++; 
211 211
         }
212 212
 
213
-        $_year = ( ( ( ( ( $this->year - 1 ) * 365.2422 ) + $this->temp_day ) - 119) / 354.3670 ) + 1;
213
+        $_year = ((((($this->year - 1) * 365.2422) + $this->temp_day) - 119) / 354.3670) + 1;
214 214
 
215 215
         $_year = explode('.', $_year);
216 216
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 
221 221
          $var_temp = '0.0';
222 222
 
223
-        for ( $i = strlen($_month); $i > 2; $i-- ) {
223
+        for ($i = strlen($_month); $i > 2; $i--) {
224 224
 
225 225
             $var_temp .= '0';
226 226
 
@@ -228,9 +228,9 @@  discard block
 block discarded – undo
228 228
 
229 229
          $var_temp .= '1';
230 230
 
231
-        $_month = $_month * $var_temp ;
231
+        $_month = $_month * $var_temp;
232 232
 
233
-        $_month = ( $_month * 12 ) + 1;
233
+        $_month = ($_month * 12) + 1;
234 234
 
235 235
         $_month = explode('.', $_month);
236 236
 
@@ -240,9 +240,9 @@  discard block
 block discarded – undo
240 240
 
241 241
         $var_temp = '0.0';
242 242
 
243
-        for ( $i = strlen($_day);  $i > 2;  $i-- ) {
243
+        for ($i = strlen($_day); $i > 2; $i--) {
244 244
 
245
-            $var_temp .= '0' ;
245
+            $var_temp .= '0';
246 246
 
247 247
         }
248 248
 
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 
251 251
         $_day = $_day * $var_temp;
252 252
 
253
-        $_day = ( $_day * 29.530 );
253
+        $_day = ($_day * 29.530);
254 254
 
255 255
         $_day = explode('.', $_day);
256 256
 
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
    * @since  Oct, 17 2015
269 269
    * @return object
270 270
    */
271
-    public function hijriToJalali( $date_time ) 
271
+    public function hijriToJalali($date_time) 
272 272
     {
273 273
 
274 274
           $this->date_time = $date_time;
@@ -283,32 +283,32 @@  discard block
 block discarded – undo
283 283
 
284 284
           $this->config = include 'Hijri.php';
285 285
 
286
-        foreach ( $this->config[ 'month_days_number' ] as $month => $value ) {
286
+        foreach ($this->config['month_days_number'] as $month => $value) {
287 287
 
288
-            if ($this->month > $month ) { $days_of_year += $value; 
288
+            if ($this->month > $month) { $days_of_year += $value; 
289 289
             }
290 290
 
291 291
         }
292 292
 
293 293
           $days_of_year += $this->day;
294 294
 
295
-          $days_of_leap_years =  intval(( ( $this->year - 1 ) / 3 ));
295
+          $days_of_leap_years = intval((($this->year - 1) / 3));
296 296
 
297
-          $days_of_hijri_years = ( ( ( $this->year - 1 ) * 354 ) + $days_of_year + $days_of_leap_years );
297
+          $days_of_hijri_years = ((($this->year - 1) * 354) + $days_of_year + $days_of_leap_years);
298 298
 
299 299
           $days_of_jalali_years = $days_of_hijri_years + 179;
300 300
 
301
-          $days_of_jalali_years = $days_of_jalali_years - intval(( ( $this->year - 43 ) / 4 ));
301
+          $days_of_jalali_years = $days_of_jalali_years - intval((($this->year - 43) / 4));
302 302
 
303
-          $jalali_month = ( $days_of_jalali_years % 365 );
303
+          $jalali_month = ($days_of_jalali_years % 365);
304 304
 
305 305
           $jalali_year = intval($days_of_jalali_years / 365) + 1;
306 306
 
307 307
           $this->config = include 'Jalali.php';
308 308
 
309
-        foreach ($this->config[ 'month_days_number' ] as $month => $value) {
309
+        foreach ($this->config['month_days_number'] as $month => $value) {
310 310
 
311
-            if ($jalali_month < $value ) { break; 
311
+            if ($jalali_month < $value) { break; 
312 312
             }
313 313
 
314 314
               $jalali_month -= $value;
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
     * @since  Oct, 17 2015
331 331
     * @return object
332 332
     */
333
-    public function hijriToGregorian( $date_time ) 
333
+    public function hijriToGregorian($date_time) 
334 334
     {
335 335
 
336 336
         $this->date_time = $date_time;
@@ -345,32 +345,32 @@  discard block
 block discarded – undo
345 345
 
346 346
         $this->config = include 'Hijri.php';
347 347
 
348
-        foreach ( $this->config[ 'month_days_number' ] as $month => $value ) {
348
+        foreach ($this->config['month_days_number'] as $month => $value) {
349 349
 
350
-            if ($this->month > $month ) { $days_of_year += $value; 
350
+            if ($this->month > $month) { $days_of_year += $value; 
351 351
             }
352 352
 
353 353
         }
354 354
 
355 355
         $days_of_year += $this->day;
356 356
 
357
-        $days_of_leap_years =  intval(( ( $this->year - 1 ) / 3 ));
357
+        $days_of_leap_years = intval((($this->year - 1) / 3));
358 358
 
359
-        $days_of_hijri_years = ( ( ( $this->year - 1 ) * 354 ) + $days_of_year + $days_of_leap_years );
359
+        $days_of_hijri_years = ((($this->year - 1) * 354) + $days_of_year + $days_of_leap_years);
360 360
 
361 361
         $days_of_gregorain_years = $days_of_hijri_years + 227078;
362 362
 
363
-        $days_of_gregorain_years = $days_of_gregorain_years - intval(( ( $this->year + 578 ) / 4 ));
363
+        $days_of_gregorain_years = $days_of_gregorain_years - intval((($this->year + 578) / 4));
364 364
 
365
-        $gregorian_month = ( $days_of_gregorain_years % 365 );
365
+        $gregorian_month = ($days_of_gregorain_years % 365);
366 366
 
367 367
         $gregorian_year = intval($days_of_gregorain_years / 365) + 1;
368 368
 
369 369
         $this->config = include 'Gregorian.php';
370 370
 
371
-        foreach ($this->config[ 'month_days_number' ] as $month => $value) {
371
+        foreach ($this->config['month_days_number'] as $month => $value) {
372 372
 
373
-            if ($gregorian_month < $value ) { break; 
373
+            if ($gregorian_month < $value) { break; 
374 374
             }
375 375
 
376 376
             $gregorian_month -= $value;
Please login to merge, or discard this patch.
Braces   +1 added lines, -3 removed lines patch added patch discarded remove patch
@@ -143,9 +143,7 @@
 block discarded – undo
143 143
 
144 144
             $days_of_gregorain_years = $days_of_gregorain_years - intval(( ( $this->year + 621 ) / 4 ));
145 145
 
146
-        }
147
-
148
-        elseif (( ( 10 == $this->month ) && ( $this->day > 10 ) ) || ( $this->month > 10 ) ) {
146
+        } elseif (( ( 10 == $this->month ) && ( $this->day > 10 ) ) || ( $this->month > 10 ) ) {
149 147
 
150 148
             $days_of_gregorain_years = $days_of_gregorain_years - intval(( ( $this->year + 622 ) / 4 ));
151 149
 
Please login to merge, or discard this patch.
src/Datium.php 5 patches
Doc Comments   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
    * Get current datetime
184 184
    *
185 185
    * @since  Aug 17 2015
186
-   * @return object
186
+   * @return Datium
187 187
    */
188 188
     public static function now()
189 189
     {
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
    * @param integer $minute minute number
205 205
    * @param integer $second second number
206 206
    *
207
-   * @return object
207
+   * @return Datium
208 208
    */
209 209
     public static function create( $year = 2000, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0 )
210 210
     {
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
     * @param object $date_start Start of the DateTime
244 244
     * @param object $date_end   End of the DateTime
245 245
     *
246
-    * @return object
246
+    * @return Datium
247 247
     */
248 248
     public static function between( $date_start, $date_end )
249 249
     {
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
     *
290 290
     * @param object $calendar Assigned calendar to when calendar should start.
291 291
     *
292
-    * @return object
292
+    * @return Datium
293 293
     */
294 294
     public function to( $calendar )
295 295
     {
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
    *
331 331
    * @param string $value How much date should be added to current date
332 332
    *
333
-   * @return object
333
+   * @return Datium
334 334
    */
335 335
     public function add( $value )
336 336
     {
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
    *
361 361
    * @param string $value How much date should increase from current date
362 362
    *
363
-   * @return obejct
363
+   * @return Datium
364 364
    */
365 365
     public function sub( $value )
366 366
     {
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
    *
391 391
    * @param string $type Name of the calendar to caculate leap year
392 392
    *
393
-   * @return boolean
393
+   * @return Leap
394 394
    */
395 395
     public function leap( $type = 'gregorian' )
396 396
     {
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
     *
407 407
     * @since Aug, 22 2015
408 408
     *
409
-    * @return integer
409
+    * @return DayOf
410 410
     */
411 411
     public function dayOf()
412 412
     {
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
     *
454 454
     * @param string $language language short name fa, en, ar ...
455 455
     *
456
-    * @return object
456
+    * @return Datium
457 457
     */
458 458
     public function lang( $language = 'fa' )
459 459
     {
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,6 @@
 block discarded – undo
18 18
 use OpenCafe\Tools\Leap;
19 19
 use OpenCafe\Tools\DayOf;
20 20
 use OpenCafe\Tools\Lang;
21
-
22 21
 use OpenCafe\Datium;
23 22
 
24 23
 /**
Please login to merge, or discard this patch.
Indentation   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -35,17 +35,17 @@  discard block
 block discarded – undo
35 35
 {
36 36
 
37 37
     /**
38
-   * Store DateTime object
39
-   */
38
+     * Store DateTime object
39
+     */
40 40
     protected $date_time;
41 41
 
42 42
     protected static $static_date_time;
43 43
 
44 44
     /**
45
-   * Store config file statements
46
-   *
47
-   * @param array
48
-   */
45
+     * Store config file statements
46
+     *
47
+     * @param array
48
+     */
49 49
     protected $config;
50 50
 
51 51
     protected $date_interval_expression;
@@ -63,10 +63,10 @@  discard block
 block discarded – undo
63 63
     protected $fromConfig;
64 64
 
65 65
     /**
66
-   * Return store day number
67
-   *
68
-   * @param integer
69
-   */
66
+     * Return store day number
67
+     *
68
+     * @param integer
69
+     */
70 70
     protected $day_of;
71 71
 
72 72
     protected $leap;
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
     protected $language;
93 93
 
94 94
     /**
95
-    * Datium class constructure
96
-    */
95
+     * Datium class constructure
96
+     */
97 97
     public function __construct()
98 98
     {
99 99
 
@@ -154,10 +154,10 @@  discard block
 block discarded – undo
154 154
     }
155 155
 
156 156
     /**
157
-    * Return all datetime parts as an object
158
-    *
159
-    * @return object
160
-    */
157
+     * Return all datetime parts as an object
158
+     *
159
+     * @return object
160
+     */
161 161
     public function all()
162 162
     {
163 163
 
@@ -180,11 +180,11 @@  discard block
 block discarded – undo
180 180
     }
181 181
 
182 182
     /**
183
-   * Get current datetime
184
-   *
185
-   * @since  Aug 17 2015
186
-   * @return object
187
-   */
183
+     * Get current datetime
184
+     *
185
+     * @since  Aug 17 2015
186
+     * @return object
187
+     */
188 188
     public static function now()
189 189
     {
190 190
 
@@ -195,23 +195,23 @@  discard block
 block discarded – undo
195 195
     }
196 196
 
197 197
     /**
198
-   * Create new date time
199
-   *
200
-   * @param integer $year   Year number
201
-   * @param integer $month  month number
202
-   * @param integer $day    day number
203
-   * @param integer $hour   hour number
204
-   * @param integer $minute minute number
205
-   * @param integer $second second number
206
-   *
207
-   * @return object
208
-   */
198
+     * Create new date time
199
+     *
200
+     * @param integer $year   Year number
201
+     * @param integer $month  month number
202
+     * @param integer $day    day number
203
+     * @param integer $hour   hour number
204
+     * @param integer $minute minute number
205
+     * @param integer $second second number
206
+     *
207
+     * @return object
208
+     */
209 209
     public static function create( $year = 2000, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0 )
210 210
     {
211 211
 
212 212
         /**
213
-       * When we want to set a Datetime object to Datium
214
-       */
213
+         * When we want to set a Datetime object to Datium
214
+         */
215 215
         if(func_num_args() === 1 ) {
216 216
 
217 217
             self::$static_date_time = func_get_arg(0);
@@ -238,13 +238,13 @@  discard block
 block discarded – undo
238 238
     }
239 239
 
240 240
     /**
241
-    * Select The range between two date object
242
-    *
243
-    * @param object $date_start Start of the DateTime
244
-    * @param object $date_end   End of the DateTime
245
-    *
246
-    * @return object
247
-    */
241
+     * Select The range between two date object
242
+     *
243
+     * @param object $date_start Start of the DateTime
244
+     * @param object $date_end   End of the DateTime
245
+     *
246
+     * @return object
247
+     */
248 248
     public static function between( $date_start, $date_end )
249 249
     {
250 250
 
@@ -259,12 +259,12 @@  discard block
 block discarded – undo
259 259
     }
260 260
 
261 261
     /**
262
-   * Convert from current calendar, what type is current calendar?
263
-   *
264
-   * @param object $calendar Assigned calendar to start from
265
-   *
266
-   * @return $object
267
-   */
262
+     * Convert from current calendar, what type is current calendar?
263
+     *
264
+     * @param object $calendar Assigned calendar to start from
265
+     *
266
+     * @return $object
267
+     */
268 268
     public function from( $calendar )
269 269
     {
270 270
 
@@ -274,8 +274,8 @@  discard block
 block discarded – undo
274 274
 
275 275
 
276 276
         /**
277
-     * We need this part for DayOf class
278
-     */
277
+         * We need this part for DayOf class
278
+         */
279 279
         $this->calendar_type = $calendar;
280 280
 
281 281
         $this->translate_to = $calendar;
@@ -285,12 +285,12 @@  discard block
 block discarded – undo
285 285
     }
286 286
 
287 287
     /**
288
-    * Convert date to current Date
289
-    *
290
-    * @param object $calendar Assigned calendar to when calendar should start.
291
-    *
292
-    * @return object
293
-    */
288
+     * Convert date to current Date
289
+     *
290
+     * @param object $calendar Assigned calendar to when calendar should start.
291
+     *
292
+     * @return object
293
+     */
294 294
     public function to( $calendar )
295 295
     {
296 296
 
@@ -299,8 +299,8 @@  discard block
 block discarded – undo
299 299
         $this->date_time = $this->convert->to($calendar);
300 300
 
301 301
         /**
302
-     * We need this part for DayOf class
303
-     */
302
+         * We need this part for DayOf class
303
+         */
304 304
         $this->calendar_type = $calendar;
305 305
 
306 306
         $this->translate_to = $calendar;
@@ -311,13 +311,13 @@  discard block
 block discarded – undo
311 311
 
312 312
 
313 313
     /**
314
-   * Difference between two time
315
-   *
316
-   * @param DateTime $start Start of the date
317
-   * @param DateTime $end   End of the date
318
-   *
319
-   * @return object
320
-   */
314
+     * Difference between two time
315
+     *
316
+     * @param DateTime $start Start of the date
317
+     * @param DateTime $end   End of the date
318
+     *
319
+     * @return object
320
+     */
321 321
     public static function diff( $start, $end )
322 322
     {
323 323
 
@@ -326,12 +326,12 @@  discard block
 block discarded – undo
326 326
     }
327 327
 
328 328
     /**
329
-   * Add new date value to current date
330
-   *
331
-   * @param string $value How much date should be added to current date
332
-   *
333
-   * @return object
334
-   */
329
+     * Add new date value to current date
330
+     *
331
+     * @param string $value How much date should be added to current date
332
+     *
333
+     * @return object
334
+     */
335 335
     public function add( $value )
336 336
     {
337 337
 
@@ -356,12 +356,12 @@  discard block
 block discarded – undo
356 356
     }
357 357
 
358 358
     /**
359
-   * Sub date from current date
360
-   *
361
-   * @param string $value How much date should increase from current date
362
-   *
363
-   * @return obejct
364
-   */
359
+     * Sub date from current date
360
+     *
361
+     * @param string $value How much date should increase from current date
362
+     *
363
+     * @return obejct
364
+     */
365 365
     public function sub( $value )
366 366
     {
367 367
 
@@ -386,12 +386,12 @@  discard block
 block discarded – undo
386 386
     }
387 387
 
388 388
     /**
389
-   * Check if current year is leap or not
390
-   *
391
-   * @param string $type Name of the calendar to caculate leap year
392
-   *
393
-   * @return boolean
394
-   */
389
+     * Check if current year is leap or not
390
+     *
391
+     * @param string $type Name of the calendar to caculate leap year
392
+     *
393
+     * @return boolean
394
+     */
395 395
     public function leap( $type = 'gregorian' )
396 396
     {
397 397
 
@@ -402,12 +402,12 @@  discard block
 block discarded – undo
402 402
     }
403 403
 
404 404
     /**
405
-    * Caculate day of year or week
406
-    *
407
-    * @since Aug, 22 2015
408
-    *
409
-    * @return integer
410
-    */
405
+     * Caculate day of year or week
406
+     *
407
+     * @since Aug, 22 2015
408
+     *
409
+     * @return integer
410
+     */
411 411
     public function dayOf()
412 412
     {
413 413
 
@@ -435,12 +435,12 @@  discard block
 block discarded – undo
435 435
     // }
436 436
 
437 437
     /**
438
-    * Return Datetime as a original object
439
-    *
440
-    * @since Oct 22, 2015
441
-    *
442
-    * @return object
443
-    */
438
+     * Return Datetime as a original object
439
+     *
440
+     * @since Oct 22, 2015
441
+     *
442
+     * @return object
443
+     */
444 444
     public function object()
445 445
     {
446 446
 
@@ -449,12 +449,12 @@  discard block
 block discarded – undo
449 449
     }
450 450
 
451 451
     /**
452
-    * Translate current date string to selected language
453
-    *
454
-    * @param string $language language short name fa, en, ar ...
455
-    *
456
-    * @return object
457
-    */
452
+     * Translate current date string to selected language
453
+     *
454
+     * @param string $language language short name fa, en, ar ...
455
+     *
456
+     * @return object
457
+     */
458 458
     public function lang( $language = 'fa' )
459 459
     {
460 460
 
@@ -471,14 +471,14 @@  discard block
 block discarded – undo
471 471
     }
472 472
 
473 473
     /**
474
-   * Return fainal result
475
-   *
476
-   * @param string $format Date format
477
-   *
478
-   * @since Aug 17 2015
479
-   *
480
-   * @return string
481
-   */
474
+     * Return fainal result
475
+     *
476
+     * @param string $format Date format
477
+     *
478
+     * @since Aug 17 2015
479
+     *
480
+     * @return string
481
+     */
482 482
     public function get( $format = 'Y-m-d H:i:s' )
483 483
     {
484 484
 
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
         if (is_null($this->toConfig) ) {
498 498
 
499 499
             $this->toConfig = include 'CalendarSettings/' .
500
-                                       ucfirst($this->translate_to) . '.php';
500
+                                        ucfirst($this->translate_to) . '.php';
501 501
 
502 502
         }
503 503
 
Please login to merge, or discard this patch.
Switch Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -113,39 +113,39 @@
 block discarded – undo
113 113
 
114 114
         switch( Datium::$call_type ) {
115 115
 
116
-        case 'now':
116
+          case 'now':
117 117
 
118
-            $this->date_time = new DateTime('now');
118
+              $this->date_time = new DateTime('now');
119 119
 
120
-            $this->gregorian_DayofWeek = $this->date_time->format('w');
120
+              $this->gregorian_DayofWeek = $this->date_time->format('w');
121 121
 
122
-            break;
122
+              break;
123 123
 
124
-        case 'make':
124
+          case 'make':
125 125
 
126
-            $this->date_time = new DateTime('now');
126
+              $this->date_time = new DateTime('now');
127 127
 
128
-            $this->date_time->setDate(
129
-                self::$array_date[ 'year' ],
130
-                self::$array_date[ 'month' ],
131
-                self::$array_date[ 'day' ]
132
-            );
128
+              $this->date_time->setDate(
129
+                  self::$array_date[ 'year' ],
130
+                  self::$array_date[ 'month' ],
131
+                  self::$array_date[ 'day' ]
132
+              );
133 133
 
134
-            $this->date_time->setTime(
135
-                self::$array_date[ 'hour' ],
136
-                self::$array_date[ 'minute' ],
137
-                self::$array_date[ 'second' ]
138
-            );
134
+              $this->date_time->setTime(
135
+                  self::$array_date[ 'hour' ],
136
+                  self::$array_date[ 'minute' ],
137
+                  self::$array_date[ 'second' ]
138
+              );
139 139
 
140
-            $this->gregorian_DayofWeek = $this->date_time->format('w');
140
+              $this->gregorian_DayofWeek = $this->date_time->format('w');
141 141
 
142
-            break;
142
+              break;
143 143
 
144
-        case 'set':
144
+          case 'set':
145 145
 
146
-            $this->date_time = Datium::$static_date_time;
146
+              $this->date_time = Datium::$static_date_time;
147 147
 
148
-            $this->gregorian_DayofWeek = $this->date_time->format('w');
148
+              $this->gregorian_DayofWeek = $this->date_time->format('w');
149 149
 
150 150
         }
151 151
 
Please login to merge, or discard this patch.
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -105,13 +105,13 @@  discard block
 block discarded – undo
105 105
 
106 106
         $this->config = include 'Config.php';
107 107
 
108
-        $this->calendar_type = $this->config[ 'default_calendar' ];
108
+        $this->calendar_type = $this->config['default_calendar'];
109 109
 
110
-        date_default_timezone_set($this->config[ 'timezone' ]);
110
+        date_default_timezone_set($this->config['timezone']);
111 111
 
112 112
         $this->calendar_type = 'gregorian';
113 113
 
114
-        switch( Datium::$call_type ) {
114
+        switch (Datium::$call_type) {
115 115
 
116 116
         case 'now':
117 117
 
@@ -126,15 +126,15 @@  discard block
 block discarded – undo
126 126
             $this->date_time = new DateTime('now');
127 127
 
128 128
             $this->date_time->setDate(
129
-                self::$array_date[ 'year' ],
130
-                self::$array_date[ 'month' ],
131
-                self::$array_date[ 'day' ]
129
+                self::$array_date['year'],
130
+                self::$array_date['month'],
131
+                self::$array_date['day']
132 132
             );
133 133
 
134 134
             $this->date_time->setTime(
135
-                self::$array_date[ 'hour' ],
136
-                self::$array_date[ 'minute' ],
137
-                self::$array_date[ 'second' ]
135
+                self::$array_date['hour'],
136
+                self::$array_date['minute'],
137
+                self::$array_date['second']
138 138
             );
139 139
 
140 140
             $this->gregorian_DayofWeek = $this->date_time->format('w');
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
     public function all()
162 162
     {
163 163
 
164
-        return ( object ) array(
164
+        return (object) array(
165 165
 
166 166
         'second' => $this->date_time->format('s'),
167 167
 
@@ -206,13 +206,13 @@  discard block
 block discarded – undo
206 206
    *
207 207
    * @return object
208 208
    */
209
-    public static function create( $year = 2000, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0 )
209
+    public static function create($year = 2000, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0)
210 210
     {
211 211
 
212 212
         /**
213 213
        * When we want to set a Datetime object to Datium
214 214
        */
215
-        if(func_num_args() === 1 ) {
215
+        if (func_num_args() === 1) {
216 216
 
217 217
             self::$static_date_time = func_get_arg(0);
218 218
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
     *
246 246
     * @return object
247 247
     */
248
-    public static function between( $date_start, $date_end )
248
+    public static function between($date_start, $date_end)
249 249
     {
250 250
 
251 251
         self::$date_start = $date_start;
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
    *
266 266
    * @return $object
267 267
    */
268
-    public function from( $calendar )
268
+    public function from($calendar)
269 269
     {
270 270
 
271 271
         $this->convert = new Convert($this->date_time);
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
     *
292 292
     * @return object
293 293
     */
294
-    public function to( $calendar )
294
+    public function to($calendar)
295 295
     {
296 296
 
297 297
         $this->convert = new Convert($this->date_time);
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
    *
319 319
    * @return object
320 320
    */
321
-    public static function diff( $start, $end )
321
+    public static function diff($start, $end)
322 322
     {
323 323
 
324 324
         return date_diff($start, $end);
@@ -332,19 +332,19 @@  discard block
 block discarded – undo
332 332
    *
333 333
    * @return object
334 334
    */
335
-    public function add( $value )
335
+    public function add($value)
336 336
     {
337 337
 
338 338
         $this->date_interval_expression = str_replace(
339
-            $this->config[ 'date_simple' ],
340
-            $this->config[ 'date_interval' ],
339
+            $this->config['date_simple'],
340
+            $this->config['date_interval'],
341 341
             $value
342 342
         );
343 343
 
344 344
         $this->date_interval_expression = str_replace(
345 345
             ' ',
346 346
             '',
347
-            'P' . $this->date_interval_expression
347
+            'P'.$this->date_interval_expression
348 348
         );
349 349
 
350 350
         $this->date_time->add(
@@ -362,19 +362,19 @@  discard block
 block discarded – undo
362 362
    *
363 363
    * @return obejct
364 364
    */
365
-    public function sub( $value )
365
+    public function sub($value)
366 366
     {
367 367
 
368 368
         $this->date_interval_expression = str_replace(
369
-            $this->config[ 'date_simple' ],
370
-            $this->config[ 'date_interval' ],
369
+            $this->config['date_simple'],
370
+            $this->config['date_interval'],
371 371
             $value
372 372
         );
373 373
 
374 374
         $this->date_interval_expression = str_replace(
375 375
             ' ',
376 376
             '',
377
-            'P' . $this->date_interval_expression
377
+            'P'.$this->date_interval_expression
378 378
         );
379 379
 
380 380
         $this->date_time->sub(
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
    *
393 393
    * @return boolean
394 394
    */
395
-    public function leap( $type = 'gregorian' )
395
+    public function leap($type = 'gregorian')
396 396
     {
397 397
 
398 398
         $this->leap = new Leap($this->date_time->format('Y'), $type);
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
     *
456 456
     * @return object
457 457
     */
458
-    public function lang( $language = 'fa' )
458
+    public function lang($language = 'fa')
459 459
     {
460 460
 
461 461
         $this->language = $language;
@@ -479,65 +479,65 @@  discard block
 block discarded – undo
479 479
    *
480 480
    * @return string
481 481
    */
482
-    public function get( $format = 'Y-m-d H:i:s' )
482
+    public function get($format = 'Y-m-d H:i:s')
483 483
     {
484 484
 
485 485
         // $this->translate_from_file = include( 'Lang/en/general.php' );
486 486
         //
487 487
         // $this->translate_to_file = include( 'Lang/' . $this->language . '/general.php' );
488 488
 
489
-        if (is_null($this->fromConfig) ) {
489
+        if (is_null($this->fromConfig)) {
490 490
 
491
-            $this->fromConfig = include 'CalendarSettings/' .
492
-                                ucfirst($this->translate_from) . '.php';
491
+            $this->fromConfig = include 'CalendarSettings/'.
492
+                                ucfirst($this->translate_from).'.php';
493 493
 
494 494
         }
495 495
 
496 496
 
497
-        if (is_null($this->toConfig) ) {
497
+        if (is_null($this->toConfig)) {
498 498
 
499
-            $this->toConfig = include 'CalendarSettings/' .
500
-                                       ucfirst($this->translate_to) . '.php';
499
+            $this->toConfig = include 'CalendarSettings/'.
500
+                                       ucfirst($this->translate_to).'.php';
501 501
 
502 502
         }
503 503
 
504 504
         $string_date = $this->date_time->format($format);
505 505
 
506
-        if ($this->translate_to != 'gregorian' ) {
506
+        if ($this->translate_to != 'gregorian') {
507 507
 
508 508
             $string_date = str_replace(
509
-                $this->fromConfig[ 'month' ],
510
-                $this->toConfig[ 'month' ],
509
+                $this->fromConfig['month'],
510
+                $this->toConfig['month'],
511 511
                 $string_date
512 512
             );
513 513
 
514 514
             $string_date = str_replace(
515
-                $this->fromConfig[ 'days_of_week' ],
516
-                $this->toConfig[ 'days_of_week' ][ $this->gregorian_DayofWeek ],
515
+                $this->fromConfig['days_of_week'],
516
+                $this->toConfig['days_of_week'][$this->gregorian_DayofWeek],
517 517
                 $string_date
518 518
             );
519 519
 
520 520
             $string_date = str_replace(
521
-                $this->fromConfig[ 'numbers' ],
522
-                $this->toConfig[ 'numbers' ],
521
+                $this->fromConfig['numbers'],
522
+                $this->toConfig['numbers'],
523 523
                 $string_date
524 524
             );
525 525
 
526 526
             $string_date = str_replace(
527
-                $this->fromConfig[ 'am_time' ],
528
-                $this->toConfig[ 'am_time' ],
527
+                $this->fromConfig['am_time'],
528
+                $this->toConfig['am_time'],
529 529
                 $string_date
530 530
             );
531 531
 
532 532
             $string_date = str_replace(
533
-                $this->fromConfig[ 'pm_time' ],
534
-                $this->toConfig[ 'pm_time' ],
533
+                $this->fromConfig['pm_time'],
534
+                $this->toConfig['pm_time'],
535 535
                 $string_date
536 536
             );
537 537
 
538 538
             $string_date = str_replace(
539
-                $this->fromConfig[ 'end_of_days' ],
540
-                $this->toConfig[ 'end_of_days' ],
539
+                $this->fromConfig['end_of_days'],
540
+                $this->toConfig['end_of_days'],
541 541
                 $string_date
542 542
             );
543 543
 
Please login to merge, or discard this patch.
src/Events/Events.php 3 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -58,6 +58,10 @@
 block discarded – undo
58 58
     *
59 59
     *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
60 60
     */
61
+
62
+    /**
63
+     * @param string $path
64
+     */
61 65
     private function fetch( $path ) 
62 66
     {
63 67
 
Please login to merge, or discard this patch.
Switch Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -143,19 +143,19 @@
 block discarded – undo
143 143
 
144 144
                 switch ( $this->local[ 'default_calendar' ] ) {
145 145
 
146
-                case 'jalali':
146
+                  case 'jalali':
147 147
 
148
-                    $this->date_time->setDate(1394, $month, $day);
148
+                      $this->date_time->setDate(1394, $month, $day);
149 149
 
150
-                    $this->date_time = Datium::create($this->date_time)->from('jalali')->to('gregorian')->object(); //$this->convert->jalaliToGregorian( $this->date_time );
150
+                      $this->date_time = Datium::create($this->date_time)->from('jalali')->to('gregorian')->object(); //$this->convert->jalaliToGregorian( $this->date_time );
151 151
 
152
-                    break;
152
+                      break;
153 153
 
154
-                case 'hijri':
154
+                  case 'hijri':
155 155
 
156
-                    $this->date_time = Datium::create($this->date_time)->from('hijri')->to('gregorian')->object(); // $this->convert->hijriToGregorian( $this->date_time );
156
+                      $this->date_time = Datium::create($this->date_time)->from('hijri')->to('gregorian')->object(); // $this->convert->hijriToGregorian( $this->date_time );
157 157
 
158
-                    break;
158
+                      break;
159 159
 
160 160
                 }
161 161
 
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
 
28 28
     private static $date_end;
29 29
 
30
-    public function __construct( $date_time, $date_end = null ) 
30
+    public function __construct($date_time, $date_end = null) 
31 31
     {
32 32
 
33
-        if($date_end !== null ) {
33
+        if ($date_end !== null) {
34 34
 
35 35
             Events::$date_start = $date_time;
36 36
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
     *
59 59
     *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
60 60
     */
61
-    private function fetch( $path ) 
61
+    private function fetch($path) 
62 62
     {
63 63
 
64 64
         $this->events = include $path;
@@ -67,11 +67,11 @@  discard block
 block discarded – undo
67 67
 
68 68
         $this->period = new DatePeriod(Events::$date_start, $this->interval, Events::$date_end);
69 69
 
70
-        foreach ( $this->period as $dt ) {
70
+        foreach ($this->period as $dt) {
71 71
 
72
-            if (isset($this->events[ 'events' ][ intval($dt->format('m')) ][ intval($dt->format('d')) ]) ) {
72
+            if (isset($this->events['events'][intval($dt->format('m'))][intval($dt->format('d'))])) {
73 73
 
74
-                $this->result[ $dt->format('Y-m-d') ][] = $this->events[ 'events' ][ intval($dt->format('m')) ][ intval($dt->format('d')) ];
74
+                $this->result[$dt->format('Y-m-d')][] = $this->events['events'][intval($dt->format('m'))][intval($dt->format('d'))];
75 75
 
76 76
             }
77 77
 
@@ -91,13 +91,13 @@  discard block
 block discarded – undo
91 91
     public function get() 
92 92
     {
93 93
 
94
-        if(! empty($this->result) ) {
94
+        if ( ! empty($this->result)) {
95 95
 
96
-            foreach( $this->result as $key => $day ) {
96
+            foreach ($this->result as $key => $day) {
97 97
 
98
-                if (! ( $key > Events::$date_start->format('Y-m-d') && $key < Events::$date_end->format('Y-m-d') ) ) {
98
+                if ( ! ($key > Events::$date_start->format('Y-m-d') && $key < Events::$date_end->format('Y-m-d'))) {
99 99
 
100
-                    unset($this->result[ $key ]);
100
+                    unset($this->result[$key]);
101 101
 
102 102
                 }
103 103
 
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
     *
123 123
     *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
124 124
     */
125
-    public function local( $country_code = "ir" ) 
125
+    public function local($country_code = "ir") 
126 126
     {
127 127
 
128 128
         /*
@@ -131,17 +131,17 @@  discard block
 block discarded – undo
131 131
          */
132 132
         $country_code = strtolower($country_code = 'ir');
133 133
 
134
-        $this->local = include 'Localization/' . $country_code . '.php';
134
+        $this->local = include 'Localization/'.$country_code.'.php';
135 135
 
136
-        foreach( $this->local[ 'events' ] as $month => $events ) {
136
+        foreach ($this->local['events'] as $month => $events) {
137 137
 
138
-            foreach( $events as $day => $event ){
138
+            foreach ($events as $day => $event) {
139 139
 
140 140
                 $this->date_time = new DateTime();
141 141
 
142 142
                 $this->date_time->setDate(Events::$date_start->format('Y'), $month, $day);
143 143
 
144
-                switch ( $this->local[ 'default_calendar' ] ) {
144
+                switch ($this->local['default_calendar']) {
145 145
 
146 146
                 case 'jalali':
147 147
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 
160 160
                 }
161 161
 
162
-                $this->result[ $this->date_time->format('Y-m-d') ][] =  $event;
162
+                $this->result[$this->date_time->format('Y-m-d')][] = $event;
163 163
 
164 164
             }
165 165
 
Please login to merge, or discard this patch.
test.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 use OpenCafe\Datium as Datium;
3 3
 use OpenCafe\Tools\Convert as Covnert;
4
-try{
4
+try {
5 5
     include_once 'vendor/autoload.php';
6 6
     var_dump("-----------------------[ Test Start ]-------------------------<br/>");
7 7
     // echo '<br>this year:<br>';
@@ -39,6 +39,6 @@  discard block
 block discarded – undo
39 39
     // echo 'Persian calendar:';
40 40
     // var_dump( Datium::now()->lang('fa')->get( 'l jS F Y h:i:s A' ) );
41 41
     var_dump("-----------------------[ Test End ]-------------------------<br/>");
42
-} catch (Exception $e ) {
42
+} catch (Exception $e) {
43 43
     var_dump($e);
44 44
 }
Please login to merge, or discard this patch.
src/Leap.php 3 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -7,42 +7,42 @@  discard block
 block discarded – undo
7 7
 {
8 8
 
9 9
     /**
10
-   * @param integer store year value
11
-   */
10
+     * @param integer store year value
11
+     */
12 12
     protected $year;
13 13
 
14 14
     /**
15
-   * @param string store type of year value
16
-   */
15
+     * @param string store type of year value
16
+     */
17 17
     protected $type;
18 18
 
19 19
     /**
20
-   * @param boolean store result of leap functions
21
-   */
20
+     * @param boolean store result of leap functions
21
+     */
22 22
     protected $result;
23 23
 
24 24
 
25 25
     /**
26
-   * @param $year integer
27
-   * @since Aug, 21 2015
28
-   */
26
+     * @param $year integer
27
+     * @since Aug, 21 2015
28
+     */
29 29
     public function __construct( $year, $type = 'gregorian' ) 
30 30
     {
31 31
 
32
-         $this->year = $year;
32
+          $this->year = $year;
33 33
 
34
-         $this->type = $type;
34
+          $this->type = $type;
35 35
 
36
-         return $this;
36
+          return $this;
37 37
 
38 38
     }
39 39
 
40 40
     /**
41
-   * check the gregorian year is leap or not
42
-   *
43
-   * @since  Oct, 24 2015
44
-   * @return boolean
45
-   */
41
+     * check the gregorian year is leap or not
42
+     *
43
+     * @since  Oct, 24 2015
44
+     * @return boolean
45
+     */
46 46
     public function gregorinLeapYear() 
47 47
     {
48 48
 
@@ -51,11 +51,11 @@  discard block
 block discarded – undo
51 51
     }
52 52
 
53 53
     /**
54
-   * check the jalali year is leap or not
55
-   *
56
-   * @since  Oct, 24 2015
57
-   * @return boolean
58
-   */
54
+     * check the jalali year is leap or not
55
+     *
56
+     * @since  Oct, 24 2015
57
+     * @return boolean
58
+     */
59 59
     public function jalaliLeapYear() 
60 60
     {
61 61
 
@@ -103,11 +103,11 @@  discard block
 block discarded – undo
103 103
     }
104 104
 
105 105
     /**
106
-   * check the hijri year is leap or not
107
-   *
108
-   * @since  Oct, 24 2015
109
-   * @return boolean
110
-   */
106
+     * check the hijri year is leap or not
107
+     *
108
+     * @since  Oct, 24 2015
109
+     * @return boolean
110
+     */
111 111
     public function hijriLeapYear() 
112 112
     {
113 113
 
@@ -122,11 +122,11 @@  discard block
 block discarded – undo
122 122
     }
123 123
 
124 124
     /**
125
-   * return the year is leap or not
126
-   *
127
-   * @since  Aug, 21 2015
128
-   * @return boolean
129
-   */
125
+     * return the year is leap or not
126
+     *
127
+     * @since  Aug, 21 2015
128
+     * @return boolean
129
+     */
130 130
     public function get() 
131 131
     {
132 132
 
Please login to merge, or discard this patch.
Switch Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -132,23 +132,23 @@
 block discarded – undo
132 132
 
133 133
         switch ( $this->type ) {
134 134
 
135
-        case 'gregorian':
135
+          case 'gregorian':
136 136
 
137
-            $this->result = $this->gregorinLeapYear();
137
+              $this->result = $this->gregorinLeapYear();
138 138
 
139
-            break;
139
+              break;
140 140
 
141
-        case 'jalali':
141
+          case 'jalali':
142 142
 
143
-            $this->result = $this->jalaliLeapYear();
143
+              $this->result = $this->jalaliLeapYear();
144 144
 
145
-            break;
145
+              break;
146 146
 
147
-        case 'hijri':
147
+          case 'hijri':
148 148
 
149
-            $this->result = $this->hijriLeapYear();
149
+              $this->result = $this->hijriLeapYear();
150 150
 
151
-            break;
151
+              break;
152 152
         }
153 153
 
154 154
         return $this->result;
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
    * @param $year integer
27 27
    * @since Aug, 21 2015
28 28
    */
29
-    public function __construct( $year, $type = 'gregorian' ) 
29
+    public function __construct($year, $type = 'gregorian') 
30 30
     {
31 31
 
32 32
          $this->year = $year;
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     public function gregorinLeapYear() 
47 47
     {
48 48
 
49
-        return ( ( ( $this->year % 4 ) == 0 ) && ( ( ( $this->year % 100 ) != 0 ) || ( ( $this->year % 400 ) == 0 ) ) );
49
+        return ((($this->year % 4) == 0) && ((($this->year % 100) != 0) || (($this->year % 400) == 0)));
50 50
 
51 51
     }
52 52
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
         $jalali_years = 0;
63 63
 
64
-        while ( $jalali_years < ( $this->year - 128 ) ) {
64
+        while ($jalali_years < ($this->year - 128)) {
65 65
 
66 66
             $jalali_years += 128;
67 67
 
@@ -72,13 +72,13 @@  discard block
 block discarded – undo
72 72
 
73 73
         $this->result -= $jalali_years;
74 74
 
75
-        if ($this->result >= 33 ) {
75
+        if ($this->result >= 33) {
76 76
 
77 77
             $this->result = $this->result % 33;
78 78
 
79 79
         }
80 80
 
81
-        if (( $this->result == 28 ) || ( $this->result == 27 ) ) {
81
+        if (($this->result == 28) || ($this->result == 27)) {
82 82
 
83 83
             return $this->result;
84 84
 
@@ -89,13 +89,13 @@  discard block
 block discarded – undo
89 89
 
90 90
         $this->result -= $jalali_years;
91 91
 
92
-        if ($this->result >= 33 ) {
92
+        if ($this->result >= 33) {
93 93
 
94 94
             $this->result = $this->result % 33;
95 95
 
96 96
         }
97 97
 
98
-        if (( ( $this->result % 4 ) == 0 ) && ( $this->result != 28 ) ) {
98
+        if ((($this->result % 4) == 0) && ($this->result != 28)) {
99 99
 
100 100
             return $this->result;
101 101
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
         $this->result = $this->year % 30;
115 115
 
116
-        if (( 2 == $this->result ) || ( 5 == $this->result ) || ( 7 == $this->result ) || ( 10 == $this->result ) || ( 13 == $this->result ) || ( 16 == $this->result ) || ( 18 == $this->result ) || ( 21 == $this->result ) || ( 24 == $this->year ) || ( 26 == $this->result ) || ( 29 == $this->result ) ) {
116
+        if ((2 == $this->result) || (5 == $this->result) || (7 == $this->result) || (10 == $this->result) || (13 == $this->result) || (16 == $this->result) || (18 == $this->result) || (21 == $this->result) || (24 == $this->year) || (26 == $this->result) || (29 == $this->result)) {
117 117
 
118 118
             return $this->result;
119 119
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
     public function get() 
131 131
     {
132 132
 
133
-        switch ( $this->type ) {
133
+        switch ($this->type) {
134 134
 
135 135
         case 'gregorian':
136 136
 
Please login to merge, or discard this patch.
src/DayOf.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -34,11 +34,11 @@  discard block
 block discarded – undo
34 34
     }
35 35
 
36 36
     /**
37
-   * Which day of year is current day.
38
-   *
39
-   * @since  Aug, 03 2015
40
-   * @return integer
41
-   */
37
+     * Which day of year is current day.
38
+     *
39
+     * @since  Aug, 03 2015
40
+     * @return integer
41
+     */
42 42
     public function year() 
43 43
     {
44 44
 
@@ -50,11 +50,11 @@  discard block
 block discarded – undo
50 50
 
51 51
 
52 52
     /**
53
-   * Which day of week is current day.
54
-   *
55
-   * @since  Aug, 09 2015
56
-   * @return integer
57
-   */
53
+     * Which day of week is current day.
54
+     *
55
+     * @since  Aug, 09 2015
56
+     * @return integer
57
+     */
58 58
     public function week() 
59 59
     {
60 60
 
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 
21 21
     protected $geregorian_DayofWeek;
22 22
 
23
-    public function __construct( $date_time, $calendar_type = 'gregorian' ) 
23
+    public function __construct($date_time, $calendar_type = 'gregorian') 
24 24
     {
25 25
 
26 26
         $this->config = include 'Config.php';
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
     public function year() 
43 43
     {
44 44
 
45
-        $this->config = include 'CalendarSettings/' . ucfirst($this->calendar_type) . '.php';
45
+        $this->config = include 'CalendarSettings/'.ucfirst($this->calendar_type).'.php';
46 46
 
47
-        return $this->config[ 'day_of_year' ]( $this->date_time );
47
+        return $this->config['day_of_year']($this->date_time);
48 48
 
49 49
     }
50 50
 
@@ -58,9 +58,9 @@  discard block
 block discarded – undo
58 58
     public function week() 
59 59
     {
60 60
 
61
-        $this->config = include 'CalendarSettings/' . ucfirst($this->calendar_type) . '.php';
61
+        $this->config = include 'CalendarSettings/'.ucfirst($this->calendar_type).'.php';
62 62
 
63
-        return $this->config[ 'day_of_week' ]( $this->date_time );
63
+        return $this->config['day_of_week']($this->date_time);
64 64
 
65 65
     }
66 66
 
Please login to merge, or discard this patch.
src/CalendarSettings/Gregorian.php 2 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -1,20 +1,20 @@  discard block
 block discarded – undo
1 1
 ``<?php
2 2
 
3
- use OpenCafe\Datium as Datium;
3
+  use OpenCafe\Datium as Datium;
4 4
 
5
- return array (
5
+  return array (
6 6
 
7
- 'numbers' => array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'),
7
+  'numbers' => array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'),
8 8
 
9
- 'am_time' => 'AM',
9
+  'am_time' => 'AM',
10 10
 
11
- 'pm_time' => 'PM',
11
+  'pm_time' => 'PM',
12 12
 
13
- 'end_of_days' => array( 'th', 'st', 'nd', 'rd' ),
13
+  'end_of_days' => array( 'th', 'st', 'nd', 'rd' ),
14 14
 
15 15
 
16 16
 
17
- /************************************************************
17
+  /************************************************************
18 18
   *                        Convert to
19 19
   ************************************************************
20 20
   *
@@ -22,11 +22,11 @@  discard block
 block discarded – undo
22 22
   *
23 23
   *\_________________________________________________________/
24 24
   */
25
-   'convert_to' => function ( $date_time ) {
25
+    'convert_to' => function ( $date_time ) {
26 26
 
27
-     return null;
27
+      return null;
28 28
 
29
-   },
29
+    },
30 30
 
31 31
     /************************************************************
32 32
     *                        Convert From
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 
87 87
       'December'
88 88
 
89
-     ),
89
+      ),
90 90
 
91 91
     /************************************************************
92 92
     *                        Days of Week
@@ -99,28 +99,28 @@  discard block
 block discarded – undo
99 99
     */
100 100
     'days_of_week' => array (
101 101
 
102
-       'Monday',
103
-       'Tuesday',
104
-       'Wednesday',
105
-       'Thursday',
106
-       'Friday',
107
-       'Saturday',
108
-       'Sunday',
102
+        'Monday',
103
+        'Tuesday',
104
+        'Wednesday',
105
+        'Thursday',
106
+        'Friday',
107
+        'Saturday',
108
+        'Sunday',
109 109
     ),
110 110
 
111 111
 
112 112
     'month_days_number' => array(   1 => 31,
113
-                                   2 => 28,
114
-                                   3 => 31,
115
-                                   4 => 30,
116
-                                   5 => 31,
117
-                                   6 => 30,
118
-                                   7 => 31,
119
-                                   8 => 31,
120
-                                   9 => 30,
121
-                                   10 => 31,
122
-                                   11 => 30,
123
-                                   12 => 30 ),
113
+                                    2 => 28,
114
+                                    3 => 31,
115
+                                    4 => 30,
116
+                                    5 => 31,
117
+                                    6 => 30,
118
+                                    7 => 31,
119
+                                    8 => 31,
120
+                                    9 => 30,
121
+                                    10 => 31,
122
+                                    11 => 30,
123
+                                    12 => 30 ),
124 124
 
125 125
 
126 126
     'day_of_year' => function ( $date_time ) {
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -2,15 +2,15 @@  discard block
 block discarded – undo
2 2
 
3 3
  use OpenCafe\Datium as Datium;
4 4
 
5
- return array (
5
+ return array(
6 6
 
7
- 'numbers' => array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'),
7
+ 'numbers' => array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9'),
8 8
 
9 9
  'am_time' => 'AM',
10 10
 
11 11
  'pm_time' => 'PM',
12 12
 
13
- 'end_of_days' => array( 'th', 'st', 'nd', 'rd' ),
13
+ 'end_of_days' => array('th', 'st', 'nd', 'rd'),
14 14
 
15 15
 
16 16
 
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
   *
23 23
   *\_________________________________________________________/
24 24
   */
25
-   'convert_to' => function ( $date_time ) {
25
+   'convert_to' => function($date_time) {
26 26
 
27 27
      return null;
28 28
 
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     *
37 37
     *\_________________________________________________________/
38 38
     */
39
-    'convert_from' => function ( $date_time ) {
39
+    'convert_from' => function($date_time) {
40 40
 
41 41
         return null;
42 42
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
     *
98 98
     *\_________________________________________________________/
99 99
     */
100
-    'days_of_week' => array (
100
+    'days_of_week' => array(
101 101
 
102 102
        'Monday',
103 103
        'Tuesday',
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
     ),
110 110
 
111 111
 
112
-    'month_days_number' => array(   1 => 31,
112
+    'month_days_number' => array(1 => 31,
113 113
                                    2 => 28,
114 114
                                    3 => 31,
115 115
                                    4 => 30,
@@ -120,10 +120,10 @@  discard block
 block discarded – undo
120 120
                                    9 => 30,
121 121
                                    10 => 31,
122 122
                                    11 => 30,
123
-                                   12 => 30 ),
123
+                                   12 => 30),
124 124
 
125 125
 
126
-    'day_of_year' => function ( $date_time ) {
126
+    'day_of_year' => function($date_time) {
127 127
 
128 128
         $result = null;
129 129
 
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
 
136 136
         $day = $date_time->format('d');
137 137
 
138
-        foreach( $config['month_days_number'] as $_month => $value ) {
138
+        foreach ($config['month_days_number'] as $_month => $value) {
139 139
 
140
-            if ($_month < $month ) { $result += $value; 
140
+            if ($_month < $month) { $result += $value; 
141 141
             }
142 142
 
143 143
         }
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 
149 149
     },
150 150
 
151
-    'day_of_week' => function ( $date_time ) {
151
+    'day_of_week' => function($date_time) {
152 152
 
153 153
         $config = include 'Gregorian.php';
154 154
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 
157 157
         foreach ($config['days_of_week'] as $key => $value) {
158 158
 
159
-            if ($value == $day ) { return $key += 1; 
159
+            if ($value == $day) { return $key += 1; 
160 160
             }
161 161
 
162 162
         }
@@ -181,6 +181,6 @@  discard block
 block discarded – undo
181 181
     *
182 182
     *\_________________________________________________________/
183 183
     */
184
-    'weekend' => array( 'saturday', 'sunday' ),
184
+    'weekend' => array('saturday', 'sunday'),
185 185
 
186 186
   );
Please login to merge, or discard this patch.
src/CalendarSettings/Hijri.php 2 patches
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -3,9 +3,9 @@  discard block
 block discarded – undo
3 3
 use OpenCafe\Datium as Datium;
4 4
 use OpenCafe\Tools\Leap as Leap;
5 5
 
6
- return array (
6
+  return array (
7 7
 
8
- /************************************************************
8
+  /************************************************************
9 9
   *                        Convert to
10 10
   ************************************************************
11 11
   *
@@ -13,19 +13,19 @@  discard block
 block discarded – undo
13 13
   *
14 14
   *\_________________________________________________________/
15 15
   */
16
-   'convert_to' => function ( $date_time ) {
16
+    'convert_to' => function ( $date_time ) {
17 17
 
18
-     $config = include 'Jalali.php';
18
+      $config = include 'Jalali.php';
19 19
 
20
-     $date_time = Datium::create($date_time)->to('jalali')->object();
20
+      $date_time = Datium::create($date_time)->to('jalali')->object();
21 21
 
22
-     $year = $date_time->format('Y');
22
+      $year = $date_time->format('Y');
23 23
 
24
-     $month = $date_time->format('n');
24
+      $month = $date_time->format('n');
25 25
 
26
-     $day = $date_time->format('d');
26
+      $day = $date_time->format('d');
27 27
 
28
-     $temp_day = 0 ;
28
+      $temp_day = 0 ;
29 29
 
30 30
     for ( $i = 1 ; $i < $month ; $i++ ) {
31 31
 
@@ -40,13 +40,13 @@  discard block
 block discarded – undo
40 40
     if($leap->get() && $month > 11 ) { $temp_day++; 
41 41
     }
42 42
 
43
-     $_year = ( ( ( ( ( $year - 1 ) * 365.2422 ) + $temp_day ) - 119) / 354.3670 ) + 1;
43
+      $_year = ( ( ( ( ( $year - 1 ) * 365.2422 ) + $temp_day ) - 119) / 354.3670 ) + 1;
44 44
 
45
-     $_year = explode('.', $_year);
45
+      $_year = explode('.', $_year);
46 46
 
47
-     $year = $_year[0];
47
+      $year = $_year[0];
48 48
 
49
-     $_month = $_year[1];
49
+      $_month = $_year[1];
50 50
 
51 51
       $var_temp = '0.0';
52 52
 
@@ -58,17 +58,17 @@  discard block
 block discarded – undo
58 58
 
59 59
       $var_temp .= '1';
60 60
 
61
-     $_month = $_month * $var_temp ;
61
+      $_month = $_month * $var_temp ;
62 62
 
63
-     $_month = ( $_month * 12 ) + 1;
63
+      $_month = ( $_month * 12 ) + 1;
64 64
 
65
-     $_month = explode('.', $_month);
65
+      $_month = explode('.', $_month);
66 66
 
67
-     $month = $_month[0];
67
+      $month = $_month[0];
68 68
 
69
-     $_day = $_month[1];
69
+      $_day = $_month[1];
70 70
 
71
-     $var_temp = '0.0';
71
+      $var_temp = '0.0';
72 72
 
73 73
     for ( $i = strlen($_day);  $i > 2;  $i-- ) {
74 74
 
@@ -76,21 +76,21 @@  discard block
 block discarded – undo
76 76
 
77 77
     }
78 78
 
79
-     $var_temp .= '1';
79
+      $var_temp .= '1';
80 80
 
81
-     $_day = $_day * $var_temp;
81
+      $_day = $_day * $var_temp;
82 82
 
83
-     $_day = ( $_day * 29.530 );
83
+      $_day = ( $_day * 29.530 );
84 84
 
85
-     $_day = explode('.', $_day);
85
+      $_day = explode('.', $_day);
86 86
 
87
-     $day = $_day[0];
87
+      $day = $_day[0];
88 88
 
89 89
     $date_time->setDate($year, $month, $day);
90 90
 
91 91
     return $date_time;
92 92
 
93
-   },
93
+    },
94 94
 
95 95
     /************************************************************
96 96
     *                        Convert From
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 
201 201
         'Dhu al_Hijjah'
202 202
 
203
-     ),
203
+      ),
204 204
 
205 205
     /************************************************************
206 206
     *                        Days of Week
@@ -212,13 +212,13 @@  discard block
 block discarded – undo
212 212
     *\_________________________________________________________/
213 213
     */
214 214
     'days_of_week' => array (
215
-         'al-Aḥad',
216
-         'al-Ithnayn',
217
-         'ath-Thulatha\'',
218
-         'al-Arbi\'a',
219
-         'al-Khamees',
220
-         'al-Jumu\'ah',
221
-         'as-Sabt',
215
+          'al-Aḥad',
216
+          'al-Ithnayn',
217
+          'ath-Thulatha\'',
218
+          'al-Arbi\'a',
219
+          'al-Khamees',
220
+          'al-Jumu\'ah',
221
+          'as-Sabt',
222 222
 
223 223
     ),
224 224
 
@@ -234,17 +234,17 @@  discard block
 block discarded – undo
234 234
 
235 235
 
236 236
     'month_days_number' => array(     1 => 30,
237
-                                     2 => 29,
238
-                                     3 => 30,
239
-                                     4 => 30,
240
-                                     5 => 29,
241
-                                     6 => 29,
242
-                                     7 => 30,
243
-                                     8 => 29,
244
-                                     9 => 30,
245
-                                     10 => 29,
246
-                                     11 => 30,
247
-                                     12 => 30 ),
237
+                                      2 => 29,
238
+                                      3 => 30,
239
+                                      4 => 30,
240
+                                      5 => 29,
241
+                                      6 => 29,
242
+                                      7 => 30,
243
+                                      8 => 29,
244
+                                      9 => 30,
245
+                                      10 => 29,
246
+                                      11 => 30,
247
+                                      12 => 30 ),
248 248
     /************************************************************
249 249
     *                      Day of year
250 250
     ************************************************************
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
     *
254 254
     *\_________________________________________________________/
255 255
     */
256
-     'day_of_year' => function ( $date_time ) {
256
+      'day_of_year' => function ( $date_time ) {
257 257
 
258 258
         $result = null;
259 259
 
@@ -277,9 +277,9 @@  discard block
 block discarded – undo
277 277
 
278 278
         return $result;
279 279
 
280
-     },
280
+      },
281 281
 
282
-     /************************************************************
282
+      /************************************************************
283 283
       *                      Day of week
284 284
       ************************************************************
285 285
       *
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
       *  example : al-Aḥad = result is 1
288 288
       *\_________________________________________________________/
289 289
       */
290
-     'day_of_week' => function ( $date_time ) {
290
+      'day_of_week' => function ( $date_time ) {
291 291
 
292 292
         $configGhamari = include 'Hijri.php';
293 293
 
@@ -307,9 +307,9 @@  discard block
 block discarded – undo
307 307
 
308 308
         }
309 309
 
310
-     },
310
+      },
311 311
 
312
-     /************************************************************
312
+      /************************************************************
313 313
       *                       Leap year
314 314
       ************************************************************
315 315
       *
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
       *
318 318
       *\_________________________________________________________/
319 319
       */
320
-     'leap_year' => null,
320
+      'leap_year' => null,
321 321
 
322 322
     /************************************************************
323 323
     *                        Weekend
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 use OpenCafe\Datium as Datium;
4 4
 use OpenCafe\Tools\Leap as Leap;
5 5
 
6
- return array (
6
+ return array(
7 7
 
8 8
  /************************************************************
9 9
   *                        Convert to
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
   *
14 14
   *\_________________________________________________________/
15 15
   */
16
-   'convert_to' => function ( $date_time ) {
16
+   'convert_to' => function($date_time) {
17 17
 
18 18
      $config = include 'Jalali.php';
19 19
 
@@ -25,11 +25,11 @@  discard block
 block discarded – undo
25 25
 
26 26
      $day = $date_time->format('d');
27 27
 
28
-     $temp_day = 0 ;
28
+     $temp_day = 0;
29 29
 
30
-    for ( $i = 1 ; $i < $month ; $i++ ) {
30
+    for ($i = 1; $i < $month; $i++) {
31 31
 
32
-        $temp_day += $config[ 'month_days_number' ][ $i ];
32
+        $temp_day += $config['month_days_number'][$i];
33 33
 
34 34
     }
35 35
 
@@ -37,10 +37,10 @@  discard block
 block discarded – undo
37 37
 
38 38
       $leap = new Leap($year);
39 39
 
40
-    if($leap->get() && $month > 11 ) { $temp_day++; 
40
+    if ($leap->get() && $month > 11) { $temp_day++; 
41 41
     }
42 42
 
43
-     $_year = ( ( ( ( ( $year - 1 ) * 365.2422 ) + $temp_day ) - 119) / 354.3670 ) + 1;
43
+     $_year = ((((($year - 1) * 365.2422) + $temp_day) - 119) / 354.3670) + 1;
44 44
 
45 45
      $_year = explode('.', $_year);
46 46
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
       $var_temp = '0.0';
52 52
 
53
-    for ( $i = strlen($_month); $i > 2; $i-- ) {
53
+    for ($i = strlen($_month); $i > 2; $i--) {
54 54
 
55 55
         $var_temp .= '0';
56 56
 
@@ -58,9 +58,9 @@  discard block
 block discarded – undo
58 58
 
59 59
       $var_temp .= '1';
60 60
 
61
-     $_month = $_month * $var_temp ;
61
+     $_month = $_month * $var_temp;
62 62
 
63
-     $_month = ( $_month * 12 ) + 1;
63
+     $_month = ($_month * 12) + 1;
64 64
 
65 65
      $_month = explode('.', $_month);
66 66
 
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
 
71 71
      $var_temp = '0.0';
72 72
 
73
-    for ( $i = strlen($_day);  $i > 2;  $i-- ) {
73
+    for ($i = strlen($_day); $i > 2; $i--) {
74 74
 
75
-        $var_temp .= '0' ;
75
+        $var_temp .= '0';
76 76
 
77 77
     }
78 78
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
      $_day = $_day * $var_temp;
82 82
 
83
-     $_day = ( $_day * 29.530 );
83
+     $_day = ($_day * 29.530);
84 84
 
85 85
      $_day = explode('.', $_day);
86 86
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
     *
101 101
     *\_________________________________________________________/
102 102
     */
103
-    'convert_from' => function ( $date_time ) {
103
+    'convert_from' => function($date_time) {
104 104
 
105 105
         $config = include 'Hijri.php';
106 106
 
@@ -112,32 +112,32 @@  discard block
 block discarded – undo
112 112
 
113 113
         $days_of_year = 0;
114 114
 
115
-        foreach ( $config['month_days_number'] as $month => $value ) {
115
+        foreach ($config['month_days_number'] as $month => $value) {
116 116
 
117
-            if($month > $month ) { $days_of_year += $value; 
117
+            if ($month > $month) { $days_of_year += $value; 
118 118
             }
119 119
 
120 120
         }
121 121
 
122 122
         $days_of_year += $day;
123 123
 
124
-        $days_of_leap_years =  intval(( ( $year - 1 ) / 3 ));
124
+        $days_of_leap_years = intval((($year - 1) / 3));
125 125
 
126
-        $days_of_ghamari_years = ( ( ( $year - 1 ) * 354 ) + $days_of_year + $days_of_leap_years );
126
+        $days_of_ghamari_years = ((($year - 1) * 354) + $days_of_year + $days_of_leap_years);
127 127
 
128 128
         $days_of_gregorain_years = $days_of_ghamari_years + 227078;
129 129
 
130
-        $days_of_gregorain_years = $days_of_gregorain_years - intval(( ( $year + 578 ) / 4 ));
130
+        $days_of_gregorain_years = $days_of_gregorain_years - intval((($year + 578) / 4));
131 131
 
132
-        $gregorian_month = ( $days_of_gregorain_years % 365 );
132
+        $gregorian_month = ($days_of_gregorain_years % 365);
133 133
 
134 134
         $gregorian_year = intval($days_of_gregorain_years / 365) + 1;
135 135
 
136 136
         $config = include 'Gregorian.php';
137 137
 
138
-        foreach ($config [ 'month_days_number' ] as $month => $value) {
138
+        foreach ($config ['month_days_number'] as $month => $value) {
139 139
 
140
-            if ($gregorian_month < $value ) {
140
+            if ($gregorian_month < $value) {
141 141
 
142 142
                 break;
143 143
             }
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
     *
175 175
     *\_________________________________________________________/
176 176
     */
177
-    'month' => array (
177
+    'month' => array(
178 178
 
179 179
         'Muharram',
180 180
 
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
     *
212 212
     *\_________________________________________________________/
213 213
     */
214
-    'days_of_week' => array (
214
+    'days_of_week' => array(
215 215
          'al-Aḥad',
216 216
          'al-Ithnayn',
217 217
          'ath-Thulatha\'',
@@ -222,18 +222,18 @@  discard block
 block discarded – undo
222 222
 
223 223
     ),
224 224
 
225
-    'numbers' => array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'),
225
+    'numbers' => array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9'),
226 226
 
227 227
     'am_time' => 'AM',
228 228
 
229 229
     'pm_time' => 'PM',
230 230
 
231
-    'end_of_days' => array( 'th', 'st', 'nd', 'rd' ),
231
+    'end_of_days' => array('th', 'st', 'nd', 'rd'),
232 232
 
233 233
 
234 234
 
235 235
 
236
-    'month_days_number' => array(     1 => 30,
236
+    'month_days_number' => array(1 => 30,
237 237
                                      2 => 29,
238 238
                                      3 => 30,
239 239
                                      4 => 30,
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
                                      9 => 30,
245 245
                                      10 => 29,
246 246
                                      11 => 30,
247
-                                     12 => 30 ),
247
+                                     12 => 30),
248 248
     /************************************************************
249 249
     *                      Day of year
250 250
     ************************************************************
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
     *
254 254
     *\_________________________________________________________/
255 255
     */
256
-     'day_of_year' => function ( $date_time ) {
256
+     'day_of_year' => function($date_time) {
257 257
 
258 258
         $result = null;
259 259
 
@@ -263,9 +263,9 @@  discard block
 block discarded – undo
263 263
 
264 264
         $day = $date_time->format('d');
265 265
 
266
-        foreach( $config['month_days_number'] as $_month => $value ) {
266
+        foreach ($config['month_days_number'] as $_month => $value) {
267 267
 
268
-            if ($_month < $month ) {
268
+            if ($_month < $month) {
269 269
 
270 270
                 $result += $value;
271 271
 
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
       *  example : al-Aḥad = result is 1
288 288
       *\_________________________________________________________/
289 289
       */
290
-     'day_of_week' => function ( $date_time ) {
290
+     'day_of_week' => function($date_time) {
291 291
 
292 292
         $configGhamari = include 'Hijri.php';
293 293
 
@@ -297,9 +297,9 @@  discard block
 block discarded – undo
297 297
 
298 298
         $day = str_replace($configGregorian['days_of_week'], $configGhamari['days_of_week'], $day);
299 299
 
300
-        foreach ( $configGhamari['days_of_week'] as $key => $value ) {
300
+        foreach ($configGhamari['days_of_week'] as $key => $value) {
301 301
 
302
-            if($value == $day ) {
302
+            if ($value == $day) {
303 303
 
304 304
                 return $key += 1;
305 305
 
@@ -327,6 +327,6 @@  discard block
 block discarded – undo
327 327
     *
328 328
     *\_________________________________________________________/
329 329
     */
330
-    'weekend' => array( 'friday', 'saturday' ),
330
+    'weekend' => array('friday', 'saturday'),
331 331
 
332 332
   );
Please login to merge, or discard this patch.
src/CalendarSettings/Jalali.php 3 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
 
48 48
     }
49 49
 
50
-         $temp_day += $day;
50
+          $temp_day += $day;
51 51
 
52
-         $leap = new Leap($year);
52
+          $leap = new Leap($year);
53 53
 
54 54
     if ($leap->get() && $month > 2 ) { $temp_day++; 
55 55
     }
@@ -134,9 +134,9 @@  discard block
 block discarded – undo
134 134
 
135 135
     }
136 136
 
137
-         $date_time->setDate($year, $month, $day);
137
+          $date_time->setDate($year, $month, $day);
138 138
 
139
-         return $date_time;
139
+          return $date_time;
140 140
 
141 141
   },
142 142
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
       $date_time->setDate($gregorian_year, $gregorian_month, $gregorian_day);
209 209
 
210 210
 
211
-     return $date_time;
211
+      return $date_time;
212 212
 
213 213
   },
214 214
 
@@ -271,30 +271,30 @@  discard block
 block discarded – undo
271 271
 
272 272
   'days_of_week' => array (
273 273
 
274
-     'Yekshanbe',
275
-     'Doshanbe',
276
-     'Seshanbe',
277
-     'Chaharshanbe',
278
-     'Panjshanbe',
279
-     'Jome',
280
-     'Shanbe',
274
+      'Yekshanbe',
275
+      'Doshanbe',
276
+      'Seshanbe',
277
+      'Chaharshanbe',
278
+      'Panjshanbe',
279
+      'Jome',
280
+      'Shanbe',
281 281
 
282 282
   ),
283 283
 
284 284
   'start_day_of_week' => 'Shanbe',
285 285
 
286 286
   'month_days_number' => array(      1 => 31,
287
-                                     2 => 31,
288
-                                     3 => 31,
289
-                                     4 => 31,
290
-                                     5 => 31,
291
-                                     6 => 31,
292
-                                     7 => 30,
293
-                                     8 => 30,
294
-                                     9 => 30,
295
-                                     10 => 30,
296
-                                     11 => 30,
297
-                                     12 => 29 ),
287
+                                      2 => 31,
288
+                                      3 => 31,
289
+                                      4 => 31,
290
+                                      5 => 31,
291
+                                      6 => 31,
292
+                                      7 => 30,
293
+                                      8 => 30,
294
+                                      9 => 30,
295
+                                      10 => 30,
296
+                                      11 => 30,
297
+                                      12 => 29 ),
298 298
 
299 299
   /************************************************************
300 300
   *                      Day of year
@@ -378,4 +378,4 @@  discard block
 block discarded – undo
378 378
    */
379 379
   'weekend' => array( 'friday' )
380 380
 
381
- );
381
+  );
Please login to merge, or discard this patch.
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 use OpenCafe\Datium as Datium;
4 4
 use OpenCafe\Tools\Leap as Leap;
5 5
 
6
-return array (
6
+return array(
7 7
 
8 8
   'timezone' => 'Asia/Tehran',
9 9
 
@@ -11,13 +11,13 @@  discard block
 block discarded – undo
11 11
 
12 12
   'events' => array(),
13 13
 
14
-  'numbers' => array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'),
14
+  'numbers' => array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9'),
15 15
 
16 16
   'am_time' => 'AM',
17 17
 
18 18
   'pm_time' => 'PM',
19 19
 
20
-  'end_of_days' => array( 'th', 'st', 'nd', 'rd' ),
20
+  'end_of_days' => array('th', 'st', 'nd', 'rd'),
21 21
 
22 22
 
23 23
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
  *
30 30
  *\_________________________________________________________/
31 31
  */
32
-  'convert_to' => function ( $date_time ) {
32
+  'convert_to' => function($date_time) {
33 33
 
34 34
         $config = include 'Gregorian.php';
35 35
 
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
 
42 42
         $temp_day = 0;
43 43
 
44
-    for ( $i = 1 ; $i < $month ; $i++ ) {
44
+    for ($i = 1; $i < $month; $i++) {
45 45
 
46
-        $temp_day += $config[ 'month_days_number' ][ $i ];
46
+        $temp_day += $config['month_days_number'][$i];
47 47
 
48 48
     }
49 49
 
@@ -51,12 +51,12 @@  discard block
 block discarded – undo
51 51
 
52 52
          $leap = new Leap($year);
53 53
 
54
-    if ($leap->get() && $month > 2 ) { $temp_day++; 
54
+    if ($leap->get() && $month > 2) { $temp_day++; 
55 55
     }
56 56
 
57
-    if ($temp_day <= 79 ) {
57
+    if ($temp_day <= 79) {
58 58
 
59
-        if (( $year - 1 ) % 4 == 0 ) {
59
+        if (($year - 1) % 4 == 0) {
60 60
 
61 61
             $temp_day = $temp_day + 11; 
62 62
         }
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
         if ($temp_day % 30 == 0) {
72 72
 
73
-            $month = ( $temp_day / 30 ) + 9;
73
+            $month = ($temp_day / 30) + 9;
74 74
 
75 75
             $day = 30;
76 76
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 
79 79
         else {
80 80
 
81
-            $month = ( $temp_day / 30 ) + 10;
81
+            $month = ($temp_day / 30) + 10;
82 82
 
83 83
             $day = $temp_day % 30;
84 84
 
@@ -92,20 +92,20 @@  discard block
 block discarded – undo
92 92
 
93 93
         $temp_day = $temp_day - 79;
94 94
 
95
-        if ($temp_day <= 186 ) {
95
+        if ($temp_day <= 186) {
96 96
 
97
-            if ($temp_day % 31 == 0 ) {
97
+            if ($temp_day % 31 == 0) {
98 98
 
99
-                $month = ( $temp_day / 31 );
99
+                $month = ($temp_day / 31);
100 100
 
101 101
                 $day = 31;
102 102
             }
103 103
 
104 104
             else {
105 105
 
106
-                $month = ( $temp_day / 31 ) + 1;
106
+                $month = ($temp_day / 31) + 1;
107 107
 
108
-                $day = ( $temp_day % 31 );
108
+                $day = ($temp_day % 31);
109 109
             }
110 110
 
111 111
         }
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
 
115 115
             $temp_day = $temp_day - 186;
116 116
 
117
-            if ($temp_day % 30 == 0 ) {
117
+            if ($temp_day % 30 == 0) {
118 118
 
119
-                $month = ( $temp_day / 30 ) + 6;
119
+                $month = ($temp_day / 30) + 6;
120 120
 
121 121
                 $day = 30;
122 122
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
             else {
126 126
 
127
-                $month = ( $temp_day / 30 ) + 7;
127
+                $month = ($temp_day / 30) + 7;
128 128
 
129 129
                 $day = $temp_day % 30;
130 130
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
    *
149 149
    *\_________________________________________________________/
150 150
    */
151
-  'convert_from' => function ( $date_time ) {
151
+  'convert_from' => function($date_time) {
152 152
 
153 153
     $config = include 'Jalali.php';
154 154
 
@@ -160,42 +160,42 @@  discard block
 block discarded – undo
160 160
 
161 161
     $days_of_year = 0;
162 162
 
163
-    foreach ( $config[ 'month_days_number' ] as $mon => $value ) {
163
+    foreach ($config['month_days_number'] as $mon => $value) {
164 164
 
165
-        if ($month > $mon ) { $days_of_year += $value; 
165
+        if ($month > $mon) { $days_of_year += $value; 
166 166
         }
167 167
 
168 168
     }
169 169
 
170 170
     $days_of_year += $day;
171 171
 
172
-    $days_of_leap_years =  intval(( ( $year - 1 ) / 4 ));
172
+    $days_of_leap_years = intval((($year - 1) / 4));
173 173
 
174
-    $days_of_shamsi_years = ( ( ( $year - 1 ) * 365 ) + $days_of_year + $days_of_leap_years );
174
+    $days_of_shamsi_years = ((($year - 1) * 365) + $days_of_year + $days_of_leap_years);
175 175
 
176 176
     $days_of_gregorain_years = $days_of_shamsi_years + 226899;
177 177
 
178
-    if ($month < 10 ) {
178
+    if ($month < 10) {
179 179
 
180
-        $days_of_gregorain_years = $days_of_gregorain_years - intval(( ( $year + 621 ) / 4 ));
180
+        $days_of_gregorain_years = $days_of_gregorain_years - intval((($year + 621) / 4));
181 181
 
182 182
     }
183 183
 
184
-    elseif (( ( 10 == $month ) && ( $day > 10 ) ) || ( $month > 10 ) ) {
184
+    elseif (((10 == $month) && ($day > 10)) || ($month > 10)) {
185 185
 
186
-        $days_of_gregorain_years = $days_of_gregorain_years - intval(( ( $year + 622 ) / 4 ));
186
+        $days_of_gregorain_years = $days_of_gregorain_years - intval((($year + 622) / 4));
187 187
 
188 188
     }
189 189
 
190
-    $gregorian_month = ( $days_of_gregorain_years % 365 );
190
+    $gregorian_month = ($days_of_gregorain_years % 365);
191 191
 
192 192
     $gregorian_year = intval($days_of_gregorain_years / 365) + 1;
193 193
 
194 194
     $config = include 'Gregorian.php';
195 195
 
196
-    foreach ( $config[ 'month_days_number' ] as $month => $value ) {
196
+    foreach ($config['month_days_number'] as $month => $value) {
197 197
 
198
-        if ($gregorian_month < $value ) { break; 
198
+        if ($gregorian_month < $value) { break; 
199 199
         }
200 200
 
201 201
         $gregorian_month -= $value;
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
    *
231 231
    *\_________________________________________________________/
232 232
    */
233
-  'month' => array (
233
+  'month' => array(
234 234
 
235 235
     'Farvardin',
236 236
 
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
    */
270 270
 
271 271
 
272
-  'days_of_week' => array (
272
+  'days_of_week' => array(
273 273
 
274 274
      'Yekshanbe',
275 275
      'Doshanbe',
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 
284 284
   'start_day_of_week' => 'Shanbe',
285 285
 
286
-  'month_days_number' => array(      1 => 31,
286
+  'month_days_number' => array(1 => 31,
287 287
                                      2 => 31,
288 288
                                      3 => 31,
289 289
                                      4 => 31,
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
                                      9 => 30,
295 295
                                      10 => 30,
296 296
                                      11 => 30,
297
-                                     12 => 29 ),
297
+                                     12 => 29),
298 298
 
299 299
   /************************************************************
300 300
   *                      Day of year
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
   *
305 305
   *\_________________________________________________________/
306 306
   */
307
-  'day_of_year' => function ( $date_time ) {
307
+  'day_of_year' => function($date_time) {
308 308
 
309 309
     $result = null;
310 310
 
@@ -314,9 +314,9 @@  discard block
 block discarded – undo
314 314
 
315 315
     $day = $date_time->format('d');
316 316
 
317
-    foreach( $config[ 'month_days_number' ] as $_month => $value ) {
317
+    foreach ($config['month_days_number'] as $_month => $value) {
318 318
 
319
-        if ($_month < $month ) { $result += $value; 
319
+        if ($_month < $month) { $result += $value; 
320 320
         }
321 321
 
322 322
     }
@@ -335,9 +335,9 @@  discard block
 block discarded – undo
335 335
    *  example : Yekshanbe = result is 2
336 336
    *\_________________________________________________________/
337 337
   */
338
-  'day_of_week' => function ( $date_time ) {
338
+  'day_of_week' => function($date_time) {
339 339
 
340
-        $days = array( 1 => 'Shanbe',  2 => 'Yekshanbe', 3 => 'Doshanbe', 4 => 'Seshanbe', 5 => 'Chaharshanbe', 6 => 'Panjshanbe', 7 => 'Jome' );
340
+        $days = array(1 => 'Shanbe', 2 => 'Yekshanbe', 3 => 'Doshanbe', 4 => 'Seshanbe', 5 => 'Chaharshanbe', 6 => 'Panjshanbe', 7 => 'Jome');
341 341
 
342 342
         $configShamsi = include 'Jalali.php';
343 343
 
@@ -345,11 +345,11 @@  discard block
 block discarded – undo
345 345
 
346 346
         $day = $date_time->format('l');
347 347
 
348
-        $day = str_replace($configGregorian[ 'days_of_week' ], $configShamsi[ 'days_of_week' ], $day);
348
+        $day = str_replace($configGregorian['days_of_week'], $configShamsi['days_of_week'], $day);
349 349
 
350
-    foreach ( $days as $key => $value ) {
350
+    foreach ($days as $key => $value) {
351 351
 
352
-        if ($day == $value ) {
352
+        if ($day == $value) {
353 353
 
354 354
             return $key;
355 355
         }
@@ -376,6 +376,6 @@  discard block
 block discarded – undo
376 376
    *
377 377
    *\_________________________________________________________/
378 378
    */
379
-  'weekend' => array( 'friday' )
379
+  'weekend' => array('friday')
380 380
 
381 381
  );
Please login to merge, or discard this patch.
Braces   +7 added lines, -21 removed lines patch added patch discarded remove patch
@@ -59,9 +59,7 @@  discard block
 block discarded – undo
59 59
         if (( $year - 1 ) % 4 == 0 ) {
60 60
 
61 61
             $temp_day = $temp_day + 11; 
62
-        }
63
-
64
-        else {
62
+        } else {
65 63
 
66 64
             $temp_day = $temp_day + 10; 
67 65
         }
@@ -74,9 +72,7 @@  discard block
 block discarded – undo
74 72
 
75 73
             $day = 30;
76 74
 
77
-        }
78
-
79
-        else {
75
+        } else {
80 76
 
81 77
             $month = ( $temp_day / 30 ) + 10;
82 78
 
@@ -84,9 +80,7 @@  discard block
 block discarded – undo
84 80
 
85 81
         }
86 82
 
87
-    }
88
-
89
-    else {
83
+    } else {
90 84
 
91 85
         $year = $year - 621;
92 86
 
@@ -99,18 +93,14 @@  discard block
 block discarded – undo
99 93
                 $month = ( $temp_day / 31 );
100 94
 
101 95
                 $day = 31;
102
-            }
103
-
104
-            else {
96
+            } else {
105 97
 
106 98
                 $month = ( $temp_day / 31 ) + 1;
107 99
 
108 100
                 $day = ( $temp_day % 31 );
109 101
             }
110 102
 
111
-        }
112
-
113
-        else {
103
+        } else {
114 104
 
115 105
             $temp_day = $temp_day - 186;
116 106
 
@@ -120,9 +110,7 @@  discard block
 block discarded – undo
120 110
 
121 111
                 $day = 30;
122 112
 
123
-            }
124
-
125
-            else {
113
+            } else {
126 114
 
127 115
                 $month = ( $temp_day / 30 ) + 7;
128 116
 
@@ -179,9 +167,7 @@  discard block
 block discarded – undo
179 167
 
180 168
         $days_of_gregorain_years = $days_of_gregorain_years - intval(( ( $year + 621 ) / 4 ));
181 169
 
182
-    }
183
-
184
-    elseif (( ( 10 == $month ) && ( $day > 10 ) ) || ( $month > 10 ) ) {
170
+    } elseif (( ( 10 == $month ) && ( $day > 10 ) ) || ( $month > 10 ) ) {
185 171
 
186 172
         $days_of_gregorain_years = $days_of_gregorain_years - intval(( ( $year + 622 ) / 4 ));
187 173
 
Please login to merge, or discard this patch.