Code Duplication    Length = 21-25 lines in 3 locations

src/CalendarSettings/Ghamari.php 1 location

@@ 244-268 (lines=25) @@
241
                                     11 => 30,
242
                                     12 => 30 ),
243
244
     'day_of_year' => function( $date_time ) {
245
246
       $result = null;
247
248
       $config = include( 'Ghamari.php' );
249
250
       $month = $date_time->format('n');
251
252
       $day = $date_time->format('d');
253
254
       foreach( $config['month_days_number'] as $_month => $value ) {
255
256
         if ( $_month < $month ) {
257
258
           $result += $value;
259
260
         }
261
262
       }
263
264
       $result += $day;
265
266
       return $result + 1;
267
268
     },
269
270
     'day_of_week' => function( $date_time ) {
271

src/CalendarSettings/Gregorian.php 1 location

@@ 126-148 (lines=23) @@
123
                                   12 => 30 ),
124
125
126
   'day_of_year' => function( $date_time ) {
127
128
     $result = null;
129
130
     $_month = null;
131
132
     $config = include( 'Gregorian.php' );
133
134
     $month = $date_time->format('n');
135
136
     $day = $date_time->format('d');
137
138
     foreach( $config['month_days_number'] as $_month => $value ) {
139
140
       if ( $_month < $month ) $result += $value;
141
142
     }
143
144
     $result += $day;
145
146
     return $result;
147
148
   },
149
150
  'day_of_week' => function( $date_time ) {
151

src/CalendarSettings/Shamsi.php 1 location

@@ 293-313 (lines=21) @@
290
                                     12 => 29 ),
291
292
293
  'day_of_year' => function( $date_time ) {
294
295
    $result = null;
296
297
    $config = include( 'Shamsi.php' );
298
299
    $month = $date_time->format('n');
300
301
    $day = $date_time->format('d');
302
303
    foreach( $config['month_days_number'] as $_month => $value ) {
304
305
      if ( $_month < $month ) $result += $value;
306
307
    }
308
309
    $result += $day;
310
311
    return $result + 1;
312
313
  },
314
315
  'day_of_week' => function( $date_time ) {
316