Completed
Push — master ( ccb61a...c8b97f )
by
unknown
02:19
created
src/CalendarSettings/Gregorian.php 1 patch
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -1,20 +1,20 @@  discard block
 block discarded – undo
1 1
 ``<?php
2 2
 
3
- use Datium\Datium as Datium;
3
+  use Datium\Datium as Datium;
4 4
 
5
- return array (
5
+  return array (
6 6
 
7
- 'numbers' => array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'),
7
+  'numbers' => array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'),
8 8
 
9
- 'day_to_nigh' => 'AM',
9
+  'day_to_nigh' => 'AM',
10 10
 
11
- 'night_to_day' => 'PM',
11
+  'night_to_day' => 'PM',
12 12
 
13
- 'end_of_days_number' => 'th',
13
+  'end_of_days_number' => 'th',
14 14
 
15 15
 
16 16
 
17
- /************************************************************
17
+  /************************************************************
18 18
   *                        Convert to
19 19
   ************************************************************
20 20
   *
@@ -22,13 +22,13 @@  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
33 33
     ************************************************************
34 34
     *
@@ -36,13 +36,13 @@  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
-     return null;
41
+      return null;
42 42
 
43
-   },
43
+    },
44 44
 
45
-   /************************************************************
45
+    /************************************************************
46 46
     *               Shorthand for jalali calendar
47 47
     ************************************************************
48 48
     *
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
     *
51 51
     *\_________________________________________________________/
52 52
     */
53
-   'shorthand' => 'gr',
53
+    'shorthand' => 'gr',
54 54
 
55
-   /************************************************************
55
+    /************************************************************
56 56
     *                        Month's name
57 57
     ************************************************************
58 58
     *
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
 
87 87
       'December'
88 88
 
89
-     ),
89
+      ),
90 90
 
91
-   /************************************************************
91
+    /************************************************************
92 92
     *                        Days of Week
93 93
     ************************************************************
94 94
     *
@@ -97,64 +97,64 @@  discard block
 block discarded – undo
97 97
     *
98 98
     *\_________________________________________________________/
99 99
     */
100
-   'days_of_week' => array (
100
+    'days_of_week' => array (
101 101
 
102
-       'Sunday',
103
-       'Monday',
104
-       'Tuesday',
105
-       'Wednesday',
106
-       'Thursday',
107
-       'Friday',
108
-       'Saturday'
102
+        'Sunday',
103
+        'Monday',
104
+        'Tuesday',
105
+        'Wednesday',
106
+        'Thursday',
107
+        'Friday',
108
+        'Saturday'
109 109
 
110 110
 
111
-   ),
111
+    ),
112 112
 
113
-   'month_days_number' => array(   1 => 31,
114
-                                   2 => 28,
115
-                                   3 => 31,
116
-                                   4 => 30,
117
-                                   5 => 31,
118
-                                   6 => 30,
119
-                                   7 => 31,
120
-                                   8 => 31,
121
-                                   9 => 30,
122
-                                   10 => 31,
123
-                                   11 => 30,
124
-                                   12 => 30 ),
113
+    'month_days_number' => array(   1 => 31,
114
+                                    2 => 28,
115
+                                    3 => 31,
116
+                                    4 => 30,
117
+                                    5 => 31,
118
+                                    6 => 30,
119
+                                    7 => 31,
120
+                                    8 => 31,
121
+                                    9 => 30,
122
+                                    10 => 31,
123
+                                    11 => 30,
124
+                                    12 => 30 ),
125 125
 
126 126
 
127
-   'day_of_year' => function( $date_time ) {
127
+    'day_of_year' => function( $date_time ) {
128 128
 
129
-     $result = null;
129
+      $result = null;
130 130
 
131
-     $_month = null;
131
+      $_month = null;
132 132
 
133
-     $config = include( 'Gregorian.php' );
133
+      $config = include( 'Gregorian.php' );
134 134
 
135
-     $month = $date_time->format('n');
135
+      $month = $date_time->format('n');
136 136
 
137
-     $day = $date_time->format('d');
137
+      $day = $date_time->format('d');
138 138
 
139
-     foreach( $config['month_days_number'] as $_month => $value ) {
139
+      foreach( $config['month_days_number'] as $_month => $value ) {
140 140
 
141
-       if ( $_month < $month ) $result += $value;
141
+        if ( $_month < $month ) $result += $value;
142 142
 
143
-     }
143
+      }
144 144
 
145
-     $result += $day;
145
+      $result += $day;
146 146
 
147
-     return $result;
147
+      return $result;
148 148
 
149
-   },
149
+    },
150 150
 
151 151
   'day_of_week' => function( $date_time ) {
152 152
 
153
-       return date( 'w', strtotime( $date_time->format('Y-m-d H:i:s') ) );
153
+        return date( 'w', strtotime( $date_time->format('Y-m-d H:i:s') ) );
154 154
 
155
-   },
155
+    },
156 156
 
157
-   /************************************************************
157
+    /************************************************************
158 158
     *                       Leap year
159 159
     ************************************************************
160 160
     *
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
     *
163 163
     *\_________________________________________________________/
164 164
     */
165
-   'leap_year' => null,
165
+    'leap_year' => null,
166 166
 
167
-   /************************************************************
167
+    /************************************************************
168 168
     *                        Weekend
169 169
     ************************************************************
170 170
     *
@@ -172,6 +172,6 @@  discard block
 block discarded – undo
172 172
     *
173 173
     *\_________________________________________________________/
174 174
     */
175
-   'weekend' => array( 'friday' )
175
+    'weekend' => array( 'friday' )
176 176
 
177 177
   );
Please login to merge, or discard this patch.
src/CalendarSettings/Shamsi.php 2 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -41,19 +41,19 @@  discard block
 block discarded – undo
41 41
 
42 42
         $temp_day = 0;
43 43
 
44
-         for ( $i = 1 ; $i < $month ; $i++ ) {
44
+          for ( $i = 1 ; $i < $month ; $i++ ) {
45 45
 
46
-           $temp_day += $config['month_days_number'][$i];
46
+            $temp_day += $config['month_days_number'][$i];
47 47
 
48
-         }
48
+          }
49 49
 
50
-         $temp_day += $day;
50
+          $temp_day += $day;
51 51
 
52
-         $leap = new Leap( $year );
52
+          $leap = new Leap( $year );
53 53
 
54
-         if( $leap->get() && $month > 2 ) $temp_day++;
54
+          if( $leap->get() && $month > 2 ) $temp_day++;
55 55
 
56
-         if ( $temp_day <= 79 ) {
56
+          if ( $temp_day <= 79 ) {
57 57
 
58 58
           if( ( $year - 1 ) % 4 == 0 )
59 59
 
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
 
82 82
           }
83 83
 
84
-         }
84
+          }
85 85
 
86
-         else {
86
+          else {
87 87
 
88 88
           $year = $year - 621;
89 89
 
@@ -129,11 +129,11 @@  discard block
 block discarded – undo
129 129
 
130 130
           }
131 131
 
132
-         }
132
+          }
133 133
 
134
-         $date_time->setDate( $year, $month, $day );
134
+          $date_time->setDate( $year, $month, $day );
135 135
 
136
-         return $date_time;
136
+          return $date_time;
137 137
 
138 138
   },
139 139
 
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
       $date_time->setDate( $gregorian_year, $gregorian_month, $gregorian_day );
204 204
 
205 205
 
206
-     return $date_time;
206
+      return $date_time;
207 207
 
208 208
   },
209 209
 
@@ -265,30 +265,30 @@  discard block
 block discarded – undo
265 265
   'days_of_week' => array (
266 266
 
267 267
 
268
-     'Yekshanbe',
269
-     'Doshanbe',
270
-     'Seshanbe',
271
-     'Chaharshanbe',
272
-     'Panjshanbe',
273
-     'Jome',
274
-     'Shanbe'
268
+      'Yekshanbe',
269
+      'Doshanbe',
270
+      'Seshanbe',
271
+      'Chaharshanbe',
272
+      'Panjshanbe',
273
+      'Jome',
274
+      'Shanbe'
275 275
   ),
276 276
 
277 277
 
278 278
   'start_day_of_week' => 'Shanbe',
279 279
 
280 280
   'month_days_number' => array(      1 => 31,
281
-                                     2 => 31,
282
-                                     3 => 31,
283
-                                     4 => 31,
284
-                                     5 => 31,
285
-                                     6 => 31,
286
-                                     7 => 30,
287
-                                     8 => 30,
288
-                                     9 => 30,
289
-                                     10 => 30,
290
-                                     11 => 30,
291
-                                     12 => 29 ),
281
+                                      2 => 31,
282
+                                      3 => 31,
283
+                                      4 => 31,
284
+                                      5 => 31,
285
+                                      6 => 31,
286
+                                      7 => 30,
287
+                                      8 => 30,
288
+                                      9 => 30,
289
+                                      10 => 30,
290
+                                      11 => 30,
291
+                                      12 => 29 ),
292 292
 
293 293
 
294 294
   'day_of_year' => function( $date_time ) {
@@ -355,4 +355,4 @@  discard block
 block discarded – undo
355 355
    */
356 356
   'weekend' => array( 'friday' )
357 357
 
358
- );
358
+  );
Please login to merge, or discard this patch.
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 use Datium\Datium as Datium;
4 4
 use Datium\Tools\Leap as Leap;
5 5
 
6
-return array (
6
+return array(
7 7
 
8 8
   'timezone' => 'Asia/Tehran',
9 9
 
@@ -11,7 +11,7 @@  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
   'day_to_nigh' => 'AM',
17 17
 
@@ -29,19 +29,19 @@  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
-        $config = include( 'Gregorian.php' );
34
+        $config = include('Gregorian.php');
35 35
 
36
-        $year = $date_time->format( 'Y' );
36
+        $year = $date_time->format('Y');
37 37
 
38
-        $month = $date_time->format( 'm' );
38
+        $month = $date_time->format('m');
39 39
 
40
-        $day = $date_time->format( 'd' );
40
+        $day = $date_time->format('d');
41 41
 
42 42
         $temp_day = 0;
43 43
 
44
-         for ( $i = 1 ; $i < $month ; $i++ ) {
44
+         for ($i = 1; $i < $month; $i++) {
45 45
 
46 46
            $temp_day += $config['month_days_number'][$i];
47 47
 
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
 
50 50
          $temp_day += $day;
51 51
 
52
-         $leap = new Leap( $year );
52
+         $leap = new Leap($year);
53 53
 
54
-         if( $leap->get() && $month > 2 ) $temp_day++;
54
+         if ($leap->get() && $month > 2) $temp_day++;
55 55
 
56
-         if ( $temp_day <= 79 ) {
56
+         if ($temp_day <= 79) {
57 57
 
58
-          if( ( $year - 1 ) % 4 == 0 )
58
+          if (($year - 1) % 4 == 0)
59 59
 
60 60
             $temp_day = $temp_day + 11;
61 61
 
@@ -65,9 +65,9 @@  discard block
 block discarded – undo
65 65
 
66 66
           $year = $year - 622;
67 67
 
68
-          if($temp_day % 30 == 0) {
68
+          if ($temp_day % 30 == 0) {
69 69
 
70
-            $month = ( $temp_day / 30 ) + 9;
70
+            $month = ($temp_day / 30) + 9;
71 71
 
72 72
             $day = 30;
73 73
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 
76 76
           else {
77 77
 
78
-            $month = ( $temp_day / 30 ) + 10;
78
+            $month = ($temp_day / 30) + 10;
79 79
 
80 80
             $day = $temp_day % 30;
81 81
 
@@ -89,20 +89,20 @@  discard block
 block discarded – undo
89 89
 
90 90
           $temp_day = $temp_day - 79;
91 91
 
92
-          if( $temp_day <= 186 ) {
92
+          if ($temp_day <= 186) {
93 93
 
94
-            if( $temp_day % 31 == 0 ) {
94
+            if ($temp_day % 31 == 0) {
95 95
 
96
-              $month = ( $temp_day / 31 );
96
+              $month = ($temp_day / 31);
97 97
 
98 98
               $day = 31;
99 99
             }
100 100
 
101 101
           else {
102 102
 
103
-            $month = ( $temp_day / 31 ) + 1;
103
+            $month = ($temp_day / 31) + 1;
104 104
 
105
-            $day = ( $temp_day % 31 );
105
+            $day = ($temp_day % 31);
106 106
           }
107 107
 
108 108
           }
@@ -111,9 +111,9 @@  discard block
 block discarded – undo
111 111
 
112 112
             $temp_day = $temp_day - 186;
113 113
 
114
-            if( $temp_day % 30 == 0 ) {
114
+            if ($temp_day % 30 == 0) {
115 115
 
116
-            $month = ( $temp_day / 30 ) + 6;
116
+            $month = ($temp_day / 30) + 6;
117 117
 
118 118
             $day = 30;
119 119
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 
122 122
             else {
123 123
 
124
-            $month = ( $temp_day / 30 ) + 7;
124
+            $month = ($temp_day / 30) + 7;
125 125
 
126 126
             $day = $temp_day % 30;
127 127
 
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 
132 132
          }
133 133
 
134
-         $date_time->setDate( $year, $month, $day );
134
+         $date_time->setDate($year, $month, $day);
135 135
 
136 136
          return $date_time;
137 137
 
@@ -145,9 +145,9 @@  discard block
 block discarded – undo
145 145
    *
146 146
    *\_________________________________________________________/
147 147
    */
148
-  'convert_from' => function( $date_time ) {
148
+  'convert_from' => function($date_time) {
149 149
 
150
-    $config = include( 'Shamsi.php' );
150
+    $config = include('Shamsi.php');
151 151
 
152 152
     $year = $date_time->format('Y');
153 153
 
@@ -157,41 +157,41 @@  discard block
 block discarded – undo
157 157
 
158 158
     $days_of_year = 0;
159 159
 
160
-    foreach ( $config['month_days_number'] as $mon => $value ) {
160
+    foreach ($config['month_days_number'] as $mon => $value) {
161 161
 
162
-      if( $month > $mon ) $days_of_year += $value;
162
+      if ($month > $mon) $days_of_year += $value;
163 163
 
164 164
     }
165 165
 
166 166
     $days_of_year += $day;
167 167
 
168
-    $days_of_leap_years =  intval( ( ( $year - 1 ) / 4 )  );
168
+    $days_of_leap_years = intval((($year - 1) / 4));
169 169
 
170
-    $days_of_shamsi_years = ( ( ( $year - 1 ) * 365 ) + $days_of_year + $days_of_leap_years );
170
+    $days_of_shamsi_years = ((($year - 1) * 365) + $days_of_year + $days_of_leap_years);
171 171
 
172 172
     $days_of_gregorain_years = $days_of_shamsi_years + 226899;
173 173
 
174
-    if ( $month < 10 )  {
174
+    if ($month < 10) {
175 175
 
176
-    $days_of_gregorain_years = $days_of_gregorain_years - intval( ( ( $year + 621 ) / 4 ) );
176
+    $days_of_gregorain_years = $days_of_gregorain_years - intval((($year + 621) / 4));
177 177
 
178 178
     }
179 179
 
180
-    elseif ( ( ( 10 == $month ) && ( $day > 10 ) ) || ( $month > 10 ) ) {
180
+    elseif (((10 == $month) && ($day > 10)) || ($month > 10)) {
181 181
 
182
-    $days_of_gregorain_years = $days_of_gregorain_years - intval( ( ( $year + 622 ) / 4 ) );
182
+    $days_of_gregorain_years = $days_of_gregorain_years - intval((($year + 622) / 4));
183 183
 
184 184
     }
185 185
 
186
-    $gregorian_month = ( $days_of_gregorain_years % 365 );
186
+    $gregorian_month = ($days_of_gregorain_years % 365);
187 187
 
188
-    $gregorian_year = intval( $days_of_gregorain_years / 365 ) + 1;
188
+    $gregorian_year = intval($days_of_gregorain_years / 365) + 1;
189 189
 
190
-    $config = include( 'Gregorian.php' );
190
+    $config = include('Gregorian.php');
191 191
 
192
-    foreach ( $config['month_days_number'] as $month => $value ) {
192
+    foreach ($config['month_days_number'] as $month => $value) {
193 193
 
194
-      if ( $gregorian_month < $value ) break;
194
+      if ($gregorian_month < $value) break;
195 195
 
196 196
         $gregorian_month -= $value;
197 197
     }
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 
201 201
       $gregorian_month = $month;
202 202
 
203
-      $date_time->setDate( $gregorian_year, $gregorian_month, $gregorian_day );
203
+      $date_time->setDate($gregorian_year, $gregorian_month, $gregorian_day);
204 204
 
205 205
 
206 206
      return $date_time;
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
    *
226 226
    *\_________________________________________________________/
227 227
    */
228
-  'month' => array (
228
+  'month' => array(
229 229
 
230 230
     'Farvardin',
231 231
 
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
    *
263 263
    *\_________________________________________________________/
264 264
    */
265
-  'days_of_week' => array (
265
+  'days_of_week' => array(
266 266
 
267 267
 
268 268
      'Yekshanbe',
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 
278 278
   'start_day_of_week' => 'Shanbe',
279 279
 
280
-  'month_days_number' => array(      1 => 31,
280
+  'month_days_number' => array(1 => 31,
281 281
                                      2 => 31,
282 282
                                      3 => 31,
283 283
                                      4 => 31,
@@ -288,22 +288,22 @@  discard block
 block discarded – undo
288 288
                                      9 => 30,
289 289
                                      10 => 30,
290 290
                                      11 => 30,
291
-                                     12 => 29 ),
291
+                                     12 => 29),
292 292
 
293 293
 
294
-  'day_of_year' => function( $date_time ) {
294
+  'day_of_year' => function($date_time) {
295 295
 
296 296
     $result = null;
297 297
 
298
-    $config = include( 'Shamsi.php' );
298
+    $config = include('Shamsi.php');
299 299
 
300 300
     $month = $date_time->format('n');
301 301
 
302 302
     $day = $date_time->format('d');
303 303
 
304
-    foreach( $config['month_days_number'] as $_month => $value ) {
304
+    foreach ($config['month_days_number'] as $_month => $value) {
305 305
 
306
-      if ( $_month < $month ) $result += $value;
306
+      if ($_month < $month) $result += $value;
307 307
 
308 308
     }
309 309
 
@@ -313,19 +313,19 @@  discard block
 block discarded – undo
313 313
 
314 314
   },
315 315
 
316
-  'day_of_week' => function( $date_time ) {
316
+  'day_of_week' => function($date_time) {
317 317
 
318
-        $configShamsi = include(  'Shamsi.php' );
318
+        $configShamsi = include('Shamsi.php');
319 319
 
320
-        $configGregorian = include( 'Gregorian.php' );
320
+        $configGregorian = include('Gregorian.php');
321 321
 
322 322
         $day = $date_time->format('l');
323 323
 
324
-        $day = str_replace( $configGregorian['days_of_week'], $configShamsi['days_of_week'], $day );
324
+        $day = str_replace($configGregorian['days_of_week'], $configShamsi['days_of_week'], $day);
325 325
 
326
-        foreach ( $configShamsi['days_of_week'] as $key => $value ) {
326
+        foreach ($configShamsi['days_of_week'] as $key => $value) {
327 327
 
328
-          if( $day == $value ) {
328
+          if ($day == $value) {
329 329
 
330 330
               return $key += 1;
331 331
 
@@ -353,6 +353,6 @@  discard block
 block discarded – undo
353 353
    *
354 354
    *\_________________________________________________________/
355 355
    */
356
-  'weekend' => array( 'friday' )
356
+  'weekend' => array('friday')
357 357
 
358 358
  );
Please login to merge, or discard this patch.