Completed
Push — master ( 6ef271...8502f6 )
by
unknown
13s
created
src/lang/ar/general.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -2,23 +2,23 @@
 block discarded – undo
2 2
 
3 3
   return array(
4 4
 
5
-       'events' => array( 'eid fitr' => 'عيد الفطر',
5
+        'events' => array( 'eid fitr' => 'عيد الفطر',
6 6
 
7 7
                         ),
8 8
 
9 9
         'month' => array(
10 10
                           'مُحَرَّم',
11 11
                           'صَفَر',
12
-                           'رَبيع الأوّل',
13
-                           'رَبيع الآخر',
14
-                           'جُمادى الأولى',
15
-                           'جُمادى الآخرة',
16
-                           'رَجَب',
17
-                           'شَعْبان',
18
-                           'رَمَضان',
19
-                           'شَوّال',
20
-                           'ذو القِعْدة',
21
-                           'ذو الحِجّة'
12
+                            'رَبيع الأوّل',
13
+                            'رَبيع الآخر',
14
+                            'جُمادى الأولى',
15
+                            'جُمادى الآخرة',
16
+                            'رَجَب',
17
+                            'شَعْبان',
18
+                            'رَمَضان',
19
+                            'شَوّال',
20
+                            'ذو القِعْدة',
21
+                            'ذو الحِجّة'
22 22
                         ),
23 23
 
24 24
         'days_of_week' => array(
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
   return array(
4 4
 
5
-       'events' => array( 'eid fitr' => 'عيد الفطر',
5
+       'events' => array('eid fitr' => 'عيد الفطر',
6 6
 
7 7
                         ),
8 8
 
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
 
38 38
         'pm_time' => '',
39 39
 
40
-        'end_of_days' => array( "" ),
40
+        'end_of_days' => array(""),
41 41
 
42
-        'numbers' => array( '۰', '۱', '۲', '۳', '٤‎', '٥‎', '٦‎', '۷', '۸', '۹'),
42
+        'numbers' => array('۰', '۱', '۲', '۳', '٤‎', '٥‎', '٦‎', '۷', '۸', '۹'),
43 43
 
44 44
   );
45 45
 
Please login to merge, or discard this patch.
src/lang/fa/general.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
   return array(
4 4
 
5
-       'events' => array( 'nowruz' => 'عید نوروز',
5
+       'events' => array('nowruz' => 'عید نوروز',
6 6
 
7 7
                           'iran_national_day' => 'روز جمهوری اسلامی',
8 8
 
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
 
41 41
         'pm_time' => 'ب.ظ',
42 42
 
43
-        'end_of_days' => array( "" ),
43
+        'end_of_days' => array(""),
44 44
 
45
-        'numbers' => array( '۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹' ),
45
+        'numbers' => array('۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹'),
46 46
         '0' => '۰',
47 47
         '1' => '۱',
48 48
         '2' => '۲',
Please login to merge, or discard this patch.
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
   return array(
4 4
 
5
-       'events' => array( 'nowruz' => 'عید نوروز',
5
+        'events' => array( 'nowruz' => 'عید نوروز',
6 6
 
7 7
                           'iran_national_day' => 'روز جمهوری اسلامی',
8 8
 
@@ -12,16 +12,16 @@  discard block
 block discarded – undo
12 12
         'month' => array(
13 13
                           'فروردین',
14 14
                           'اردیبهشت',
15
-                           'خرداد',
16
-                           'تیر',
17
-                           'مرداد',
18
-                           'شهریور',
19
-                           'مهر',
20
-                           'آبان',
21
-                           'آذر',
22
-                           'دی',
23
-                           'بهمن',
24
-                           'اسفند',
15
+                            'خرداد',
16
+                            'تیر',
17
+                            'مرداد',
18
+                            'شهریور',
19
+                            'مهر',
20
+                            'آبان',
21
+                            'آذر',
22
+                            'دی',
23
+                            'بهمن',
24
+                            'اسفند',
25 25
                         ),
26 26
 
27 27
         'days_of_week' => array(
Please login to merge, or discard this patch.
src/CalendarSettings/Gregorian.php 3 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 [
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
- '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   +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.
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,5 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
- use OpenCafe\Datium as Datium;
4
-
5 3
  return [
6 4
 
7 5
  'numbers' => array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'),
Please login to merge, or discard this patch.
src/Leap.php 2 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -7,43 +7,43 @@
 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 41
     /**
42
-   * return the year is leap or not
43
-   *
44
-   * @since  Aug, 21 2015
45
-   * @return boolean
46
-   */
42
+     * return the year is leap or not
43
+     *
44
+     * @since  Aug, 21 2015
45
+     * @return boolean
46
+     */
47 47
     public function get()
48 48
     {
49 49
 
Please login to merge, or discard this 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/Config.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,9 +20,9 @@
 block discarded – undo
20 20
   'default_calendar' => 'gregorian',
21 21
 
22 22
 
23
-  'date_interval' => [ 'D', 'M', 'Y', 'HT', 'MT', 'ST' ],
23
+  'date_interval' => ['D', 'M', 'Y', 'HT', 'MT', 'ST'],
24 24
 
25 25
 
26
-  'date_simple' => [ 'day', ' month', ' year', ' hour', ' minute', ' second' ],
26
+  'date_simple' => ['day', ' month', ' year', ' hour', ' minute', ' second'],
27 27
 
28 28
 ];
Please login to merge, or discard this patch.
src/Datium.php 2 patches
Doc Comments   +11 added lines, -12 removed lines patch added patch discarded remove patch
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
      * Get current datetime
194 194
      *
195 195
      * @since  Aug 17 2015
196
-     * @return object
196
+     * @return Datium
197 197
      */
198 198
     public static function now()
199 199
     {
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
      * @param integer $minute minute number
233 233
      * @param integer $second second number
234 234
      *
235
-     * @return object
235
+     * @return Datium
236 236
      */
237 237
     public static function create(
238 238
         $year = 2000,
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
      *
273 273
      * @param  timestamp $timestamp Input timestamp value
274 274
      *
275
-     * @return object
275
+     * @return Datium
276 276
      */
277 277
     public static function createTimestamp($timestamp)
278 278
     {
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
      * @param object $date_start Start of the DateTime
301 301
      * @param object $date_end   End of the DateTime
302 302
      *
303
-     * @return object
303
+     * @return Datium
304 304
      */
305 305
     public static function between($date_start, $date_end)
306 306
     {
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
      *
347 347
      * @param object $calendar Assigned calendar to when calendar should start.
348 348
      *
349
-     * @return object
349
+     * @return Datium
350 350
      */
351 351
     public function to($calendar)
352 352
     {
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
      *
403 403
      * @param string $value How much date should be added to current date
404 404
      *
405
-     * @return object
405
+     * @return Datium
406 406
      */
407 407
     public function add($value)
408 408
     {
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
      *
445 445
      * @param string $value How much date should increase from current date
446 446
      *
447
-     * @return obejct
447
+     * @return Datium
448 448
      */
449 449
     public function sub($value)
450 450
     {
@@ -484,9 +484,8 @@  discard block
 block discarded – undo
484 484
     /**
485 485
      * Check if current year is leap or not
486 486
      *
487
-     * @param string $type Name of the calendar to caculate leap year
488 487
      *
489
-     * @return boolean
488
+     * @return Leap
490 489
      */
491 490
     public function leap()
492 491
     {
@@ -502,7 +501,7 @@  discard block
 block discarded – undo
502 501
      *
503 502
      * @since Aug, 22 2015
504 503
      *
505
-     * @return integer
504
+     * @return DayOf
506 505
      */
507 506
     public function dayOf()
508 507
     {
@@ -549,7 +548,7 @@  discard block
 block discarded – undo
549 548
      *
550 549
      * @param string $language language short name fa, en, ar ...
551 550
      *
552
-     * @return object
551
+     * @return Datium
553 552
      */
554 553
     public function lang($language = 'fa')
555 554
     {
@@ -569,7 +568,7 @@  discard block
 block discarded – undo
569 568
     /**
570 569
      * Return object as timestamp
571 570
      *
572
-     * @return timestamp
571
+     * @return integer
573 572
      */
574 573
     public function timestamp()
575 574
     {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
     public function all()
172 172
     {
173 173
 
174
-        return ( object )array(
174
+        return (object) array(
175 175
 
176 176
             'second' => $this->date_time->format('s'),
177 177
 
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 
392 392
         $difference->year = $difference->y;
393 393
 
394
-        $difference->simple = ( new SimpleDiff( $start, $end, $difference ) );
394
+        $difference->simple = (new SimpleDiff($start, $end, $difference));
395 395
 
396 396
         return $difference;
397 397
 
Please login to merge, or discard this patch.
src/SimpleDiff.php 3 patches
Doc Comments   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,8 +34,9 @@  discard block
 block discarded – undo
34 34
     /**
35 35
     * SimpleDiff Class constructure
36 36
     *
37
-    * @param DateTime $time_difference The time to calculate with now
38
-    * @param string $lang Language
37
+    * @param DateTime $difference The time to calculate with now
38
+    * @param \DateTime $start
39
+    * @param \DateTime $end
39 40
     */
40 41
     public function __construct($start, $end, $difference )
41 42
     {
@@ -65,8 +66,8 @@  discard block
 block discarded – undo
65 66
     /**
66 67
     * Read ago config file
67 68
     *
68
-    * @param integer $date date index in ago config file
69 69
     * @param string $type duration type on ago config file
70
+    * @param integer $value
70 71
     */
71 72
     public function read( $value, $type )
72 73
     {
Please login to merge, or discard this patch.
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
     private $blockList;
33 33
 
34 34
     /**
35
-    * SimpleDiff Class constructure
36
-    *
37
-    * @param DateTime $time_difference The time to calculate with now
38
-    * @param string $lang Language
39
-    */
35
+     * SimpleDiff Class constructure
36
+     *
37
+     * @param DateTime $time_difference The time to calculate with now
38
+     * @param string $lang Language
39
+     */
40 40
     public function __construct($start, $end, $difference )
41 41
     {
42 42
 
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
     }
52 52
 
53 53
     /**
54
-    * Return difference period as an object
55
-    *
56
-    * @return object
57
-    */
54
+     * Return difference period as an object
55
+     *
56
+     * @return object
57
+     */
58 58
     public function all()
59 59
     {
60 60
 
@@ -63,11 +63,11 @@  discard block
 block discarded – undo
63 63
     }
64 64
 
65 65
     /**
66
-    * Read ago config file
67
-    *
68
-    * @param integer $date date index in ago config file
69
-    * @param string $type duration type on ago config file
70
-    */
66
+     * Read ago config file
67
+     *
68
+     * @param integer $date date index in ago config file
69
+     * @param string $type duration type on ago config file
70
+     */
71 71
     public function read( $value, $type )
72 72
     {
73 73
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
       if( array_key_exists( $value, $config[ $type ] ) ) {
99 99
 
100 100
         $str = Lang::get( $this->language, $config[ $type ][ $value ] )
101
-               . $time;
101
+                . $time;
102 102
 
103 103
         return $str;
104 104
 
@@ -114,11 +114,11 @@  discard block
 block discarded – undo
114 114
     }
115 115
 
116 116
     /**
117
-    * Show priority of duration
118
-    *
119
-    * @param integer $date date index in ago config file
120
-    * @param string $type duration type on ago config file
121
-    */
117
+     * Show priority of duration
118
+     *
119
+     * @param integer $date date index in ago config file
120
+     * @param string $type duration type on ago config file
121
+     */
122 122
     public function priority( $date, $type )
123 123
     {
124 124
 
@@ -144,10 +144,10 @@  discard block
 block discarded – undo
144 144
     }
145 145
 
146 146
     /**
147
-    * Return fainal SimpleDiff result
148
-    *
149
-    * @return string
150
-    */
147
+     * Return fainal SimpleDiff result
148
+     *
149
+     * @return string
150
+     */
151 151
     public function get()
152 152
     {
153 153
 
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -37,12 +37,12 @@  discard block
 block discarded – undo
37 37
     * @param DateTime $time_difference The time to calculate with now
38 38
     * @param string $lang Language
39 39
     */
40
-    public function __construct($start, $end, $difference )
40
+    public function __construct($start, $end, $difference)
41 41
     {
42 42
 
43 43
       $this->language = 'en';
44 44
 
45
-      $this->result =  $difference;
45
+      $this->result = $difference;
46 46
 
47 47
       $this->blockList = [
48 48
         'just-now'
@@ -68,46 +68,46 @@  discard block
 block discarded – undo
68 68
     * @param integer $date date index in ago config file
69 69
     * @param string $type duration type on ago config file
70 70
     */
71
-    public function read( $value, $type )
71
+    public function read($value, $type)
72 72
     {
73 73
 
74
-      $config = include __DIR__ . '/config/diff.php';
74
+      $config = include __DIR__.'/config/diff.php';
75 75
 
76
-      if( $this->result->invert ) {
76
+      if ($this->result->invert) {
77 77
 
78
-        $time = ' ' . Lang::get( $this->language, 'remaining' );
78
+        $time = ' '.Lang::get($this->language, 'remaining');
79 79
 
80 80
       } else {
81 81
 
82
-        $time = ' ' . Lang::get( $this->language, 'ago' );
82
+        $time = ' '.Lang::get($this->language, 'ago');
83 83
 
84 84
       }
85 85
 
86
-      if( isset( $config[ $type ][ $value ] ) && in_array(
86
+      if (isset($config[$type][$value]) && in_array(
87 87
 
88
-                $config[ $type ][ $value ],
88
+                $config[$type][$value],
89 89
 
90 90
                 $this->blockList
91 91
 
92
-                ) ) {
92
+                )) {
93 93
 
94 94
                 $time = null;
95 95
 
96 96
                 }
97 97
 
98
-      if( array_key_exists( $value, $config[ $type ] ) ) {
98
+      if (array_key_exists($value, $config[$type])) {
99 99
 
100
-        $str = Lang::get( $this->language, $config[ $type ][ $value ] )
100
+        $str = Lang::get($this->language, $config[$type][$value])
101 101
                . $time;
102 102
 
103 103
         return $str;
104 104
 
105 105
       } else {
106 106
 
107
-        return Lang::getNumbers( $this->language, $value ) . " " . Lang::get(
107
+        return Lang::getNumbers($this->language, $value)." ".Lang::get(
108 108
                                           $this->language,
109
-                                          $config[ $type ][ '*' ]
110
-                                        ) . $time;
109
+                                          $config[$type]['*']
110
+                                        ).$time;
111 111
 
112 112
       }
113 113
 
@@ -119,12 +119,12 @@  discard block
 block discarded – undo
119 119
     * @param integer $date date index in ago config file
120 120
     * @param string $type duration type on ago config file
121 121
     */
122
-    public function priority( $date, $type )
122
+    public function priority($date, $type)
123 123
     {
124 124
 
125
-      if( $date != 0 ) {
125
+      if ($date != 0) {
126 126
 
127
-        return $this->read( $date, $type );
127
+        return $this->read($date, $type);
128 128
 
129 129
       } else {
130 130
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 
135 135
     }
136 136
 
137
-    public function lang( $value )
137
+    public function lang($value)
138 138
     {
139 139
 
140 140
       $this->language = $value;
@@ -160,11 +160,11 @@  discard block
 block discarded – undo
160 160
         'second' =>  $this->result->second
161 161
       ];
162 162
 
163
-      foreach( $duration as $index => $value ) {
163
+      foreach ($duration as $index => $value) {
164 164
 
165
-        if( $this->priority( $value, $index ) != false ) {
165
+        if ($this->priority($value, $index) != false) {
166 166
 
167
-          return $this->priority( $value, $index );
167
+          return $this->priority($value, $index);
168 168
 
169 169
         }
170 170
 
Please login to merge, or discard this patch.
src/Convert.php 3 patches
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
     public function from($calendar)
79 79
     {
80 80
 
81
-        $this->calendar_file = include __DIR__.'/CalendarSettings/' . ucfirst($calendar) . '.php';
81
+        $this->calendar_file = include __DIR__.'/CalendarSettings/'.ucfirst($calendar).'.php';
82 82
 
83
-        return $this->calendar_file[ 'convert_from' ]( $this->date_time );
83
+        return $this->calendar_file['convert_from']($this->date_time);
84 84
 
85 85
     }
86 86
 
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
     public function to($calendar)
96 96
     {
97 97
 
98
-        $this->calendar_file = include __DIR__.'/CalendarSettings/' . ucfirst($calendar) . '.php';
98
+        $this->calendar_file = include __DIR__.'/CalendarSettings/'.ucfirst($calendar).'.php';
99 99
 
100
-        return $this->calendar_file[ 'convert_to' ]( $this->date_time );
100
+        return $this->calendar_file['convert_to']($this->date_time);
101 101
 
102 102
     }
103 103
 
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 
123 123
           $days_of_year = 0;
124 124
 
125
-        foreach ($this->config[ 'month_days_number' ] as $month => $value) {
125
+        foreach ($this->config['month_days_number'] as $month => $value) {
126 126
             if ($this->month > $month) {
127 127
                 $days_of_year += $value;
128 128
             }
@@ -130,25 +130,25 @@  discard block
 block discarded – undo
130 130
 
131 131
           $days_of_year += $this->day;
132 132
 
133
-          $days_of_leap_years =  intval(( ( $this->year - 1 ) / 4 ));
133
+          $days_of_leap_years = intval((($this->year - 1) / 4));
134 134
 
135
-          $days_of_jalali_years = ( ( ( $this->year - 1 ) * 365 ) + $days_of_year + $days_of_leap_years );
135
+          $days_of_jalali_years = ((($this->year - 1) * 365) + $days_of_year + $days_of_leap_years);
136 136
 
137 137
           $days_of_gregorain_years = $days_of_jalali_years + 226899;
138 138
 
139 139
         if ($this->month < 10) {
140
-            $days_of_gregorain_years = $days_of_gregorain_years - intval(( ( $this->year + 621 ) / 4 ));
141
-        } elseif (( ( 10 == $this->month ) && ( $this->day > 10 ) ) || ( $this->month > 10 )) {
142
-            $days_of_gregorain_years = $days_of_gregorain_years - intval(( ( $this->year + 622 ) / 4 ));
140
+            $days_of_gregorain_years = $days_of_gregorain_years - intval((($this->year + 621) / 4));
141
+        } elseif (((10 == $this->month) && ($this->day > 10)) || ($this->month > 10)) {
142
+            $days_of_gregorain_years = $days_of_gregorain_years - intval((($this->year + 622) / 4));
143 143
         }
144 144
 
145
-            $gregorian_month = ( $days_of_gregorain_years % 365 );
145
+            $gregorian_month = ($days_of_gregorain_years % 365);
146 146
 
147 147
             $gregorian_year = intval($days_of_gregorain_years / 365) + 1;
148 148
 
149 149
             $this->config = include __DIR__.'/Gregorian.php';
150 150
 
151
-        foreach ($this->config[ 'month_days_number' ] as $month => $value) {
151
+        foreach ($this->config['month_days_number'] as $month => $value) {
152 152
             if ($gregorian_month < $value) {
153 153
                 break;
154 154
             }
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 
185 185
         $this->day = $this->date_time->format('d');
186 186
 
187
-        $this->temp_day = 0 ;
187
+        $this->temp_day = 0;
188 188
 
189 189
         $this->config = include __DIR__.'/Jalali.php';
190 190
 
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
             $this->temp_day++;
201 201
         }
202 202
 
203
-        $_year = ( ( ( ( ( $this->year - 1 ) * 365.2422 ) + $this->temp_day ) - 119) / 354.3670 ) + 1;
203
+        $_year = ((((($this->year - 1) * 365.2422) + $this->temp_day) - 119) / 354.3670) + 1;
204 204
 
205 205
         $_year = explode('.', $_year);
206 206
 
@@ -216,9 +216,9 @@  discard block
 block discarded – undo
216 216
 
217 217
          $var_temp .= '1';
218 218
 
219
-        $_month = $_month * $var_temp ;
219
+        $_month = $_month * $var_temp;
220 220
 
221
-        $_month = ( $_month * 12 ) + 1;
221
+        $_month = ($_month * 12) + 1;
222 222
 
223 223
         $_month = explode('.', $_month);
224 224
 
@@ -229,14 +229,14 @@  discard block
 block discarded – undo
229 229
         $var_temp = '0.0';
230 230
 
231 231
         for ($i = strlen($_day); $i > 2; $i--) {
232
-            $var_temp .= '0' ;
232
+            $var_temp .= '0';
233 233
         }
234 234
 
235 235
         $var_temp .= '1';
236 236
 
237 237
         $_day = $_day * $var_temp;
238 238
 
239
-        $_day = ( $_day * 29.530 );
239
+        $_day = ($_day * 29.530);
240 240
 
241 241
         $_day = explode('.', $_day);
242 242
 
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 
270 270
           $this->config = include __DIR__.'/Hijri.php';
271 271
 
272
-        foreach ($this->config[ 'month_days_number' ] as $month => $value) {
272
+        foreach ($this->config['month_days_number'] as $month => $value) {
273 273
             if ($this->month > $month) {
274 274
                 $days_of_year += $value;
275 275
             }
@@ -277,21 +277,21 @@  discard block
 block discarded – undo
277 277
 
278 278
           $days_of_year += $this->day;
279 279
 
280
-          $days_of_leap_years =  intval(( ( $this->year - 1 ) / 3 ));
280
+          $days_of_leap_years = intval((($this->year - 1) / 3));
281 281
 
282
-          $days_of_hijri_years = ( ( ( $this->year - 1 ) * 354 ) + $days_of_year + $days_of_leap_years );
282
+          $days_of_hijri_years = ((($this->year - 1) * 354) + $days_of_year + $days_of_leap_years);
283 283
 
284 284
           $days_of_jalali_years = $days_of_hijri_years + 179;
285 285
 
286
-          $days_of_jalali_years = $days_of_jalali_years - intval(( ( $this->year - 43 ) / 4 ));
286
+          $days_of_jalali_years = $days_of_jalali_years - intval((($this->year - 43) / 4));
287 287
 
288
-          $jalali_month = ( $days_of_jalali_years % 365 );
288
+          $jalali_month = ($days_of_jalali_years % 365);
289 289
 
290 290
           $jalali_year = intval($days_of_jalali_years / 365) + 1;
291 291
 
292 292
           $this->config = include __DIR__.'/Jalali.php';
293 293
 
294
-        foreach ($this->config[ 'month_days_number' ] as $month => $value) {
294
+        foreach ($this->config['month_days_number'] as $month => $value) {
295 295
             if ($jalali_month < $value) {
296 296
                 break;
297 297
             }
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 
331 331
         $this->config = include __DIR__.'/Hijri.php';
332 332
 
333
-        foreach ($this->config[ 'month_days_number' ] as $month => $value) {
333
+        foreach ($this->config['month_days_number'] as $month => $value) {
334 334
             if ($this->month > $month) {
335 335
                 $days_of_year += $value;
336 336
             }
@@ -338,21 +338,21 @@  discard block
 block discarded – undo
338 338
 
339 339
         $days_of_year += $this->day;
340 340
 
341
-        $days_of_leap_years =  intval(( ( $this->year - 1 ) / 3 ));
341
+        $days_of_leap_years = intval((($this->year - 1) / 3));
342 342
 
343
-        $days_of_hijri_years = ( ( ( $this->year - 1 ) * 354 ) + $days_of_year + $days_of_leap_years );
343
+        $days_of_hijri_years = ((($this->year - 1) * 354) + $days_of_year + $days_of_leap_years);
344 344
 
345 345
         $days_of_gregorain_years = $days_of_hijri_years + 227078;
346 346
 
347
-        $days_of_gregorain_years = $days_of_gregorain_years - intval(( ( $this->year + 578 ) / 4 ));
347
+        $days_of_gregorain_years = $days_of_gregorain_years - intval((($this->year + 578) / 4));
348 348
 
349
-        $gregorian_month = ( $days_of_gregorain_years % 365 );
349
+        $gregorian_month = ($days_of_gregorain_years % 365);
350 350
 
351 351
         $gregorian_year = intval($days_of_gregorain_years / 365) + 1;
352 352
 
353 353
         $this->config = include __DIR__.'/Gregorian.php';
354 354
 
355
-        foreach ($this->config[ 'month_days_number' ] as $month => $value) {
355
+        foreach ($this->config['month_days_number'] as $month => $value) {
356 356
             if ($gregorian_month < $value) {
357 357
                 break;
358 358
             }
Please login to merge, or discard this patch.
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
     /************************************************************
@@ -102,11 +102,11 @@  discard block
 block discarded – undo
102 102
     }
103 103
 
104 104
     /**
105
-   *convert jalali year to gregorian year
106
- *
107
-   * @since  Oct, 16 2015
108
-   * @return object
109
-   */
105
+     *convert jalali year to gregorian year
106
+     *
107
+     * @since  Oct, 16 2015
108
+     * @return object
109
+     */
110 110
     public function jalaliToGregorian($date_time)
111 111
     {
112 112
 
@@ -163,16 +163,16 @@  discard block
 block discarded – undo
163 163
           $this->date_time->setDate($gregorian_year, $gregorian_month, $gregorian_day);
164 164
 
165 165
 
166
-         return $this->date_time;
166
+          return $this->date_time;
167 167
 
168 168
     }
169 169
 
170 170
     /**
171
-   *convert jalali year to hijri year
172
- *
173
-   * @since  Oct, 17 2015
174
-   * @return object
175
-   */
171
+     *convert jalali year to hijri year
172
+     *
173
+     * @since  Oct, 17 2015
174
+     * @return object
175
+     */
176 176
     public function jalaliToHijri($date_time)
177 177
     {
178 178
 
@@ -192,9 +192,9 @@  discard block
 block discarded – undo
192 192
             $this->temp_day += $this->config['month_days_number'][$i];
193 193
         }
194 194
 
195
-         $this->temp_day += $this->day;
195
+          $this->temp_day += $this->day;
196 196
 
197
-         $this->leap = new Leap($this->year);
197
+          $this->leap = new Leap($this->year);
198 198
 
199 199
         if ($this->leap->get() && $this->month > 11) {
200 200
             $this->temp_day++;
@@ -208,13 +208,13 @@  discard block
 block discarded – undo
208 208
 
209 209
         $_month = $_year[1];
210 210
 
211
-         $var_temp = '0.0';
211
+          $var_temp = '0.0';
212 212
 
213 213
         for ($i = strlen($_month); $i > 2; $i--) {
214 214
             $var_temp .= '0';
215 215
         }
216 216
 
217
-         $var_temp .= '1';
217
+          $var_temp .= '1';
218 218
 
219 219
         $_month = $_month * $var_temp ;
220 220
 
@@ -242,18 +242,18 @@  discard block
 block discarded – undo
242 242
 
243 243
         $this->day = $_day[0];
244 244
 
245
-           $this->date_time->setDate($this->year, $this->month, $this->day);
245
+            $this->date_time->setDate($this->year, $this->month, $this->day);
246 246
 
247
-           return $this->date_time;
247
+            return $this->date_time;
248 248
 
249 249
     }
250 250
 
251 251
     /**
252
-   *convert hijri year to jalali year
253
- *
254
-   * @since  Oct, 17 2015
255
-   * @return object
256
-   */
252
+     *convert hijri year to jalali year
253
+     *
254
+     * @since  Oct, 17 2015
255
+     * @return object
256
+     */
257 257
     public function hijriToJalali($date_time)
258 258
     {
259 259
 
@@ -305,16 +305,16 @@  discard block
 block discarded – undo
305 305
 
306 306
           $this->date_time->setDate($jalali_year, $jalali_month, $jalali_day);
307 307
 
308
-         return $this->date_time;
308
+          return $this->date_time;
309 309
 
310 310
     }
311 311
 
312 312
     /**
313
-    * convert hijri year to gregorian year
314
-   *
315
-    * @since  Oct, 17 2015
316
-    * @return object
317
-    */
313
+     * convert hijri year to gregorian year
314
+     *
315
+     * @since  Oct, 17 2015
316
+     * @return object
317
+     */
318 318
     public function hijriToGregorian($date_time)
319 319
     {
320 320
 
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 
367 367
         $this->date_time->setDate($gregorian_year, $gregorian_month, $gregorian_day);
368 368
 
369
-         return $this->date_time;
369
+          return $this->date_time;
370 370
 
371 371
     }
372 372
 }
Please login to merge, or discard this patch.
src/Lang.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -44,17 +44,17 @@  discard block
 block discarded – undo
44 44
         /**
45 45
        * Fetch translated file to config attribute
46 46
        */
47
-        self::$config = include  __DIR__ . '/CalendarSettings/Jalali.php';
47
+        self::$config = include  __DIR__.'/CalendarSettings/Jalali.php';
48 48
 
49 49
         /**
50 50
         * Fetch translated expression to langTable attribute
51 51
         */
52
-        self::$langTable = include __DIR__ . '/lang/' . $language . '/general.php';
52
+        self::$langTable = include __DIR__.'/lang/'.$language.'/general.php';
53 53
 
54 54
         foreach (self::$langTable as $key => $translate) {
55
-            if (isset(self::$config[ $key ])) {
56
-                if (self::$config[ $key ]) {
57
-                    self::$config[ $key ] = $translate;
55
+            if (isset(self::$config[$key])) {
56
+                if (self::$config[$key]) {
57
+                    self::$config[$key] = $translate;
58 58
                 }
59 59
             }
60 60
         }
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
     public static function get($lang, $value)
72 72
     {
73 73
 
74
-        $file = include( __DIR__ . '/lang/' . $lang . '/general.php');
74
+        $file = include(__DIR__.'/lang/'.$lang.'/general.php');
75 75
 
76 76
         return $file[$value];
77 77
 
@@ -83,14 +83,14 @@  discard block
 block discarded – undo
83 83
      * @param  integer $numbers
84 84
      * @return string
85 85
      */
86
-    public static function getNumbers( $lang, $numbers )
86
+    public static function getNumbers($lang, $numbers)
87 87
     {
88 88
 
89 89
       $result = null;
90 90
 
91
-      $file = include( __DIR__ . '/lang/' . $lang . '/general.php');
91
+      $file = include(__DIR__.'/lang/'.$lang.'/general.php');
92 92
 
93
-      foreach(  str_split( $numbers, 1 ) as $key => $value ) {
93
+      foreach (str_split($numbers, 1) as $key => $value) {
94 94
 
95 95
         $result .= $file[$value];
96 96
 
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -42,13 +42,13 @@
 block discarded – undo
42 42
     {
43 43
 
44 44
         /**
45
-       * Fetch translated file to config attribute
46
-       */
45
+         * Fetch translated file to config attribute
46
+         */
47 47
         self::$config = include  __DIR__ . '/CalendarSettings/Jalali.php';
48 48
 
49 49
         /**
50
-        * Fetch translated expression to langTable attribute
51
-        */
50
+         * Fetch translated expression to langTable attribute
51
+         */
52 52
         self::$langTable = include __DIR__ . '/lang/' . $language . '/general.php';
53 53
 
54 54
         foreach (self::$langTable as $key => $translate) {
Please login to merge, or discard this patch.