Code Duplication    Length = 18-18 lines in 3 locations

src/OpenOrchestra/Tests/Functional/MediaAdminBundle/Repository/MediaRepositoryTest.php 1 location

@@ 66-83 (lines=18) @@
63
     *
64
     * @return array
65
     */
66
    protected function replaceKeywordLabelById($condition)
67
    {
68
        $conditionWithoutOperator = preg_replace(explode('|', KeywordableTraitInterface::OPERATOR_SPLIT), ' ', $condition);
69
        $conditionArray = explode(' ', $conditionWithoutOperator);
70
71
        foreach ($conditionArray as $keyword) {
72
            if ($keyword != '') {
73
                $keywordDocument = $this->keywordRepository->findOneByLabel($keyword);
74
                if (!is_null($keywordDocument)) {
75
                    $condition = str_replace($keyword, $keywordDocument->getId(), $condition);
76
                } else {
77
                    return '';
78
                }
79
            }
80
        }
81
82
        return $condition;
83
    }
84
}
85

src/OpenOrchestra/Tests/Functional/BackofficeBundle/EventSubscriber/BlockFormTypeSubscriberTest.php 1 location

@@ 180-197 (lines=18) @@
177
     *
178
     * @return array
179
     */
180
    protected function replaceKeywordLabelById($condition)
181
    {
182
        $conditionWithoutOperator = preg_replace(explode('|', KeywordableTraitInterface::OPERATOR_SPLIT), ' ', $condition);
183
        $conditionArray = explode(' ', $conditionWithoutOperator);
184
185
        foreach ($conditionArray as $keyword) {
186
            if ($keyword != '') {
187
                $keywordDocument = $this->keywordRepository->findOneByLabel($keyword);
188
                if (!is_null($keywordDocument)) {
189
                    $condition = str_replace($keyword, $keywordDocument->getId(), $condition);
190
                } else {
191
                    return '';
192
                }
193
            }
194
        }
195
196
        return $condition;
197
    }
198
}
199

src/OpenOrchestra/Tests/Functional/ModelBundle/Repository/ContentRepositoryTest.php 1 location

@@ 590-607 (lines=18) @@
587
     *
588
     * @return array
589
     */
590
    protected function replaceKeywordLabelById($condition)
591
    {
592
        $conditionWithoutOperator = preg_replace(explode('|', KeywordableTraitInterface::OPERATOR_SPLIT), ' ', $condition);
593
        $conditionArray = explode(' ', $conditionWithoutOperator);
594
595
        foreach ($conditionArray as $keyword) {
596
            if ($keyword != '') {
597
                $keywordDocument = $this->keywordRepository->findOneByLabel($keyword);
598
                if (!is_null($keywordDocument)) {
599
                    $condition = str_replace($keyword, $keywordDocument->getId(), $condition);
600
                } else {
601
                    return '';
602
                }
603
            }
604
        }
605
606
        return $condition;
607
    }
608
}
609