Code Duplication    Length = 16-16 lines in 2 locations

src/Workflows/ContentModerationGrid.php 1 location

@@ 62-77 (lines=16) @@
59
    return $row;
60
  }
61
62
  public function getDuplicateTransLabels() {
63
    $labels = [];
64
    foreach ($this->getTrans() as $trans) {
65
      if (isset($labels[$trans['label']])) {
66
        $labels[$trans['label']]++;
67
      }
68
      else {
69
        $labels[$trans['label']] = 1;
70
      }
71
    }
72
    $repeatedLabels = array_filter($labels, function ($count) {
73
      return $count > 1;
74
    });
75
76
    return $repeatedLabels;
77
  }
78
79
  public static function create(ContainerInterface $container) {
80
    /** @var EntityTypeManagerInterface $etm */

src/Workflows/ContentModerationReportBase.php 1 location

@@ 34-49 (lines=16) @@
31
    return $grid;
32
  }
33
34
  public function getDuplicateTransLabels() {
35
    $labels = [];
36
    foreach ($this->getTrans() as $trans) {
37
      if (isset($labels[$trans['label']])) {
38
        $labels[$trans['label']]++;
39
      }
40
      else {
41
        $labels[$trans['label']] = 1;
42
      }
43
    }
44
    $repeatedLabels = array_filter($labels, function ($count) {
45
      return $count > 1;
46
    });
47
48
    return $repeatedLabels;
49
  }
50
51
  protected function getStates() {
52
    $fullStates = $this->stateStorage->loadMultiple();