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