Code Duplication    Length = 21-25 lines in 5 locations

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
            if ($_month < $month) {
140
                $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/Julian.php 1 location

@@ 150-172 (lines=23) @@
147
                                   12 => 30 ),
148
149
150
    'day_of_year' => function ($date_time) {
151
152
        $result = null;
153
154
        $_month = null;
155
156
        $config = include 'Julian.php';
157
158
        $month = $date_time->format('n');
159
160
        $day = $date_time->format('d');
161
162
        foreach ($config['month_days_number'] as $_month => $value) {
163
            if ($_month < $month) {
164
                $result += $value;
165
            }
166
        }
167
168
        $result += $day;
169
170
        return $result;
171
172
    },
173
174
    'day_of_week' => function ($date_time) {
175

src/CalendarSettings/Kurdish.php 1 location

@@ 154-174 (lines=21) @@
151
  *
152
  *\_________________________________________________________/
153
  */
154
  'day_of_year' => function ($date_time) {
155
156
    $result = null;
157
158
    $config = include 'Kurdish.php';
159
160
    $month = $date_time->format('n');
161
162
    $day = $date_time->format('d');
163
164
    foreach ($config[ 'month_days_number' ] as $_month => $value) {
165
        if ($_month < $month) {
166
            $result += $value;
167
        }
168
    }
169
170
    $result += $day;
171
172
    return $result;
173
174
  },
175
176
  /************************************************************
177
   *                       Day of Week

src/CalendarSettings/Hijri.php 1 location

@@ 227-251 (lines=25) @@
224
    *
225
    *\_________________________________________________________/
226
    */
227
     'day_of_year' => function ($date_time) {
228
229
        $result = null;
230
231
        $config = include 'Hijri.php';
232
233
        $month = $date_time->format('n');
234
235
        $day = $date_time->format('d');
236
237
        foreach ($config['month_days_number'] as $_month => $value) {
238
            if ($_month < $month) {
239
                $result += $value;
240
            }
241
        }
242
243
        $result += $day;
244
245
        return $result;
246
247
     },
248
249
     /************************************************************
250
      *                      Day of week
251
      ************************************************************
252
      *
253
      *  Return day of week on Hijri calendar
254
      *  example : al-Aḥad = result is 1

src/CalendarSettings/Jalali.php 1 location

@@ 280-300 (lines=21) @@
277
  *
278
  *\_________________________________________________________/
279
  */
280
  'day_of_year' => function ($date_time) {
281
282
    $result = null;
283
284
    $config = include 'Jalali.php';
285
286
    $month = $date_time->format('n');
287
288
    $day = $date_time->format('d');
289
290
    foreach ($config[ 'month_days_number' ] as $_month => $value) {
291
        if ($_month < $month) {
292
            $result += $value;
293
        }
294
    }
295
296
    $result += $day;
297
298
    return $result;
299
300
  },
301
302
  /************************************************************
303
   *                       Day of Week