Completed
Push — master ( 3848cb...1f8425 )
by mehdi
02:54
created
src/Datium.php 1 patch
Indentation   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -36,17 +36,17 @@  discard block
 block discarded – undo
36 36
 {
37 37
 
38 38
     /**
39
-   * Store DateTime object
40
-   */
39
+     * Store DateTime object
40
+     */
41 41
     protected $date_time;
42 42
 
43 43
     protected static $static_date_time;
44 44
 
45 45
     /**
46
-   * Store config file statements
47
-   *
48
-   * @param array
49
-   */
46
+     * Store config file statements
47
+     *
48
+     * @param array
49
+     */
50 50
     protected $config;
51 51
 
52 52
     protected $date_interval_expression;
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
     protected $fromConfig;
65 65
 
66 66
     /**
67
-   * Return store day number
68
-   *
69
-   * @param integer
70
-   */
67
+     * Return store day number
68
+     *
69
+     * @param integer
70
+     */
71 71
     protected $day_of;
72 72
 
73 73
     protected $leap;
@@ -93,15 +93,15 @@  discard block
 block discarded – undo
93 93
     protected $language;
94 94
 
95 95
     /**
96
-    * Timeago
97
-    *
98
-    * @param integer
99
-    */
96
+     * Timeago
97
+     *
98
+     * @param integer
99
+     */
100 100
     protected $ago;
101 101
 
102 102
     /**
103
-    * Datium class constructure
104
-    */
103
+     * Datium class constructure
104
+     */
105 105
     public function __construct()
106 106
     {
107 107
 
@@ -157,10 +157,10 @@  discard block
 block discarded – undo
157 157
     }
158 158
 
159 159
     /**
160
-    * Return all datetime parts as an object
161
-    *
162
-    * @return object
163
-    */
160
+     * Return all datetime parts as an object
161
+     *
162
+     * @return object
163
+     */
164 164
     public function all()
165 165
     {
166 166
 
@@ -183,11 +183,11 @@  discard block
 block discarded – undo
183 183
     }
184 184
 
185 185
     /**
186
-   * Get current datetime
187
-   *
188
-   * @since  Aug 17 2015
189
-   * @return object
190
-   */
186
+     * Get current datetime
187
+     *
188
+     * @since  Aug 17 2015
189
+     * @return object
190
+     */
191 191
     public static function now()
192 192
     {
193 193
 
@@ -198,17 +198,17 @@  discard block
 block discarded – undo
198 198
     }
199 199
 
200 200
     /**
201
-   * Create new date time
202
-   *
203
-   * @param integer $year   Year number
204
-   * @param integer $month  month number
205
-   * @param integer $day    day number
206
-   * @param integer $hour   hour number
207
-   * @param integer $minute minute number
208
-   * @param integer $second second number
209
-   *
210
-   * @return object
211
-   */
201
+     * Create new date time
202
+     *
203
+     * @param integer $year   Year number
204
+     * @param integer $month  month number
205
+     * @param integer $day    day number
206
+     * @param integer $hour   hour number
207
+     * @param integer $minute minute number
208
+     * @param integer $second second number
209
+     *
210
+     * @return object
211
+     */
212 212
     public static function create(
213 213
         $year = 2000,
214 214
         $month = 1,
@@ -220,8 +220,8 @@  discard block
 block discarded – undo
220 220
 
221 221
 
222 222
         /**
223
-       * When we want to set a Datetime object to Datium
224
-       */
223
+         * When we want to set a Datetime object to Datium
224
+         */
225 225
         if (func_num_args() === 1) {
226 226
             self::$static_date_time = func_get_arg(0);
227 227
 
@@ -244,13 +244,13 @@  discard block
 block discarded – undo
244 244
     }
245 245
 
246 246
     /**
247
-    * Select The range between two date object
248
-    *
249
-    * @param object $date_start Start of the DateTime
250
-    * @param object $date_end   End of the DateTime
251
-    *
252
-    * @return object
253
-    */
247
+     * Select The range between two date object
248
+     *
249
+     * @param object $date_start Start of the DateTime
250
+     * @param object $date_end   End of the DateTime
251
+     *
252
+     * @return object
253
+     */
254 254
     public static function between($date_start, $date_end)
255 255
     {
256 256
 
@@ -265,12 +265,12 @@  discard block
 block discarded – undo
265 265
     }
266 266
 
267 267
     /**
268
-   * Convert from current calendar, what type is current calendar?
269
-   *
270
-   * @param object $calendar Assigned calendar to start from
271
-   *
272
-   * @return $object
273
-   */
268
+     * Convert from current calendar, what type is current calendar?
269
+     *
270
+     * @param object $calendar Assigned calendar to start from
271
+     *
272
+     * @return $object
273
+     */
274 274
     public function from($calendar)
275 275
     {
276 276
 
@@ -280,8 +280,8 @@  discard block
 block discarded – undo
280 280
 
281 281
 
282 282
         /**
283
-     * We need this part for DayOf class
284
-     */
283
+         * We need this part for DayOf class
284
+         */
285 285
         $this->calendar_type = $calendar;
286 286
 
287 287
         $this->translate_to = $calendar;
@@ -291,12 +291,12 @@  discard block
 block discarded – undo
291 291
     }
292 292
 
293 293
     /**
294
-    * Convert date to current Date
295
-    *
296
-    * @param object $calendar Assigned calendar to when calendar should start.
297
-    *
298
-    * @return object
299
-    */
294
+     * Convert date to current Date
295
+     *
296
+     * @param object $calendar Assigned calendar to when calendar should start.
297
+     *
298
+     * @return object
299
+     */
300 300
     public function to($calendar)
301 301
     {
302 302
 
@@ -305,8 +305,8 @@  discard block
 block discarded – undo
305 305
         $this->date_time = $this->convert->to($calendar);
306 306
 
307 307
         /**
308
-     * We need this part for DayOf class
309
-     */
308
+         * We need this part for DayOf class
309
+         */
310 310
         $this->calendar_type = $calendar;
311 311
 
312 312
         $this->translate_to = $calendar;
@@ -316,13 +316,13 @@  discard block
 block discarded – undo
316 316
     }
317 317
 
318 318
     /**
319
-   * Difference between two time
320
-   *
321
-   * @param DateTime $start Start of the date
322
-   * @param DateTime $end   End of the date
323
-   *
324
-   * @return object
325
-   */
319
+     * Difference between two time
320
+     *
321
+     * @param DateTime $start Start of the date
322
+     * @param DateTime $end   End of the date
323
+     *
324
+     * @return object
325
+     */
326 326
     public static function diff($start, $end)
327 327
     {
328 328
 
@@ -331,12 +331,12 @@  discard block
 block discarded – undo
331 331
     }
332 332
 
333 333
     /**
334
-   * Add new date value to current date
335
-   *
336
-   * @param string $value How much date should be added to current date
337
-   *
338
-   * @return object
339
-   */
334
+     * Add new date value to current date
335
+     *
336
+     * @param string $value How much date should be added to current date
337
+     *
338
+     * @return object
339
+     */
340 340
     public function add($value)
341 341
     {
342 342
 
@@ -375,12 +375,12 @@  discard block
 block discarded – undo
375 375
     }
376 376
 
377 377
     /**
378
-   * Sub date from current date
379
-   *
380
-   * @param string $value How much date should increase from current date
381
-   *
382
-   * @return obejct
383
-   */
378
+     * Sub date from current date
379
+     *
380
+     * @param string $value How much date should increase from current date
381
+     *
382
+     * @return obejct
383
+     */
384 384
     public function sub($value)
385 385
     {
386 386
 
@@ -419,12 +419,12 @@  discard block
 block discarded – undo
419 419
     }
420 420
 
421 421
     /**
422
-   * Check if current year is leap or not
423
-   *
424
-   * @param string $type Name of the calendar to caculate leap year
425
-   *
426
-   * @return boolean
427
-   */
422
+     * Check if current year is leap or not
423
+     *
424
+     * @param string $type Name of the calendar to caculate leap year
425
+     *
426
+     * @return boolean
427
+     */
428 428
     public function leap()
429 429
     {
430 430
 
@@ -435,10 +435,10 @@  discard block
 block discarded – undo
435 435
     }
436 436
 
437 437
     /**
438
-    * Calculate how many time ago datetime happens
439
-    *
440
-    * @return string
441
-    */
438
+     * Calculate how many time ago datetime happens
439
+     *
440
+     * @return string
441
+     */
442 442
     public function ago()
443 443
     {
444 444
 
@@ -449,12 +449,12 @@  discard block
 block discarded – undo
449 449
     }
450 450
 
451 451
     /**
452
-    * Caculate day of year or week
453
-    *
454
-    * @since Aug, 22 2015
455
-    *
456
-    * @return integer
457
-    */
452
+     * Caculate day of year or week
453
+     *
454
+     * @since Aug, 22 2015
455
+     *
456
+     * @return integer
457
+     */
458 458
     public function dayOf()
459 459
     {
460 460
 
@@ -482,12 +482,12 @@  discard block
 block discarded – undo
482 482
     // }
483 483
 
484 484
     /**
485
-    * Return Datetime as a original object
486
-    *
487
-    * @since Oct 22, 2015
488
-    *
489
-    * @return object
490
-    */
485
+     * Return Datetime as a original object
486
+     *
487
+     * @since Oct 22, 2015
488
+     *
489
+     * @return object
490
+     */
491 491
     public function object()
492 492
     {
493 493
 
@@ -496,12 +496,12 @@  discard block
 block discarded – undo
496 496
     }
497 497
 
498 498
     /**
499
-    * Translate current date string to selected language
500
-    *
501
-    * @param string $language language short name fa, en, ar ...
502
-    *
503
-    * @return object
504
-    */
499
+     * Translate current date string to selected language
500
+     *
501
+     * @param string $language language short name fa, en, ar ...
502
+     *
503
+     * @return object
504
+     */
505 505
     public function lang($language = 'fa')
506 506
     {
507 507
 
@@ -518,10 +518,10 @@  discard block
 block discarded – undo
518 518
     }
519 519
 
520 520
     /**
521
-    * Return object as timestamp
522
-    *
523
-    * @return timestamp
524
-    */
521
+     * Return object as timestamp
522
+     *
523
+     * @return timestamp
524
+     */
525 525
     public function timestamp()
526 526
     {
527 527
 
@@ -530,14 +530,14 @@  discard block
 block discarded – undo
530 530
     }
531 531
 
532 532
     /**
533
-   * Return fainal result
534
-   *
535
-   * @param string $format Date format
536
-   *
537
-   * @since Aug 17 2015
538
-   *
539
-   * @return string
540
-   */
533
+     * Return fainal result
534
+     *
535
+     * @param string $format Date format
536
+     *
537
+     * @since Aug 17 2015
538
+     *
539
+     * @return string
540
+     */
541 541
     public function get($format = 'Y-m-d H:i:s')
542 542
     {
543 543
 
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
 
554 554
         if (is_null($this->toConfig)) {
555 555
             $this->toConfig = include 'CalendarSettings/' .
556
-                                       ucfirst($this->translate_to) . '.php';
556
+                                        ucfirst($this->translate_to) . '.php';
557 557
         }
558 558
 
559 559
         $string_date = $this->date_time->format($format);
Please login to merge, or discard this patch.