Code Duplication    Length = 12-13 lines in 3 locations

src/voku/db/Result.php 3 locations

@@ 529-540 (lines=12) @@
526
    } else {
527
528
      /** @noinspection PhpAssignmentInConditionInspection */
529
      while ($row = $this->fetch_assoc()) {
530
        $classTmp = new $class;
531
        $row = $this->cast($row);
532
        foreach ($row as $key => $value) {
533
          if ($class === '\stdClass') {
534
            $classTmp->{$key} = $value;
535
          } else {
536
            $propertyAccessor->setValue($classTmp, $key, $value);
537
          }
538
        }
539
        $data[] = $classTmp;
540
      }
541
    }
542
543
    return $data;
@@ 594-606 (lines=13) @@
591
592
    if ($class && $params) {
593
      /** @noinspection PhpAssignmentInConditionInspection */
594
      while ($row = $this->fetch_assoc()) {
595
        $reflectorTmp = new \ReflectionClass($class);
596
        $classTmp = $reflectorTmp->newInstanceArgs($params);
597
        $row = $this->cast($row);
598
        foreach ($row as $key => $value) {
599
          if ($class === '\stdClass') {
600
            $classTmp->{$key} = $value;
601
          } else {
602
            $propertyAccessor->setValue($classTmp, $key, $value);
603
          }
604
        }
605
        yield $classTmp;
606
      }
607
608
      return;
609
    }
@@ 612-623 (lines=12) @@
609
    }
610
611
    /** @noinspection PhpAssignmentInConditionInspection */
612
    while ($row = $this->fetch_assoc()) {
613
      $classTmp = new $class;
614
      $row = $this->cast($row);
615
      foreach ($row as $key => $value) {
616
        if ($class === '\stdClass') {
617
          $classTmp->{$key} = $value;
618
        } else {
619
          $propertyAccessor->setValue($classTmp, $key, $value);
620
        }
621
      }
622
      yield $classTmp;
623
    }
624
  }
625
626
  /**