Completed
Push — master ( d5f8b0...0fe70c )
by mehdi
02:20
created
src/Convert.php 2 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -63,6 +63,10 @@
 block discarded – undo
63 63
    *
64 64
    *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
65 65
    */
66
+
67
+  /**
68
+   * @param \DateTime $date_time
69
+   */
66 70
   public function __construct( $date_time = NULL ) {
67 71
 
68 72
     if ( $date_time !== NULL ) {
Please login to merge, or discard this patch.
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -63,23 +63,23 @@  discard block
 block discarded – undo
63 63
    *
64 64
    *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
65 65
    */
66
-  public function __construct( $date_time = NULL ) {
66
+  public function __construct($date_time = NULL) {
67 67
 
68
-    if ( $date_time !== NULL ) {
68
+    if ($date_time !== NULL) {
69 69
 
70 70
         $this->date_time = $date_time;
71 71
 
72 72
     }
73 73
 
74
-    $this->config = include( 'Config.php' );
74
+    $this->config = include('Config.php');
75 75
 
76 76
   }
77 77
 
78
-  public function from( $calendar ) {
78
+  public function from($calendar) {
79 79
 
80
-    $this->calendar_file = include( 'CalendarSettings/' . ucfirst( $calendar ) . '.php' );
80
+    $this->calendar_file = include('CalendarSettings/'.ucfirst($calendar).'.php');
81 81
 
82
-    return $this->calendar_file[ 'convert_from' ]( $this->date_time );
82
+    return $this->calendar_file['convert_from']($this->date_time);
83 83
 
84 84
   }
85 85
 
@@ -91,11 +91,11 @@  discard block
 block discarded – undo
91 91
    *
92 92
    *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
93 93
    */
94
-  public function to( $calendar ) {
94
+  public function to($calendar) {
95 95
 
96
-    $this->calendar_file = include( 'CalendarSettings/' . ucfirst( $calendar ) . '.php' );
96
+    $this->calendar_file = include('CalendarSettings/'.ucfirst($calendar).'.php');
97 97
 
98
-    return $this->calendar_file[ 'convert_to' ]( $this->date_time );
98
+    return $this->calendar_file['convert_to']($this->date_time);
99 99
 
100 100
   }
101 101
 
@@ -104,9 +104,9 @@  discard block
 block discarded – undo
104 104
    * @since Oct, 16 2015
105 105
    * @return object
106 106
    */
107
-public function shamsiToGregorian( $date_time ) {
107
+public function shamsiToGregorian($date_time) {
108 108
 
109
-$this->config = include( 'Shamsi.php' );
109
+$this->config = include('Shamsi.php');
110 110
 
111 111
 $this->date_time = $date_time;
112 112
 
@@ -118,41 +118,41 @@  discard block
 block discarded – undo
118 118
 
119 119
 $days_of_year = 0;
120 120
 
121
-foreach ( $this->config['month_days_number'] as $month => $value ) {
121
+foreach ($this->config['month_days_number'] as $month => $value) {
122 122
 
123
-  if( $this->month > $month ) $days_of_year += $value;
123
+  if ($this->month > $month) $days_of_year += $value;
124 124
 
125 125
 }
126 126
 
127 127
 $days_of_year += $this->day;
128 128
 
129
-$days_of_leap_years =  intval( ( ( $this->year - 1 ) / 4 )  );
129
+$days_of_leap_years = intval((($this->year - 1) / 4));
130 130
 
131
-$days_of_shamsi_years = ( ( ( $this->year - 1 ) * 365 ) + $days_of_year + $days_of_leap_years );
131
+$days_of_shamsi_years = ((($this->year - 1) * 365) + $days_of_year + $days_of_leap_years);
132 132
 
133 133
 $days_of_gregorain_years = $days_of_shamsi_years + 226899;
134 134
 
135
-if ( $this->month < 10 )  {
135
+if ($this->month < 10) {
136 136
 
137
-$days_of_gregorain_years = $days_of_gregorain_years - intval( ( ( $this->year + 621 ) / 4 ) );
137
+$days_of_gregorain_years = $days_of_gregorain_years - intval((($this->year + 621) / 4));
138 138
 
139 139
 }
140 140
 
141
-elseif ( ( ( 10 == $this->month ) && ( $this->day > 10 ) ) || ( $this->month > 10 ) ) {
141
+elseif (((10 == $this->month) && ($this->day > 10)) || ($this->month > 10)) {
142 142
 
143
-$days_of_gregorain_years = $days_of_gregorain_years - intval( ( ( $this->year + 622 ) / 4 ) );
143
+$days_of_gregorain_years = $days_of_gregorain_years - intval((($this->year + 622) / 4));
144 144
 
145 145
 }
146 146
 
147
-$gregorian_month = ( $days_of_gregorain_years % 365 );
147
+$gregorian_month = ($days_of_gregorain_years % 365);
148 148
 
149
-$gregorian_year = intval( $days_of_gregorain_years / 365 ) + 1;
149
+$gregorian_year = intval($days_of_gregorain_years / 365) + 1;
150 150
 
151
-$this->config = include( 'Gregorian.php' );
151
+$this->config = include('Gregorian.php');
152 152
 
153 153
 foreach ($this->config['month_days_number'] as $month => $value) {
154 154
 
155
-  if ( $gregorian_month < $value ) break;
155
+  if ($gregorian_month < $value) break;
156 156
 
157 157
     $gregorian_month -= $value;
158 158
 }
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 
162 162
   $gregorian_month = $month;
163 163
 
164
-  $this->date_time->setDate( $gregorian_year, $gregorian_month, $gregorian_day );
164
+  $this->date_time->setDate($gregorian_year, $gregorian_month, $gregorian_day);
165 165
 
166 166
 
167 167
  return $this->date_time;
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
    * @since Oct, 17 2015
174 174
    * @return object
175 175
    */
176
-public function shamsiToGhamari( $date_time ) {
176
+public function shamsiToGhamari($date_time) {
177 177
 
178 178
     $this->date_time = $date_time;
179 179
 
@@ -183,11 +183,11 @@  discard block
 block discarded – undo
183 183
 
184 184
     $this->day = $this->date_time->format('d');
185 185
 
186
-    $this->temp_day = 0 ;
186
+    $this->temp_day = 0;
187 187
 
188
-    $this->config = include( 'Shamsi.php' );
188
+    $this->config = include('Shamsi.php');
189 189
 
190
-    for ( $i = 1 ; $i < $this->month ; $i++ ) {
190
+    for ($i = 1; $i < $this->month; $i++) {
191 191
 
192 192
         $this->temp_day += $this->config['month_days_number'][$i];
193 193
 
@@ -195,13 +195,13 @@  discard block
 block discarded – undo
195 195
 
196 196
      $this->temp_day += $this->day;
197 197
 
198
-     $this->leap = new Leap( $this->year );
198
+     $this->leap = new Leap($this->year);
199 199
 
200
-    if( $this->leap->get() && $this->month > 11 ) $this->temp_day++;
200
+    if ($this->leap->get() && $this->month > 11) $this->temp_day++;
201 201
 
202
-    $_year = ( ( ( ( ( $this->year - 1 ) * 365.2422 ) + $this->temp_day ) - 119) / 354.3670 ) + 1;
202
+    $_year = ((((($this->year - 1) * 365.2422) + $this->temp_day) - 119) / 354.3670) + 1;
203 203
 
204
-    $_year = explode( '.', $_year );
204
+    $_year = explode('.', $_year);
205 205
 
206 206
     $this->year = $_year[0];
207 207
 
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 
210 210
      $var_temp = '0.0';
211 211
 
212
-      for ( $i = strlen( $_month ); $i > 2; $i-- ) {
212
+      for ($i = strlen($_month); $i > 2; $i--) {
213 213
 
214 214
         $var_temp .= '0';
215 215
 
@@ -217,11 +217,11 @@  discard block
 block discarded – undo
217 217
 
218 218
      $var_temp .= '1';
219 219
 
220
-    $_month = $_month * $var_temp ;
220
+    $_month = $_month * $var_temp;
221 221
 
222
-    $_month = ( $_month * 12 ) + 1;
222
+    $_month = ($_month * 12) + 1;
223 223
 
224
-    $_month = explode( '.', $_month );
224
+    $_month = explode('.', $_month);
225 225
 
226 226
     $this->month = $_month[0];
227 227
 
@@ -229,9 +229,9 @@  discard block
 block discarded – undo
229 229
 
230 230
     $var_temp = '0.0';
231 231
 
232
-    for ( $i = strlen( $_day );  $i > 2;  $i-- ) {
232
+    for ($i = strlen($_day); $i > 2; $i--) {
233 233
 
234
-       $var_temp .= '0' ;
234
+       $var_temp .= '0';
235 235
 
236 236
     }
237 237
 
@@ -239,13 +239,13 @@  discard block
 block discarded – undo
239 239
 
240 240
     $_day = $_day * $var_temp;
241 241
 
242
-    $_day = ( $_day * 29.530 );
242
+    $_day = ($_day * 29.530);
243 243
 
244
-    $_day = explode( '.', $_day );
244
+    $_day = explode('.', $_day);
245 245
 
246 246
     $this->day = $_day[0];
247 247
 
248
-   $this->date_time->setDate( $this->year, $this->month, $this->day );
248
+   $this->date_time->setDate($this->year, $this->month, $this->day);
249 249
 
250 250
    return $this->date_time;
251 251
 
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
    * @since Oct, 17 2015
257 257
    * @return object
258 258
    */
259
-public function ghamariToShamsi( $date_time ) {
259
+public function ghamariToShamsi($date_time) {
260 260
 
261 261
 $this->date_time = $date_time;
262 262
 
@@ -268,33 +268,33 @@  discard block
 block discarded – undo
268 268
 
269 269
 $days_of_year = 0;
270 270
 
271
-$this->config = include( 'Ghamari.php' );
271
+$this->config = include('Ghamari.php');
272 272
 
273
-foreach ( $this->config['month_days_number'] as $month => $value ) {
273
+foreach ($this->config['month_days_number'] as $month => $value) {
274 274
 
275
-  if( $this->month > $month ) $days_of_year += $value;
275
+  if ($this->month > $month) $days_of_year += $value;
276 276
 
277 277
 }
278 278
 
279 279
 $days_of_year += $this->day;
280 280
 
281
-$days_of_leap_years =  intval( ( ( $this->year - 1 ) / 3 )  );
281
+$days_of_leap_years = intval((($this->year - 1) / 3));
282 282
 
283
-$days_of_ghamari_years = ( ( ( $this->year - 1 ) * 354 ) + $days_of_year + $days_of_leap_years );
283
+$days_of_ghamari_years = ((($this->year - 1) * 354) + $days_of_year + $days_of_leap_years);
284 284
 
285 285
 $days_of_shamsi_years = $days_of_ghamari_years + 179;
286 286
 
287
-$days_of_shamsi_years = $days_of_shamsi_years - intval( ( ( $this->year - 43 ) / 4 ) );
287
+$days_of_shamsi_years = $days_of_shamsi_years - intval((($this->year - 43) / 4));
288 288
 
289
-$shamsi_month = ( $days_of_shamsi_years % 365 );
289
+$shamsi_month = ($days_of_shamsi_years % 365);
290 290
 
291
-$shamsi_year = intval( $days_of_shamsi_years / 365 ) + 1;
291
+$shamsi_year = intval($days_of_shamsi_years / 365) + 1;
292 292
 
293
-$this->config = include( 'Shamsi.php' );
293
+$this->config = include('Shamsi.php');
294 294
 
295 295
 foreach ($this->config['month_days_number'] as $month => $value) {
296 296
 
297
-  if ( $shamsi_month < $value ) break;
297
+  if ($shamsi_month < $value) break;
298 298
 
299 299
     $shamsi_month -= $value;
300 300
 }
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 
304 304
   $shamsi_month = $month;
305 305
 
306
-  $this->date_time->setDate( $shamsi_year, $shamsi_month, $shamsi_day );
306
+  $this->date_time->setDate($shamsi_year, $shamsi_month, $shamsi_day);
307 307
 
308 308
  return $this->date_time;
309 309
 
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
     * @since Oct, 17 2015
315 315
     * @return object
316 316
     */
317
-  public function ghamariToGregorian( $date_time ) {
317
+  public function ghamariToGregorian($date_time) {
318 318
 
319 319
     $this->date_time = $date_time;
320 320
 
@@ -326,33 +326,33 @@  discard block
 block discarded – undo
326 326
 
327 327
     $days_of_year = 0;
328 328
 
329
-    $this->config = include( 'Ghamari.php' );
329
+    $this->config = include('Ghamari.php');
330 330
 
331
-    foreach ( $this->config['month_days_number'] as $month => $value ) {
331
+    foreach ($this->config['month_days_number'] as $month => $value) {
332 332
 
333
-      if( $this->month > $month ) $days_of_year += $value;
333
+      if ($this->month > $month) $days_of_year += $value;
334 334
 
335 335
     }
336 336
 
337 337
     $days_of_year += $this->day;
338 338
 
339
-    $days_of_leap_years =  intval( ( ( $this->year - 1 ) / 3 )  );
339
+    $days_of_leap_years = intval((($this->year - 1) / 3));
340 340
 
341
-    $days_of_ghamari_years = ( ( ( $this->year - 1 ) * 354 ) + $days_of_year + $days_of_leap_years );
341
+    $days_of_ghamari_years = ((($this->year - 1) * 354) + $days_of_year + $days_of_leap_years);
342 342
 
343 343
     $days_of_gregorain_years = $days_of_ghamari_years + 227078;
344 344
 
345
-    $days_of_gregorain_years = $days_of_gregorain_years - intval( ( ( $this->year + 578 ) / 4 ) );
345
+    $days_of_gregorain_years = $days_of_gregorain_years - intval((($this->year + 578) / 4));
346 346
 
347
-    $gregorian_month = ( $days_of_gregorain_years % 365 );
347
+    $gregorian_month = ($days_of_gregorain_years % 365);
348 348
 
349
-    $gregorian_year = intval( $days_of_gregorain_years / 365 ) + 1;
349
+    $gregorian_year = intval($days_of_gregorain_years / 365) + 1;
350 350
 
351
-    $this->config = include( 'Gregorian.php' );
351
+    $this->config = include('Gregorian.php');
352 352
 
353 353
     foreach ($this->config['month_days_number'] as $month => $value) {
354 354
 
355
-      if ( $gregorian_month < $value ) break;
355
+      if ($gregorian_month < $value) break;
356 356
 
357 357
         $gregorian_month -= $value;
358 358
     }
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 
362 362
       $gregorian_month = $month;
363 363
 
364
-      $this->date_time->setDate( $gregorian_year, $gregorian_month, $gregorian_day );
364
+      $this->date_time->setDate($gregorian_year, $gregorian_month, $gregorian_day);
365 365
 
366 366
      return $this->date_time;
367 367
 
Please login to merge, or discard this patch.
src/Datium.php 2 patches
Doc Comments   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
   /**
139 139
    * Get current datetime
140 140
    * @since Aug 17 2015
141
-   * @return object
141
+   * @return Datium
142 142
    */
143 143
   public static function now() {
144 144
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
    * @param $hour integer
157 157
    * @param $minute integer
158 158
    * @param $second integer
159
-   * @return object
159
+   * @return Datium
160 160
    */
161 161
   public static function create( $year = 2000, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0 ) {
162 162
 
@@ -195,6 +195,7 @@  discard block
 block discarded – undo
195 195
 
196 196
   /**
197 197
    * Convert from current calendar, what type is current calendar?
198
+   * @param string $calendar
198 199
    */
199 200
   public function from( $calendar ) {
200 201
 
@@ -213,6 +214,9 @@  discard block
 block discarded – undo
213 214
 
214 215
   }
215 216
 
217
+  /**
218
+   * @param string $calendar
219
+   */
216 220
   public function to( $calendar ) {
217 221
 
218 222
     $this->convert = new Convert( $this->date_time );
@@ -245,7 +249,7 @@  discard block
 block discarded – undo
245 249
   /**
246 250
    * Add new date value to current date
247 251
    * @param $value string
248
-   * @return object
252
+   * @return Datium
249 253
    */
250 254
   public function add( $value ) {
251 255
 
@@ -262,7 +266,7 @@  discard block
 block discarded – undo
262 266
   /**
263 267
    * Sub date from current date
264 268
    * @param $value
265
-   * @return obejct
269
+   * @return Datium
266 270
    */
267 271
   public function sub( $value ) {
268 272
 
@@ -278,7 +282,7 @@  discard block
 block discarded – undo
278 282
 
279 283
   /**
280 284
    * Check if current year is leap or not
281
-   * @return boolean
285
+   * @return Leap
282 286
    */
283 287
   public function leap( $type = 'gregorian') {
284 288
 
Please login to merge, or discard this patch.
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -68,17 +68,17 @@  discard block
 block discarded – undo
68 68
 
69 69
     $this->config = include('Config.php');
70 70
 
71
-    $this->calendar_type = $this->config[ 'default_calendar' ];
71
+    $this->calendar_type = $this->config['default_calendar'];
72 72
 
73
-    date_default_timezone_set( $this->config['timezone'] );
73
+    date_default_timezone_set($this->config['timezone']);
74 74
 
75 75
     $this->calendar_type = 'gregorian';
76 76
 
77
-    switch( Datium::$call_type ) {
77
+    switch (Datium::$call_type) {
78 78
 
79 79
       case 'now':
80 80
 
81
-        $this->date_time = new DateTime( 'now' );
81
+        $this->date_time = new DateTime('now');
82 82
 
83 83
         $this->gregorian_DayofWeek = $this->date_time->format('w');
84 84
 
@@ -86,11 +86,11 @@  discard block
 block discarded – undo
86 86
 
87 87
       case 'make':
88 88
 
89
-        $this->date_time = new DateTime( 'now' );
89
+        $this->date_time = new DateTime('now');
90 90
 
91
-        $this->date_time->setDate( self::$array_date['year'], self::$array_date['month'], self::$array_date['day'] );
91
+        $this->date_time->setDate(self::$array_date['year'], self::$array_date['month'], self::$array_date['day']);
92 92
 
93
-        $this->date_time->setTime( self::$array_date['hour'], self::$array_date['minute'], self::$array_date['second'] );
93
+        $this->date_time->setTime(self::$array_date['hour'], self::$array_date['minute'], self::$array_date['second']);
94 94
 
95 95
         $this->gregorian_DayofWeek = $this->date_time->format('w');
96 96
 
@@ -119,17 +119,17 @@  discard block
 block discarded – undo
119 119
 
120 120
     return (object) array(
121 121
 
122
-      'second' => $this->date_time->format( 's' ),
122
+      'second' => $this->date_time->format('s'),
123 123
 
124
-      'minute' => $this->date_time->format( 'm' ),
124
+      'minute' => $this->date_time->format('m'),
125 125
 
126
-      'hour' => $this->date_time->format( 'H' ),
126
+      'hour' => $this->date_time->format('H'),
127 127
 
128
-      'day' => $this->date_time->format( 'd' ),
128
+      'day' => $this->date_time->format('d'),
129 129
 
130
-      'month' => $this->date_time->format( 'm' ),
130
+      'month' => $this->date_time->format('m'),
131 131
 
132
-      'year' => $this->date_time->format( 'Y' )
132
+      'year' => $this->date_time->format('Y')
133 133
 
134 134
     );
135 135
 
@@ -158,12 +158,12 @@  discard block
 block discarded – undo
158 158
    * @param $second integer
159 159
    * @return object
160 160
    */
161
-  public static function create( $year = 2000, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0 ) {
161
+  public static function create($year = 2000, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0) {
162 162
 
163 163
       /**
164 164
        * When we want to set a Datetime object to Datium
165 165
        */
166
-      if( func_num_args() === 1 ) {
166
+      if (func_num_args() === 1) {
167 167
 
168 168
         self::$static_date_time = func_get_arg(0);
169 169
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 
172 172
       } else {
173 173
 
174
-        self::$array_date = array( 'year' => $year, 'month' => $month, 'day' => $day, 'hour' => $hour, 'minute' => $minute, 'second' => $second );
174
+        self::$array_date = array('year' => $year, 'month' => $month, 'day' => $day, 'hour' => $hour, 'minute' => $minute, 'second' => $second);
175 175
 
176 176
         self::$call_type = 'make';
177 177
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 
182 182
   }
183 183
 
184
-  public static function between( $date_start, $date_end ) {
184
+  public static function between($date_start, $date_end) {
185 185
 
186 186
     self::$date_start = $date_start;
187 187
 
@@ -196,11 +196,11 @@  discard block
 block discarded – undo
196 196
   /**
197 197
    * Convert from current calendar, what type is current calendar?
198 198
    */
199
-  public function from( $calendar ) {
199
+  public function from($calendar) {
200 200
 
201
-    $this->convert = new Convert( $this->date_time );
201
+    $this->convert = new Convert($this->date_time);
202 202
 
203
-    $this->date_time = $this->convert->from( $calendar );
203
+    $this->date_time = $this->convert->from($calendar);
204 204
 
205 205
     /**
206 206
      * We need this part for DayOf class
@@ -213,11 +213,11 @@  discard block
 block discarded – undo
213 213
 
214 214
   }
215 215
 
216
-  public function to( $calendar ) {
216
+  public function to($calendar) {
217 217
 
218
-    $this->convert = new Convert( $this->date_time );
218
+    $this->convert = new Convert($this->date_time);
219 219
 
220
-    $this->date_time = $this->convert->to( $calendar );
220
+    $this->date_time = $this->convert->to($calendar);
221 221
 
222 222
     /**
223 223
      * We need this part for DayOf class
@@ -236,9 +236,9 @@  discard block
 block discarded – undo
236 236
    * @param $start datetime
237 237
    * @param $end datetime
238 238
    */
239
-  public static function diff( $start, $end ) {
239
+  public static function diff($start, $end) {
240 240
 
241
-    return date_diff( $start, $end );
241
+    return date_diff($start, $end);
242 242
 
243 243
   }
244 244
 
@@ -247,13 +247,13 @@  discard block
 block discarded – undo
247 247
    * @param $value string
248 248
    * @return object
249 249
    */
250
-  public function add( $value ) {
250
+  public function add($value) {
251 251
 
252
-    $this->date_interval_expression = str_replace( $this->config['date_simple'], $this->config['date_interval'], $value );
252
+    $this->date_interval_expression = str_replace($this->config['date_simple'], $this->config['date_interval'], $value);
253 253
 
254
-    $this->date_interval_expression = str_replace( ' ', '', 'P' . $this->date_interval_expression );
254
+    $this->date_interval_expression = str_replace(' ', '', 'P'.$this->date_interval_expression);
255 255
 
256
-    $this->date_time->add( new DateInterval( $this->date_interval_expression ) );
256
+    $this->date_time->add(new DateInterval($this->date_interval_expression));
257 257
 
258 258
     return $this;
259 259
 
@@ -264,13 +264,13 @@  discard block
 block discarded – undo
264 264
    * @param $value
265 265
    * @return obejct
266 266
    */
267
-  public function sub( $value ) {
267
+  public function sub($value) {
268 268
 
269
-    $this->date_interval_expression = str_replace( $this->config['date_simple'], $this->config['date_interval'], $value );
269
+    $this->date_interval_expression = str_replace($this->config['date_simple'], $this->config['date_interval'], $value);
270 270
 
271
-    $this->date_interval_expression = str_replace( ' ', '', 'P' . $this->date_interval_expression );
271
+    $this->date_interval_expression = str_replace(' ', '', 'P'.$this->date_interval_expression);
272 272
 
273
-    $this->date_time->sub( new DateInterval( $this->date_interval_expression ) );
273
+    $this->date_time->sub(new DateInterval($this->date_interval_expression));
274 274
 
275 275
     return $this;
276 276
 
@@ -280,9 +280,9 @@  discard block
 block discarded – undo
280 280
    * Check if current year is leap or not
281 281
    * @return boolean
282 282
    */
283
-  public function leap( $type = 'gregorian') {
283
+  public function leap($type = 'gregorian') {
284 284
 
285
-    $this->leap = new Leap( $this->date_time->format( 'Y' ), $type );
285
+    $this->leap = new Leap($this->date_time->format('Y'), $type);
286 286
 
287 287
     return $this->leap;
288 288
 
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
    */
294 294
   public function dayOf() {
295 295
 
296
-    $this->day_of = new DayOf( $this->date_time, $this->calendar_type );
296
+    $this->day_of = new DayOf($this->date_time, $this->calendar_type);
297 297
 
298 298
     return $this->day_of;
299 299
 
@@ -304,13 +304,13 @@  discard block
 block discarded – undo
304 304
    */
305 305
   public function events() {
306 306
 
307
-    if ( Datium::$call_type == 'between' ) {
307
+    if (Datium::$call_type == 'between') {
308 308
 
309
-      $this->events = new Events( Datium::$date_start, Datium::$date_end );
309
+      $this->events = new Events(Datium::$date_start, Datium::$date_end);
310 310
 
311 311
     } else {
312 312
 
313
-      $this->events = new Events( $this->date_time );
313
+      $this->events = new Events($this->date_time);
314 314
 
315 315
     }
316 316
 
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
    *
328 328
    *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
329 329
    */
330
-  public function object(){
330
+  public function object() {
331 331
 
332 332
     return $this->date_time;
333 333
 
@@ -339,17 +339,17 @@  discard block
 block discarded – undo
339 339
    * @param $calendar string
340 340
    * @param $format string
341 341
    */
342
-  public function get( $format = 'Y-m-d H:i:s' ) {
342
+  public function get($format = 'Y-m-d H:i:s') {
343 343
 
344
-      $fromConfig = include( 'CalendarSettings/' . ucfirst( $this->translate_from ) . '.php' );
344
+      $fromConfig = include('CalendarSettings/'.ucfirst($this->translate_from).'.php');
345 345
 
346
-      $toConfig = include( 'CalendarSettings/' . ucfirst( $this->translate_to ) . '.php' );
346
+      $toConfig = include('CalendarSettings/'.ucfirst($this->translate_to).'.php');
347 347
 
348
-      $string_date = $this->date_time->format( $format );
348
+      $string_date = $this->date_time->format($format);
349 349
 
350
-      $string_date = str_replace( $fromConfig['month'], $toConfig['month'],  $string_date );
350
+      $string_date = str_replace($fromConfig['month'], $toConfig['month'], $string_date);
351 351
 
352
-      $string_date = str_replace( $fromConfig['days_of_week'], $toConfig['days_of_week'],  $string_date );
352
+      $string_date = str_replace($fromConfig['days_of_week'], $toConfig['days_of_week'], $string_date);
353 353
 
354 354
       return $string_date;
355 355
 
Please login to merge, or discard this patch.
src/DayOf.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -19,9 +19,9 @@  discard block
 block discarded – undo
19 19
 
20 20
   protected $geregorian_DayofWeek;
21 21
 
22
-  public function __construct( $date_time, $calendar_type = 'gregorian' ) {
22
+  public function __construct($date_time, $calendar_type = 'gregorian') {
23 23
 
24
-    $this->config = include( 'Config.php' );
24
+    $this->config = include('Config.php');
25 25
 
26 26
     $this->date_time = $date_time;
27 27
 
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
    */
39 39
   public function year() {
40 40
 
41
-    $this->config = include(  'CalendarSettings/' . ucfirst( $this->calendar_type ) . '.php' );
41
+    $this->config = include('CalendarSettings/'.ucfirst($this->calendar_type).'.php');
42 42
 
43
-    return $this->config[ 'day_of_year' ]( $this->date_time );
43
+    return $this->config['day_of_year']($this->date_time);
44 44
 
45 45
   }
46 46
 
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
    */
53 53
   public function week() {
54 54
 
55
-    $this->config = include(  'CalendarSettings/' . ucfirst( $this->calendar_type ) . '.php' );
55
+    $this->config = include('CalendarSettings/'.ucfirst($this->calendar_type).'.php');
56 56
 
57
-    return $this->config[ 'day_of_week' ]( $this->date_time );
57
+    return $this->config['day_of_week']($this->date_time);
58 58
 
59 59
   }
60 60
 
Please login to merge, or discard this patch.
src/Events/Events.php 2 patches
Indentation   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -8,47 +8,47 @@  discard block
 block discarded – undo
8 8
 
9 9
 class Events {
10 10
 
11
-	private $local;
11
+  private $local;
12 12
 
13
-	private $events;
13
+  private $events;
14 14
 
15
-	private $date_time;
15
+  private $date_time;
16 16
 
17
-	private $convert;
17
+  private $convert;
18 18
 
19
-	private $result;
19
+  private $result;
20 20
 
21
-	private $period;
21
+  private $period;
22 22
 
23
-	private $interval;
23
+  private $interval;
24 24
 
25
-	private static $date_start;
25
+  private static $date_start;
26 26
 
27
-	private static $date_end;
27
+  private static $date_end;
28 28
 
29
-	public function __construct( $date_time, $date_end = NULL ) {
29
+  public function __construct( $date_time, $date_end = NULL ) {
30 30
 
31
-		if( $date_end !== NULL ) {
31
+    if( $date_end !== NULL ) {
32 32
 
33
-			Events::$date_start = $date_time;
33
+      Events::$date_start = $date_time;
34 34
 
35
-			Events::$date_end = $date_end;
35
+      Events::$date_end = $date_end;
36 36
 
37
-		} else {
37
+    } else {
38 38
 
39
-			Events::$date_start = $date_time;
39
+      Events::$date_start = $date_time;
40 40
 
41
-		}
41
+    }
42 42
 
43
-		$this->convert = new Convert;
43
+    $this->convert = new Convert;
44 44
 
45
-		$this->date_time = new DateTime();
45
+    $this->date_time = new DateTime();
46 46
 
47
-		return $this;
47
+    return $this;
48 48
 
49
-	}
49
+  }
50 50
 
51
-	/************************************************************
51
+  /************************************************************
52 52
 	 * Fetch Events array from own array file
53 53
 	 ************************************************************
54 54
 	 *
@@ -56,27 +56,27 @@  discard block
 block discarded – undo
56 56
 	 *
57 57
 	 *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
58 58
 	 */
59
-	private function fetch( $path ) {
59
+  private function fetch( $path ) {
60 60
 
61
-		$this->events = include( $path );
61
+    $this->events = include( $path );
62 62
 
63
-		$this->interval = DateInterval::createFromDateString('1 day');
63
+    $this->interval = DateInterval::createFromDateString('1 day');
64 64
 
65
-		$this->period = new DatePeriod( Events::$date_start, $this->interval, Events::$date_end );
65
+    $this->period = new DatePeriod( Events::$date_start, $this->interval, Events::$date_end );
66 66
 
67
-		foreach ( $this->period as $dt ) {
67
+    foreach ( $this->period as $dt ) {
68 68
 
69
-			if ( isset( $this->events[ 'events' ][ intval( $dt->format('m') ) ][ intval( $dt->format('d') ) ] ) ) {
69
+      if ( isset( $this->events[ 'events' ][ intval( $dt->format('m') ) ][ intval( $dt->format('d') ) ] ) ) {
70 70
 
71
-				$this->result[ $dt->format( 'Y-m-d' ) ][] = $this->events[ 'events' ][ intval( $dt->format('m') ) ][ intval( $dt->format('d') ) ];
71
+        $this->result[ $dt->format( 'Y-m-d' ) ][] = $this->events[ 'events' ][ intval( $dt->format('m') ) ][ intval( $dt->format('d') ) ];
72 72
 
73
-			}
73
+      }
74 74
 
75
-		}
75
+    }
76 76
 
77
-	}
77
+  }
78 78
 
79
-	/************************************************************
79
+  /************************************************************
80 80
 	 * Return Array of Events
81 81
 	 ************************************************************
82 82
 	 *
@@ -85,31 +85,31 @@  discard block
 block discarded – undo
85 85
 	 *
86 86
 	 *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
87 87
 	 */
88
-	public function get() {
88
+  public function get() {
89 89
 
90
-		if( ! empty( $this->result ) ) {
90
+    if( ! empty( $this->result ) ) {
91 91
 
92
-			foreach( $this->result as $key => $day ) {
92
+      foreach( $this->result as $key => $day ) {
93 93
 
94
-				if ( ! ( $key > Events::$date_start->format( 'Y-m-d' ) && $key < Events::$date_end->format( 'Y-m-d' ) ) ) {
94
+        if ( ! ( $key > Events::$date_start->format( 'Y-m-d' ) && $key < Events::$date_end->format( 'Y-m-d' ) ) ) {
95 95
 
96
-					unset( $this->result[ $key ] );
96
+          unset( $this->result[ $key ] );
97 97
 
98
-				}
98
+        }
99 99
 
100
-			}
100
+      }
101 101
 
102
-		} else {
102
+    } else {
103 103
 
104
-			$this->result = array();
104
+      $this->result = array();
105 105
 
106
-		}
106
+    }
107 107
 
108
-		return $this->result;
108
+    return $this->result;
109 109
 
110
-	}
110
+  }
111 111
 
112
-		/************************************************************
112
+    /************************************************************
113 113
 		 * Return local events - with day start and end as an array
114 114
 		 ************************************************************
115 115
 		 *
@@ -118,72 +118,72 @@  discard block
 block discarded – undo
118 118
 		 *
119 119
 		 *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
120 120
 		 */
121
-		public function local( $country_code = "ir" ) {
121
+    public function local( $country_code = "ir" ) {
122 122
 
123
-				/*
123
+        /*
124 124
 				 * Capitalize the first character of $country_code according the file
125 125
 				 * structure.
126 126
 				 */
127
-				$country_code = strtolower( $country_code = 'ir' ) ;
127
+        $country_code = strtolower( $country_code = 'ir' ) ;
128 128
 
129
-				$this->local = include( 'Localization/' . $country_code . '.php' );
129
+        $this->local = include( 'Localization/' . $country_code . '.php' );
130 130
 
131
-				foreach( $this->local[ 'events' ] as $month => $events ) {
131
+        foreach( $this->local[ 'events' ] as $month => $events ) {
132 132
 
133
-					foreach( $events as $day => $event ){
133
+          foreach( $events as $day => $event ){
134 134
 
135
-						$this->date_time = new DateTime();
135
+            $this->date_time = new DateTime();
136 136
 
137
-						$this->date_time->setDate( Events::$date_start->format( 'Y' ), $month, $day );
137
+            $this->date_time->setDate( Events::$date_start->format( 'Y' ), $month, $day );
138 138
 
139
-						switch ( $this->local[ 'default_calendar' ] ) {
139
+            switch ( $this->local[ 'default_calendar' ] ) {
140 140
 
141
-							case 'shamsi':
141
+              case 'shamsi':
142 142
 
143
-							$this->date_time->setDate( 1394, $month, $day );
143
+              $this->date_time->setDate( 1394, $month, $day );
144 144
 
145
-							$this->date_time = Datium::create( $this->date_time )->from( 'shamsi' )->to( 'gregorian' )->object(); //$this->convert->shamsiToGregorian( $this->date_time );
145
+              $this->date_time = Datium::create( $this->date_time )->from( 'shamsi' )->to( 'gregorian' )->object(); //$this->convert->shamsiToGregorian( $this->date_time );
146 146
 
147
-							break;
147
+              break;
148 148
 
149
-							case 'ghamari':
149
+              case 'ghamari':
150 150
 
151
-								$this->date_time = Datium::create(  $this->date_time )->from( 'ghamari' )->to( 'gregorian' )->object(); // $this->convert->ghamariToGregorian( $this->date_time );
151
+                $this->date_time = Datium::create(  $this->date_time )->from( 'ghamari' )->to( 'gregorian' )->object(); // $this->convert->ghamariToGregorian( $this->date_time );
152 152
 
153
-							break;
153
+              break;
154 154
 
155
-						}
155
+            }
156 156
 
157
-						$this->result[ $this->date_time->format( 'Y-m-d' ) ][] =  $event;
157
+            $this->result[ $this->date_time->format( 'Y-m-d' ) ][] =  $event;
158 158
 
159
-					}
159
+          }
160 160
 
161
-				}
161
+        }
162 162
 
163
-				ksort( $this->result );
163
+        ksort( $this->result );
164 164
 
165
-		return $this;
165
+    return $this;
166 166
 
167
-	}
167
+  }
168 168
 
169
-	public function weekend() {
169
+  public function weekend() {
170 170
 
171
-		return 0;
171
+    return 0;
172 172
 
173
-	}
173
+  }
174 174
 
175
-	public function relagious() {
175
+  public function relagious() {
176 176
 
177
-		return 0;
177
+    return 0;
178 178
 
179
-	}
179
+  }
180 180
 
181
-	public function international() {
181
+  public function international() {
182 182
 
183
-		$this->fetch( 'Global/global.php' );
183
+    $this->fetch( 'Global/global.php' );
184 184
 
185
-		return $this;
185
+    return $this;
186 186
 
187
-	}
187
+  }
188 188
 
189 189
 }
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@  discard block
 block discarded – undo
26 26
 
27 27
 	private static $date_end;
28 28
 
29
-	public function __construct( $date_time, $date_end = NULL ) {
29
+	public function __construct($date_time, $date_end = NULL) {
30 30
 
31
-		if( $date_end !== NULL ) {
31
+		if ($date_end !== NULL) {
32 32
 
33 33
 			Events::$date_start = $date_time;
34 34
 
@@ -56,19 +56,19 @@  discard block
 block discarded – undo
56 56
 	 *
57 57
 	 *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
58 58
 	 */
59
-	private function fetch( $path ) {
59
+	private function fetch($path) {
60 60
 
61
-		$this->events = include( $path );
61
+		$this->events = include($path);
62 62
 
63 63
 		$this->interval = DateInterval::createFromDateString('1 day');
64 64
 
65
-		$this->period = new DatePeriod( Events::$date_start, $this->interval, Events::$date_end );
65
+		$this->period = new DatePeriod(Events::$date_start, $this->interval, Events::$date_end);
66 66
 
67
-		foreach ( $this->period as $dt ) {
67
+		foreach ($this->period as $dt) {
68 68
 
69
-			if ( isset( $this->events[ 'events' ][ intval( $dt->format('m') ) ][ intval( $dt->format('d') ) ] ) ) {
69
+			if (isset($this->events['events'][intval($dt->format('m'))][intval($dt->format('d'))])) {
70 70
 
71
-				$this->result[ $dt->format( 'Y-m-d' ) ][] = $this->events[ 'events' ][ intval( $dt->format('m') ) ][ intval( $dt->format('d') ) ];
71
+				$this->result[$dt->format('Y-m-d')][] = $this->events['events'][intval($dt->format('m'))][intval($dt->format('d'))];
72 72
 
73 73
 			}
74 74
 
@@ -87,13 +87,13 @@  discard block
 block discarded – undo
87 87
 	 */
88 88
 	public function get() {
89 89
 
90
-		if( ! empty( $this->result ) ) {
90
+		if ( ! empty($this->result)) {
91 91
 
92
-			foreach( $this->result as $key => $day ) {
92
+			foreach ($this->result as $key => $day) {
93 93
 
94
-				if ( ! ( $key > Events::$date_start->format( 'Y-m-d' ) && $key < Events::$date_end->format( 'Y-m-d' ) ) ) {
94
+				if ( ! ($key > Events::$date_start->format('Y-m-d') && $key < Events::$date_end->format('Y-m-d'))) {
95 95
 
96
-					unset( $this->result[ $key ] );
96
+					unset($this->result[$key]);
97 97
 
98 98
 				}
99 99
 
@@ -118,49 +118,49 @@  discard block
 block discarded – undo
118 118
 		 *
119 119
 		 *\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
120 120
 		 */
121
-		public function local( $country_code = "ir" ) {
121
+		public function local($country_code = "ir") {
122 122
 
123 123
 				/*
124 124
 				 * Capitalize the first character of $country_code according the file
125 125
 				 * structure.
126 126
 				 */
127
-				$country_code = strtolower( $country_code = 'ir' ) ;
127
+				$country_code = strtolower($country_code = 'ir');
128 128
 
129
-				$this->local = include( 'Localization/' . $country_code . '.php' );
129
+				$this->local = include('Localization/'.$country_code.'.php');
130 130
 
131
-				foreach( $this->local[ 'events' ] as $month => $events ) {
131
+				foreach ($this->local['events'] as $month => $events) {
132 132
 
133
-					foreach( $events as $day => $event ){
133
+					foreach ($events as $day => $event) {
134 134
 
135 135
 						$this->date_time = new DateTime();
136 136
 
137
-						$this->date_time->setDate( Events::$date_start->format( 'Y' ), $month, $day );
137
+						$this->date_time->setDate(Events::$date_start->format('Y'), $month, $day);
138 138
 
139
-						switch ( $this->local[ 'default_calendar' ] ) {
139
+						switch ($this->local['default_calendar']) {
140 140
 
141 141
 							case 'shamsi':
142 142
 
143
-							$this->date_time->setDate( 1394, $month, $day );
143
+							$this->date_time->setDate(1394, $month, $day);
144 144
 
145
-							$this->date_time = Datium::create( $this->date_time )->from( 'shamsi' )->to( 'gregorian' )->object(); //$this->convert->shamsiToGregorian( $this->date_time );
145
+							$this->date_time = Datium::create($this->date_time)->from('shamsi')->to('gregorian')->object(); //$this->convert->shamsiToGregorian( $this->date_time );
146 146
 
147 147
 							break;
148 148
 
149 149
 							case 'ghamari':
150 150
 
151
-								$this->date_time = Datium::create(  $this->date_time )->from( 'ghamari' )->to( 'gregorian' )->object(); // $this->convert->ghamariToGregorian( $this->date_time );
151
+								$this->date_time = Datium::create($this->date_time)->from('ghamari')->to('gregorian')->object(); // $this->convert->ghamariToGregorian( $this->date_time );
152 152
 
153 153
 							break;
154 154
 
155 155
 						}
156 156
 
157
-						$this->result[ $this->date_time->format( 'Y-m-d' ) ][] =  $event;
157
+						$this->result[$this->date_time->format('Y-m-d')][] = $event;
158 158
 
159 159
 					}
160 160
 
161 161
 				}
162 162
 
163
-				ksort( $this->result );
163
+				ksort($this->result);
164 164
 
165 165
 		return $this;
166 166
 
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 
181 181
 	public function international() {
182 182
 
183
-		$this->fetch( 'Global/global.php' );
183
+		$this->fetch('Global/global.php');
184 184
 
185 185
 		return $this;
186 186
 
Please login to merge, or discard this patch.
src/CalendarSettings/Shamsi.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 use Datium\Datium as Datium;
4 4
 
5
-return array (
5
+return array(
6 6
 
7 7
 /************************************************************
8 8
  *                        Convert to
@@ -12,9 +12,9 @@  discard block
 block discarded – undo
12 12
  *
13 13
  *\_________________________________________________________/
14 14
  */
15
-  'convert_to' => function( $date_time ) {
15
+  'convert_to' => function($date_time) {
16 16
 
17
-    return Datium::create( $date_time )->sub( '226898 day' )->object();
17
+    return Datium::create($date_time)->sub('226898 day')->object();
18 18
 
19 19
   },
20 20
 
@@ -26,9 +26,9 @@  discard block
 block discarded – undo
26 26
    *
27 27
    *\_________________________________________________________/
28 28
    */
29
-  'convert_from' => function( $date_time ) {
29
+  'convert_from' => function($date_time) {
30 30
 
31
-    return Datium::create( $date_time )->add( '226898 day' )->object();
31
+    return Datium::create($date_time)->add('226898 day')->object();
32 32
 
33 33
   },
34 34
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
    *
51 51
    *\_________________________________________________________/
52 52
    */
53
-  'month' => array (
53
+  'month' => array(
54 54
 
55 55
     'Farvardin',
56 56
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
    *
88 88
    *\_________________________________________________________/
89 89
    */
90
-  'days_of_week' => array (
90
+  'days_of_week' => array(
91 91
     'Yekshanbe',
92 92
     'Doshanbe',
93 93
     'Seshanbe',
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 
100 100
   'start_day_of_week' => 'Shanbe',
101 101
 
102
-  'month_days_number' => array(      1 => 31,
102
+  'month_days_number' => array(1 => 31,
103 103
                                      2 => 31,
104 104
                                      3 => 31,
105 105
                                      4 => 31,
@@ -110,22 +110,22 @@  discard block
 block discarded – undo
110 110
                                      9 => 30,
111 111
                                      10 => 30,
112 112
                                      11 => 30,
113
-                                     12 => 29 ),
113
+                                     12 => 29),
114 114
 
115 115
 
116
-  'day_of_year' => function( $date_time ) {
116
+  'day_of_year' => function($date_time) {
117 117
 
118 118
     $result = null;
119 119
 
120
-    $config = include( 'Shamsi.php' );
120
+    $config = include('Shamsi.php');
121 121
 
122 122
     $month = $date_time->format('n');
123 123
 
124 124
     $day = $date_time->format('d');
125 125
 
126
-    foreach( $config['month_days_number'] as $_month => $value ) {
126
+    foreach ($config['month_days_number'] as $_month => $value) {
127 127
 
128
-      if ( $_month < $month ) $result += $value;
128
+      if ($_month < $month) $result += $value;
129 129
 
130 130
     }
131 131
 
@@ -135,21 +135,21 @@  discard block
 block discarded – undo
135 135
 
136 136
   },
137 137
 
138
-  'day_of_week' => function( $date_time ) {
138
+  'day_of_week' => function($date_time) {
139 139
 
140
-        $configShamsi = include(  'Shamsi.php' );
140
+        $configShamsi = include('Shamsi.php');
141 141
 
142
-        $configGregorian = include( 'Gregorian.php' );
142
+        $configGregorian = include('Gregorian.php');
143 143
 
144 144
         $day = $date_time->format('l');
145 145
 
146
-        $day = str_replace( $configGregorian['days_of_week'], $configShamsi['days_of_week'], $day );
146
+        $day = str_replace($configGregorian['days_of_week'], $configShamsi['days_of_week'], $day);
147 147
 
148
-        foreach ( $configShamsi['days_of_week'] as $key => $value ) {
148
+        foreach ($configShamsi['days_of_week'] as $key => $value) {
149 149
 
150
-          if( $value == $day ) {
150
+          if ($value == $day) {
151 151
 
152
-            if( $key <= 5 ) {
152
+            if ($key <= 5) {
153 153
 
154 154
               return $key += 1;
155 155
 
@@ -179,6 +179,6 @@  discard block
 block discarded – undo
179 179
    *
180 180
    *\_________________________________________________________/
181 181
    */
182
-  'weekend' => array( 'friday' )
182
+  'weekend' => array('friday')
183 183
 
184 184
  );
Please login to merge, or discard this patch.
src/CalendarSettings/Ghamari.php 2 patches
Indentation   +116 added lines, -116 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
- return array (
3
+  return array (
4 4
 
5
- /************************************************************
5
+  /************************************************************
6 6
   *                        Convert to
7 7
   ************************************************************
8 8
   *
@@ -10,85 +10,85 @@  discard block
 block discarded – undo
10 10
   *
11 11
   *\_________________________________________________________/
12 12
   */
13
-   'convert_to' => function( $date_time ) {
13
+    'convert_to' => function( $date_time ) {
14 14
 
15
-     $config = include( 'Shamsi.php' );
15
+      $config = include( 'Shamsi.php' );
16 16
 
17
-     $date_time = Datium\Datium::create( $date_time )->to( 'shamsi' )->object();
17
+      $date_time = Datium\Datium::create( $date_time )->to( 'shamsi' )->object();
18 18
 
19
-     $year = $date_time->format('Y');
19
+      $year = $date_time->format('Y');
20 20
 
21
-     $month = $date_time->format('n');
21
+      $month = $date_time->format('n');
22 22
 
23
-     $day = $date_time->format('d');
23
+      $day = $date_time->format('d');
24 24
 
25
-     $temp_day = 0 ;
25
+      $temp_day = 0 ;
26 26
 
27
-     for ( $i = 1 ; $i < $month ; $i++ ) {
27
+      for ( $i = 1 ; $i < $month ; $i++ ) {
28 28
 
29
-         $temp_day += $config[ 'month_days_number' ][ $i ];
29
+          $temp_day += $config[ 'month_days_number' ][ $i ];
30 30
 
31
-       }
31
+        }
32 32
 
33 33
       $temp_day += $day;
34 34
 
35 35
       $leap = new Datium\Tools\Leap( $year );
36 36
 
37
-     if( $leap->get() && $month > 11 ) $temp_day++;
37
+      if( $leap->get() && $month > 11 ) $temp_day++;
38 38
 
39
-     $_year = ( ( ( ( ( $year - 1 ) * 365.2422 ) + $temp_day ) - 119) / 354.3670 ) + 1;
39
+      $_year = ( ( ( ( ( $year - 1 ) * 365.2422 ) + $temp_day ) - 119) / 354.3670 ) + 1;
40 40
 
41
-     $_year = explode( '.', $_year );
41
+      $_year = explode( '.', $_year );
42 42
 
43
-     $year = $_year[0];
43
+      $year = $_year[0];
44 44
 
45
-     $_month = $_year[1];
45
+      $_month = $_year[1];
46 46
 
47 47
       $var_temp = '0.0';
48 48
 
49
-       for ( $i = strlen( $_month ); $i > 2; $i-- ) {
49
+        for ( $i = strlen( $_month ); $i > 2; $i-- ) {
50 50
 
51
-         $var_temp .= '0';
51
+          $var_temp .= '0';
52 52
 
53 53
       }
54 54
 
55 55
       $var_temp .= '1';
56 56
 
57
-     $_month = $_month * $var_temp ;
57
+      $_month = $_month * $var_temp ;
58 58
 
59
-     $_month = ( $_month * 12 ) + 1;
59
+      $_month = ( $_month * 12 ) + 1;
60 60
 
61
-     $_month = explode( '.', $_month );
61
+      $_month = explode( '.', $_month );
62 62
 
63
-     $month = $_month[0];
63
+      $month = $_month[0];
64 64
 
65
-     $_day = $_month[1];
65
+      $_day = $_month[1];
66 66
 
67
-     $var_temp = '0.0';
67
+      $var_temp = '0.0';
68 68
 
69
-     for ( $i = strlen( $_day );  $i > 2;  $i-- ) {
69
+      for ( $i = strlen( $_day );  $i > 2;  $i-- ) {
70 70
 
71 71
         $var_temp .= '0' ;
72 72
 
73
-     }
73
+      }
74 74
 
75
-     $var_temp .= '1';
75
+      $var_temp .= '1';
76 76
 
77
-     $_day = $_day * $var_temp;
77
+      $_day = $_day * $var_temp;
78 78
 
79
-     $_day = ( $_day * 29.530 );
79
+      $_day = ( $_day * 29.530 );
80 80
 
81
-     $_day = explode( '.', $_day );
81
+      $_day = explode( '.', $_day );
82 82
 
83
-     $day = $_day[0];
83
+      $day = $_day[0];
84 84
 
85 85
     $date_time->setDate( $year, $month, $day );
86 86
 
87 87
     return $date_time;
88 88
 
89
-   },
89
+    },
90 90
 
91
-   /************************************************************
91
+    /************************************************************
92 92
     *                        Convert From
93 93
     ************************************************************
94 94
     *
@@ -96,62 +96,62 @@  discard block
 block discarded – undo
96 96
     *
97 97
     *\_________________________________________________________/
98 98
     */
99
-   'convert_from' => function( $date_time ) {
99
+    'convert_from' => function( $date_time ) {
100 100
 
101
-     $config = include('Ghamari.php');
101
+      $config = include('Ghamari.php');
102 102
 
103
-     $year = $date_time->format('Y');
103
+      $year = $date_time->format('Y');
104 104
 
105
-     $month = $date_time->format('m');
105
+      $month = $date_time->format('m');
106 106
 
107
-     $day = $date_time->format('d');
107
+      $day = $date_time->format('d');
108 108
 
109
-     $days_of_year = 0;
109
+      $days_of_year = 0;
110 110
 
111
-     foreach ( $config['month_days_number'] as $month => $value ) {
111
+      foreach ( $config['month_days_number'] as $month => $value ) {
112 112
 
113
-       if( $month > $month ) $days_of_year += $value;
113
+        if( $month > $month ) $days_of_year += $value;
114 114
 
115
-     }
115
+      }
116 116
 
117
-     $days_of_year += $day;
117
+      $days_of_year += $day;
118 118
 
119
-     $days_of_leap_years =  intval( ( ( $year - 1 ) / 3 )  );
119
+      $days_of_leap_years =  intval( ( ( $year - 1 ) / 3 )  );
120 120
 
121
-     $days_of_ghamari_years = ( ( ( $year - 1 ) * 354 ) + $days_of_year + $days_of_leap_years );
121
+      $days_of_ghamari_years = ( ( ( $year - 1 ) * 354 ) + $days_of_year + $days_of_leap_years );
122 122
 
123
-     $days_of_gregorain_years = $days_of_ghamari_years + 227078;
123
+      $days_of_gregorain_years = $days_of_ghamari_years + 227078;
124 124
 
125
-     $days_of_gregorain_years = $days_of_gregorain_years - intval( ( ( $year + 578 ) / 4 ) );
125
+      $days_of_gregorain_years = $days_of_gregorain_years - intval( ( ( $year + 578 ) / 4 ) );
126 126
 
127
-     $gregorian_month = ( $days_of_gregorain_years % 365 );
127
+      $gregorian_month = ( $days_of_gregorain_years % 365 );
128 128
 
129
-     $gregorian_year = intval( $days_of_gregorain_years / 365 ) + 1;
129
+      $gregorian_year = intval( $days_of_gregorain_years / 365 ) + 1;
130 130
 
131
-     $config = include('Gregorian.php');
131
+      $config = include('Gregorian.php');
132 132
 
133
-     foreach ($config [ 'month_days_number' ] as $month => $value) {
133
+      foreach ($config [ 'month_days_number' ] as $month => $value) {
134 134
 
135
-       if ( $gregorian_month < $value ) {
135
+        if ( $gregorian_month < $value ) {
136 136
 
137
-         break;
138
-       }
137
+          break;
138
+        }
139 139
 
140
-         $gregorian_month -= $value;
141
-     }
140
+          $gregorian_month -= $value;
141
+      }
142 142
 
143
-       $gregorian_day = $gregorian_month;
143
+        $gregorian_day = $gregorian_month;
144 144
 
145
-       $gregorian_month = $month;
145
+        $gregorian_month = $month;
146 146
 
147
-       $date_time->setDate( $gregorian_year, $gregorian_month, $gregorian_day );
147
+        $date_time->setDate( $gregorian_year, $gregorian_month, $gregorian_day );
148 148
 
149 149
       return $date_time;
150 150
 
151 151
 
152
-   },
152
+    },
153 153
 
154
-   /************************************************************
154
+    /************************************************************
155 155
     *               Shorthand for jalali calendar
156 156
     ************************************************************
157 157
     *
@@ -159,9 +159,9 @@  discard block
 block discarded – undo
159 159
     *
160 160
     *\_________________________________________________________/
161 161
     */
162
-   'shorthand' => 'sh',
162
+    'shorthand' => 'sh',
163 163
 
164
-   /************************************************************
164
+    /************************************************************
165 165
     *                        Month's name
166 166
     ************************************************************
167 167
     *
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
     *
170 170
     *\_________________________________________________________/
171 171
     */
172
-   'month' => array (
172
+    'month' => array (
173 173
 
174 174
         'Muharram',
175 175
 
@@ -195,9 +195,9 @@  discard block
 block discarded – undo
195 195
 
196 196
         'Dhu al_Hijjah'
197 197
 
198
-     ),
198
+      ),
199 199
 
200
-   /************************************************************
200
+    /************************************************************
201 201
     *                        Days of Week
202 202
     ************************************************************
203 203
     *
@@ -206,79 +206,79 @@  discard block
 block discarded – undo
206 206
     *
207 207
     *\_________________________________________________________/
208 208
     */
209
-   'days_of_week' => array (
210
-         'al-Aḥad',
211
-         'al-Ithnayn',
212
-         'ath-Thulatha\'',
213
-         'al-Arbi\'a',
214
-         'al-Khamees',
215
-         'al-Jumu\'ah',
216
-         'as-Sabt',
209
+    'days_of_week' => array (
210
+          'al-Aḥad',
211
+          'al-Ithnayn',
212
+          'ath-Thulatha\'',
213
+          'al-Arbi\'a',
214
+          'al-Khamees',
215
+          'al-Jumu\'ah',
216
+          'as-Sabt',
217 217
 
218
-   ),
218
+    ),
219 219
 
220
-   'month_days_number' => array(     1 => 30,
221
-                                     2 => 29,
222
-                                     3 => 30,
223
-                                     4 => 30,
224
-                                     5 => 29,
225
-                                     6 => 29,
226
-                                     7 => 30,
227
-                                     8 => 29,
228
-                                     9 => 30,
229
-                                     10 => 29,
230
-                                     11 => 30,
231
-                                     12 => 30 ),
220
+    'month_days_number' => array(     1 => 30,
221
+                                      2 => 29,
222
+                                      3 => 30,
223
+                                      4 => 30,
224
+                                      5 => 29,
225
+                                      6 => 29,
226
+                                      7 => 30,
227
+                                      8 => 29,
228
+                                      9 => 30,
229
+                                      10 => 29,
230
+                                      11 => 30,
231
+                                      12 => 30 ),
232 232
 
233
-     'day_of_year' => function( $date_time ) {
233
+      'day_of_year' => function( $date_time ) {
234 234
 
235
-       $result = null;
235
+        $result = null;
236 236
 
237
-       $config = include( 'Ghamari.php' );
237
+        $config = include( 'Ghamari.php' );
238 238
 
239
-       $month = $date_time->format('n');
239
+        $month = $date_time->format('n');
240 240
 
241
-       $day = $date_time->format('d');
241
+        $day = $date_time->format('d');
242 242
 
243
-       foreach( $config['month_days_number'] as $_month => $value ) {
243
+        foreach( $config['month_days_number'] as $_month => $value ) {
244 244
 
245
-         if ( $_month < $month ) {
245
+          if ( $_month < $month ) {
246 246
 
247
-           $result += $value;
247
+            $result += $value;
248 248
 
249
-         }
249
+          }
250 250
 
251
-       }
251
+        }
252 252
 
253
-       $result += $day;
253
+        $result += $day;
254 254
 
255
-       return $result + 1;
255
+        return $result + 1;
256 256
 
257
-     },
257
+      },
258 258
 
259
-     'day_of_week' => function( $date_time ) {
259
+      'day_of_week' => function( $date_time ) {
260 260
 
261
-       $configGhamari = include(   'Ghamari.php' );
261
+        $configGhamari = include(   'Ghamari.php' );
262 262
 
263
-       $configGregorian = include( 'Gregorian.php' );
263
+        $configGregorian = include( 'Gregorian.php' );
264 264
 
265
-       $day = $date_time->format('l');
265
+        $day = $date_time->format('l');
266 266
 
267
-       $day = str_replace( $configGregorian['days_of_week'], $configGhamari['days_of_week'], $day);
267
+        $day = str_replace( $configGregorian['days_of_week'], $configGhamari['days_of_week'], $day);
268 268
 
269
-       foreach ( $configGhamari['days_of_week'] as $key => $value ) {
269
+        foreach ( $configGhamari['days_of_week'] as $key => $value ) {
270 270
 
271
-         if( $value == $day ) {
271
+          if( $value == $day ) {
272 272
 
273
-           return $key += 1;
273
+            return $key += 1;
274 274
 
275
-         }
275
+          }
276 276
 
277
-       }
277
+        }
278 278
 
279
-     },
279
+      },
280 280
 
281
-     /************************************************************
281
+      /************************************************************
282 282
       *                       Leap year
283 283
       ************************************************************
284 284
       *
@@ -286,9 +286,9 @@  discard block
 block discarded – undo
286 286
       *
287 287
       *\_________________________________________________________/
288 288
       */
289
-     'leap_year' => null,
289
+      'leap_year' => null,
290 290
 
291
-   /************************************************************
291
+    /************************************************************
292 292
     *                        Weekend
293 293
     ************************************************************
294 294
     *
@@ -296,6 +296,6 @@  discard block
 block discarded – undo
296 296
     *
297 297
     *\_________________________________________________________/
298 298
     */
299
-   'weekend' => array( 'friday' )
299
+    'weekend' => array( 'friday' )
300 300
 
301 301
   );
Please login to merge, or discard this patch.
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
- return array (
3
+ return array(
4 4
 
5 5
  /************************************************************
6 6
   *                        Convert to
@@ -10,11 +10,11 @@  discard block
 block discarded – undo
10 10
   *
11 11
   *\_________________________________________________________/
12 12
   */
13
-   'convert_to' => function( $date_time ) {
13
+   'convert_to' => function($date_time) {
14 14
 
15
-     $config = include( 'Shamsi.php' );
15
+     $config = include('Shamsi.php');
16 16
 
17
-     $date_time = Datium\Datium::create( $date_time )->to( 'shamsi' )->object();
17
+     $date_time = Datium\Datium::create($date_time)->to('shamsi')->object();
18 18
 
19 19
      $year = $date_time->format('Y');
20 20
 
@@ -22,23 +22,23 @@  discard block
 block discarded – undo
22 22
 
23 23
      $day = $date_time->format('d');
24 24
 
25
-     $temp_day = 0 ;
25
+     $temp_day = 0;
26 26
 
27
-     for ( $i = 1 ; $i < $month ; $i++ ) {
27
+     for ($i = 1; $i < $month; $i++) {
28 28
 
29
-         $temp_day += $config[ 'month_days_number' ][ $i ];
29
+         $temp_day += $config['month_days_number'][$i];
30 30
 
31 31
        }
32 32
 
33 33
       $temp_day += $day;
34 34
 
35
-      $leap = new Datium\Tools\Leap( $year );
35
+      $leap = new Datium\Tools\Leap($year);
36 36
 
37
-     if( $leap->get() && $month > 11 ) $temp_day++;
37
+     if ($leap->get() && $month > 11) $temp_day++;
38 38
 
39
-     $_year = ( ( ( ( ( $year - 1 ) * 365.2422 ) + $temp_day ) - 119) / 354.3670 ) + 1;
39
+     $_year = ((((($year - 1) * 365.2422) + $temp_day) - 119) / 354.3670) + 1;
40 40
 
41
-     $_year = explode( '.', $_year );
41
+     $_year = explode('.', $_year);
42 42
 
43 43
      $year = $_year[0];
44 44
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 
47 47
       $var_temp = '0.0';
48 48
 
49
-       for ( $i = strlen( $_month ); $i > 2; $i-- ) {
49
+       for ($i = strlen($_month); $i > 2; $i--) {
50 50
 
51 51
          $var_temp .= '0';
52 52
 
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
 
55 55
       $var_temp .= '1';
56 56
 
57
-     $_month = $_month * $var_temp ;
57
+     $_month = $_month * $var_temp;
58 58
 
59
-     $_month = ( $_month * 12 ) + 1;
59
+     $_month = ($_month * 12) + 1;
60 60
 
61
-     $_month = explode( '.', $_month );
61
+     $_month = explode('.', $_month);
62 62
 
63 63
      $month = $_month[0];
64 64
 
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
 
67 67
      $var_temp = '0.0';
68 68
 
69
-     for ( $i = strlen( $_day );  $i > 2;  $i-- ) {
69
+     for ($i = strlen($_day); $i > 2; $i--) {
70 70
 
71
-        $var_temp .= '0' ;
71
+        $var_temp .= '0';
72 72
 
73 73
      }
74 74
 
@@ -76,13 +76,13 @@  discard block
 block discarded – undo
76 76
 
77 77
      $_day = $_day * $var_temp;
78 78
 
79
-     $_day = ( $_day * 29.530 );
79
+     $_day = ($_day * 29.530);
80 80
 
81
-     $_day = explode( '.', $_day );
81
+     $_day = explode('.', $_day);
82 82
 
83 83
      $day = $_day[0];
84 84
 
85
-    $date_time->setDate( $year, $month, $day );
85
+    $date_time->setDate($year, $month, $day);
86 86
 
87 87
     return $date_time;
88 88
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
     *
97 97
     *\_________________________________________________________/
98 98
     */
99
-   'convert_from' => function( $date_time ) {
99
+   'convert_from' => function($date_time) {
100 100
 
101 101
      $config = include('Ghamari.php');
102 102
 
@@ -108,31 +108,31 @@  discard block
 block discarded – undo
108 108
 
109 109
      $days_of_year = 0;
110 110
 
111
-     foreach ( $config['month_days_number'] as $month => $value ) {
111
+     foreach ($config['month_days_number'] as $month => $value) {
112 112
 
113
-       if( $month > $month ) $days_of_year += $value;
113
+       if ($month > $month) $days_of_year += $value;
114 114
 
115 115
      }
116 116
 
117 117
      $days_of_year += $day;
118 118
 
119
-     $days_of_leap_years =  intval( ( ( $year - 1 ) / 3 )  );
119
+     $days_of_leap_years = intval((($year - 1) / 3));
120 120
 
121
-     $days_of_ghamari_years = ( ( ( $year - 1 ) * 354 ) + $days_of_year + $days_of_leap_years );
121
+     $days_of_ghamari_years = ((($year - 1) * 354) + $days_of_year + $days_of_leap_years);
122 122
 
123 123
      $days_of_gregorain_years = $days_of_ghamari_years + 227078;
124 124
 
125
-     $days_of_gregorain_years = $days_of_gregorain_years - intval( ( ( $year + 578 ) / 4 ) );
125
+     $days_of_gregorain_years = $days_of_gregorain_years - intval((($year + 578) / 4));
126 126
 
127
-     $gregorian_month = ( $days_of_gregorain_years % 365 );
127
+     $gregorian_month = ($days_of_gregorain_years % 365);
128 128
 
129
-     $gregorian_year = intval( $days_of_gregorain_years / 365 ) + 1;
129
+     $gregorian_year = intval($days_of_gregorain_years / 365) + 1;
130 130
 
131 131
      $config = include('Gregorian.php');
132 132
 
133
-     foreach ($config [ 'month_days_number' ] as $month => $value) {
133
+     foreach ($config ['month_days_number'] as $month => $value) {
134 134
 
135
-       if ( $gregorian_month < $value ) {
135
+       if ($gregorian_month < $value) {
136 136
 
137 137
          break;
138 138
        }
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 
145 145
        $gregorian_month = $month;
146 146
 
147
-       $date_time->setDate( $gregorian_year, $gregorian_month, $gregorian_day );
147
+       $date_time->setDate($gregorian_year, $gregorian_month, $gregorian_day);
148 148
 
149 149
       return $date_time;
150 150
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
     *
170 170
     *\_________________________________________________________/
171 171
     */
172
-   'month' => array (
172
+   'month' => array(
173 173
 
174 174
         'Muharram',
175 175
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
     *
207 207
     *\_________________________________________________________/
208 208
     */
209
-   'days_of_week' => array (
209
+   'days_of_week' => array(
210 210
          'al-Aḥad',
211 211
          'al-Ithnayn',
212 212
          'ath-Thulatha\'',
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 
218 218
    ),
219 219
 
220
-   'month_days_number' => array(     1 => 30,
220
+   'month_days_number' => array(1 => 30,
221 221
                                      2 => 29,
222 222
                                      3 => 30,
223 223
                                      4 => 30,
@@ -228,21 +228,21 @@  discard block
 block discarded – undo
228 228
                                      9 => 30,
229 229
                                      10 => 29,
230 230
                                      11 => 30,
231
-                                     12 => 30 ),
231
+                                     12 => 30),
232 232
 
233
-     'day_of_year' => function( $date_time ) {
233
+     'day_of_year' => function($date_time) {
234 234
 
235 235
        $result = null;
236 236
 
237
-       $config = include( 'Ghamari.php' );
237
+       $config = include('Ghamari.php');
238 238
 
239 239
        $month = $date_time->format('n');
240 240
 
241 241
        $day = $date_time->format('d');
242 242
 
243
-       foreach( $config['month_days_number'] as $_month => $value ) {
243
+       foreach ($config['month_days_number'] as $_month => $value) {
244 244
 
245
-         if ( $_month < $month ) {
245
+         if ($_month < $month) {
246 246
 
247 247
            $result += $value;
248 248
 
@@ -256,19 +256,19 @@  discard block
 block discarded – undo
256 256
 
257 257
      },
258 258
 
259
-     'day_of_week' => function( $date_time ) {
259
+     'day_of_week' => function($date_time) {
260 260
 
261
-       $configGhamari = include(   'Ghamari.php' );
261
+       $configGhamari = include('Ghamari.php');
262 262
 
263
-       $configGregorian = include( 'Gregorian.php' );
263
+       $configGregorian = include('Gregorian.php');
264 264
 
265 265
        $day = $date_time->format('l');
266 266
 
267
-       $day = str_replace( $configGregorian['days_of_week'], $configGhamari['days_of_week'], $day);
267
+       $day = str_replace($configGregorian['days_of_week'], $configGhamari['days_of_week'], $day);
268 268
 
269
-       foreach ( $configGhamari['days_of_week'] as $key => $value ) {
269
+       foreach ($configGhamari['days_of_week'] as $key => $value) {
270 270
 
271
-         if( $value == $day ) {
271
+         if ($value == $day) {
272 272
 
273 273
            return $key += 1;
274 274
 
@@ -296,6 +296,6 @@  discard block
 block discarded – undo
296 296
     *
297 297
     *\_________________________________________________________/
298 298
     */
299
-   'weekend' => array( 'friday' )
299
+   'weekend' => array('friday')
300 300
 
301 301
   );
Please login to merge, or discard this patch.
src/CalendarSettings/Gregorian.php 2 patches
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  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
- /************************************************************
7
+  /************************************************************
8 8
   *                        Convert to
9 9
   ************************************************************
10 10
   *
@@ -12,13 +12,13 @@  discard block
 block discarded – undo
12 12
   *
13 13
   *\_________________________________________________________/
14 14
   */
15
-   'convert_to' => function( $date_time ) {
15
+    'convert_to' => function( $date_time ) {
16 16
 
17
-     return null;
17
+      return null;
18 18
 
19
-   },
19
+    },
20 20
 
21
-   /************************************************************
21
+    /************************************************************
22 22
     *                        Convert From
23 23
     ************************************************************
24 24
     *
@@ -26,13 +26,13 @@  discard block
 block discarded – undo
26 26
     *
27 27
     *\_________________________________________________________/
28 28
     */
29
-   'convert_from' => function( $date_time ) {
29
+    'convert_from' => function( $date_time ) {
30 30
 
31
-     return null;
31
+      return null;
32 32
 
33
-   },
33
+    },
34 34
 
35
-   /************************************************************
35
+    /************************************************************
36 36
     *               Shorthand for jalali calendar
37 37
     ************************************************************
38 38
     *
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
     *
41 41
     *\_________________________________________________________/
42 42
     */
43
-   'shorthand' => 'gr',
43
+    'shorthand' => 'gr',
44 44
 
45
-   /************************************************************
45
+    /************************************************************
46 46
     *                        Month's name
47 47
     ************************************************************
48 48
     *
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
 
77 77
       'December'
78 78
 
79
-     ),
79
+      ),
80 80
 
81
-   /************************************************************
81
+    /************************************************************
82 82
     *                        Days of Week
83 83
     ************************************************************
84 84
     *
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     *
88 88
     *\_________________________________________________________/
89 89
     */
90
-   'days_of_week' => array (
90
+    'days_of_week' => array (
91 91
           'Saturday',
92 92
           'Sunday',
93 93
           'Monday',
@@ -96,53 +96,53 @@  discard block
 block discarded – undo
96 96
           'Thursday',
97 97
           'Friday'
98 98
 
99
-   ),
99
+    ),
100 100
 
101
-   'month_days_number' => array(   1 => 31,
102
-                                   2 => 28,
103
-                                   3 => 31,
104
-                                   4 => 30,
105
-                                   5 => 31,
106
-                                   6 => 30,
107
-                                   7 => 31,
108
-                                   8 => 31,
109
-                                   9 => 30,
110
-                                   10 => 31,
111
-                                   11 => 30,
112
-                                   12 => 30 ),
101
+    'month_days_number' => array(   1 => 31,
102
+                                    2 => 28,
103
+                                    3 => 31,
104
+                                    4 => 30,
105
+                                    5 => 31,
106
+                                    6 => 30,
107
+                                    7 => 31,
108
+                                    8 => 31,
109
+                                    9 => 30,
110
+                                    10 => 31,
111
+                                    11 => 30,
112
+                                    12 => 30 ),
113 113
 
114 114
 
115
-   'day_of_year' => function( $date_time ) {
115
+    'day_of_year' => function( $date_time ) {
116 116
 
117
-     $result = null;
117
+      $result = null;
118 118
 
119
-     $_month = null;
119
+      $_month = null;
120 120
 
121
-     $config = include( 'Gregorian.php' );
121
+      $config = include( 'Gregorian.php' );
122 122
 
123
-     $month = $date_time->format('n');
123
+      $month = $date_time->format('n');
124 124
 
125
-     $day = $date_time->format('d');
125
+      $day = $date_time->format('d');
126 126
 
127
-     foreach( $config['month_days_number'] as $_month => $value ) {
127
+      foreach( $config['month_days_number'] as $_month => $value ) {
128 128
 
129
-       if ( $_month < $month ) $result += $value;
129
+        if ( $_month < $month ) $result += $value;
130 130
 
131
-     }
131
+      }
132 132
 
133
-     $result += $day;
133
+      $result += $day;
134 134
 
135
-     return $result;
135
+      return $result;
136 136
 
137
-   },
137
+    },
138 138
 
139 139
   'day_of_week' => function( $date_time ) {
140 140
 
141
-       return date( 'w', strtotime( $date_time->format('Y-m-d H:i:s') ) );
141
+        return date( 'w', strtotime( $date_time->format('Y-m-d H:i:s') ) );
142 142
 
143
-   },
143
+    },
144 144
 
145
-   /************************************************************
145
+    /************************************************************
146 146
     *                       Leap year
147 147
     ************************************************************
148 148
     *
@@ -150,9 +150,9 @@  discard block
 block discarded – undo
150 150
     *
151 151
     *\_________________________________________________________/
152 152
     */
153
-   'leap_year' => null,
153
+    'leap_year' => null,
154 154
 
155
-   /************************************************************
155
+    /************************************************************
156 156
     *                        Weekend
157 157
     ************************************************************
158 158
     *
@@ -160,6 +160,6 @@  discard block
 block discarded – undo
160 160
     *
161 161
     *\_________________________________________________________/
162 162
     */
163
-   'weekend' => array( 'friday' )
163
+    'weekend' => array( 'friday' )
164 164
 
165 165
   );
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
  use Datium\Datium as Datium;
4 4
 
5
- return array (
5
+ return array(
6 6
 
7 7
  /************************************************************
8 8
   *                        Convert to
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
   *
13 13
   *\_________________________________________________________/
14 14
   */
15
-   'convert_to' => function( $date_time ) {
15
+   'convert_to' => function($date_time) {
16 16
 
17 17
      return null;
18 18
 
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
     *
27 27
     *\_________________________________________________________/
28 28
     */
29
-   'convert_from' => function( $date_time ) {
29
+   'convert_from' => function($date_time) {
30 30
 
31 31
      return null;
32 32
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     *
88 88
     *\_________________________________________________________/
89 89
     */
90
-   'days_of_week' => array (
90
+   'days_of_week' => array(
91 91
           'Saturday',
92 92
           'Sunday',
93 93
           'Monday',
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
    ),
100 100
 
101
-   'month_days_number' => array(   1 => 31,
101
+   'month_days_number' => array(1 => 31,
102 102
                                    2 => 28,
103 103
                                    3 => 31,
104 104
                                    4 => 30,
@@ -109,24 +109,24 @@  discard block
 block discarded – undo
109 109
                                    9 => 30,
110 110
                                    10 => 31,
111 111
                                    11 => 30,
112
-                                   12 => 30 ),
112
+                                   12 => 30),
113 113
 
114 114
 
115
-   'day_of_year' => function( $date_time ) {
115
+   'day_of_year' => function($date_time) {
116 116
 
117 117
      $result = null;
118 118
 
119 119
      $_month = null;
120 120
 
121
-     $config = include( 'Gregorian.php' );
121
+     $config = include('Gregorian.php');
122 122
 
123 123
      $month = $date_time->format('n');
124 124
 
125 125
      $day = $date_time->format('d');
126 126
 
127
-     foreach( $config['month_days_number'] as $_month => $value ) {
127
+     foreach ($config['month_days_number'] as $_month => $value) {
128 128
 
129
-       if ( $_month < $month ) $result += $value;
129
+       if ($_month < $month) $result += $value;
130 130
 
131 131
      }
132 132
 
@@ -136,9 +136,9 @@  discard block
 block discarded – undo
136 136
 
137 137
    },
138 138
 
139
-  'day_of_week' => function( $date_time ) {
139
+  'day_of_week' => function($date_time) {
140 140
 
141
-       return date( 'w', strtotime( $date_time->format('Y-m-d H:i:s') ) );
141
+       return date('w', strtotime($date_time->format('Y-m-d H:i:s')));
142 142
 
143 143
    },
144 144
 
@@ -160,6 +160,6 @@  discard block
 block discarded – undo
160 160
     *
161 161
     *\_________________________________________________________/
162 162
     */
163
-   'weekend' => array( 'friday' )
163
+   'weekend' => array('friday')
164 164
 
165 165
   );
Please login to merge, or discard this patch.
test.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -3,48 +3,48 @@  discard block
 block discarded – undo
3 3
 use Datium\Datium as Datium;
4 4
 use Datium\Tools\Convert as Covnert;
5 5
 
6
-try{
6
+try {
7 7
 
8
-require_once( 'vendor/autoload.php' );
9
-var_dump( Datium::create( 1394, 9, 24 )->from( 'shamsi' )->get() );
10
-var_dump( Datium::create( 2020, 07, 11 )->to( 'shamsi' )->get() );
11
-var_dump( Datium::create( 2020, 07, 11 )->to( 'ghamari' )->get() );
8
+require_once('vendor/autoload.php');
9
+var_dump(Datium::create(1394, 9, 24)->from('shamsi')->get());
10
+var_dump(Datium::create(2020, 07, 11)->to('shamsi')->get());
11
+var_dump(Datium::create(2020, 07, 11)->to('ghamari')->get());
12 12
 echo '<br>this year:<br>';
13
-var_dump( Datium::now()->to( 'shamsi' )->get( 'l jS F Y h:i:s A' ) );
13
+var_dump(Datium::now()->to('shamsi')->get('l jS F Y h:i:s A'));
14 14
 echo "<br>";
15
-var_dump( Datium::now()->to( 'shamsi' )->sub('3 year')->get() );
15
+var_dump(Datium::now()->to('shamsi')->sub('3 year')->get());
16 16
 echo "<br>";
17
-var_dump( Datium::now()->to( 'shamsi' )->add('3 year')->get() );
17
+var_dump(Datium::now()->to('shamsi')->add('3 year')->get());
18 18
 echo "<br>";
19
-var_dump( Datium::now()->get( 'l jS F Y h:i:s A' ) );
19
+var_dump(Datium::now()->get('l jS F Y h:i:s A'));
20 20
 echo "<br>Leap year ";
21
-var_dump( Datium::now()->leap()->get() );
21
+var_dump(Datium::now()->leap()->get());
22 22
 echo "<br>Create new DateTime: ";
23
-var_dump( Datium::create(2000, 1, 1, 0, 0, 0)->get() );
23
+var_dump(Datium::create(2000, 1, 1, 0, 0, 0)->get());
24 24
 echo "<br>";
25 25
 echo 'Is next year leap? ';
26
-var_dump( Datium::now()->add('1 year')->leap()->get() );
26
+var_dump(Datium::now()->add('1 year')->leap()->get());
27 27
 echo "<br>";
28 28
 echo "Day of Year in gregorian:";
29 29
 echo "<br>";
30
-var_dump( Datium::now()->dayOf()->year() );
30
+var_dump(Datium::now()->dayOf()->year());
31 31
 echo "<br>";
32 32
 echo "Day of Year in shamsi:";
33 33
 echo "<br>";
34
-var_dump( Datium::now()->to('shamsi')->dayOf()->year() );
34
+var_dump(Datium::now()->to('shamsi')->dayOf()->year());
35 35
 echo "<br>";
36 36
 echo "Day of Year in ghamari:";
37 37
 echo "<br>";
38
-var_dump( Datium::now()->to( 'ghamari' )->dayOf()->year() );
38
+var_dump(Datium::now()->to('ghamari')->dayOf()->year());
39 39
 echo "<br>";
40 40
 echo "Day of Week";
41 41
 echo "<br>";
42
-var_dump( Datium::now()->dayOf()->week() );
42
+var_dump(Datium::now()->dayOf()->week());
43 43
 echo "<br>";
44 44
 echo "Change date form gregorian to shamsi with method: ";
45
-var_dump( Datium::create( 1989, 10, 27 )->to( 'shamsi' )->get( 'l jS F Y h:i:s A' ) );
45
+var_dump(Datium::create(1989, 10, 27)->to('shamsi')->get('l jS F Y h:i:s A'));
46 46
 echo "<br>";
47
-var_dump( Datium::now()->to( 'ghamari' )->get( 'l jS F Y h:i:s A' ) );
47
+var_dump(Datium::now()->to('ghamari')->get('l jS F Y h:i:s A'));
48 48
 echo "<br>";
49 49
 echo "<br>";
50 50
 echo "<br>is persian holiday? ";
@@ -52,17 +52,17 @@  discard block
 block discarded – undo
52 52
 echo 'return international days';
53 53
 // var_dump(  Datium::between( Datium::now()->object() , Datium::now()->add('4 month')->object() )->events()->international()->get() );
54 54
 echo 'Convert gregorian to perisan';
55
-var_dump( Datium::now()->to('shamsi')->get() );
55
+var_dump(Datium::now()->to('shamsi')->get());
56 56
 echo 'Today\'s events:';
57 57
 // var_dump( Datium::now()->events()->local( 'ir' )->get() );
58 58
 echo 'Date diff';
59
-$diff = Datium::diff( Datium::now()->object(), Datium::now()->add('5 day')->object() );
60
-var_dump( $diff->days );
61
-var_dump( Datium::create( 2015, 11, 9 )->to( 'ghamari' )->get() );
59
+$diff = Datium::diff(Datium::now()->object(), Datium::now()->add('5 day')->object());
60
+var_dump($diff->days);
61
+var_dump(Datium::create(2015, 11, 9)->to('ghamari')->get());
62 62
 
63 63
 
64
-} catch (Exception $e ) {
64
+} catch (Exception $e) {
65 65
 
66
-  var_dump( $e );
66
+  var_dump($e);
67 67
 
68 68
 }
Please login to merge, or discard this patch.