Code Duplication    Length = 22-23 lines in 2 locations

src/Datium.php 2 locations

@@ 340-361 (lines=22) @@
337
  //
338
  // }
339
340
  public function toShamsi( $type = 'gr' ) {
341
342
    switch ( $type ) {
343
344
      case 'gr':
345
346
           $this->date_time = $this->convert_calendar->gregorianToShamsi( $this->date_time );
347
348
        break;
349
350
      case 'gh':
351
352
            $this->date_time = $this->convert_calendar->ghamariToShamsi( $this->date_time );
353
354
        break;
355
    }
356
357
    $this->calendar_type = 'ir';
358
359
    return $this;
360
361
  }
362
363
  public function toGhamari( $type = 'gr') {
364
@@ 363-385 (lines=23) @@
360
361
  }
362
363
  public function toGhamari( $type = 'gr') {
364
365
switch ( $type  ) {
366
367
  case 'ir':
368
369
        $this->date_time = $this->convert_calendar->shamsiToGhamari( $this->date_time );
370
371
    break;
372
373
  case 'gr':
374
375
    $this->date_time = $this->convert_calendar->gregorianToGhamari( $this->date_time );
376
377
    break;
378
379
}
380
381
   $this->calendar_type = 'gh';
382
383
    return $this;
384
385
  }
386
387
  public function toGregorian( $type = 'gr' ) {
388