Code Duplication    Length = 18-18 lines in 3 locations

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/MediaAdminBundle/Repository/MediaRepositoryTest.php 1 location

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

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

@@ 675-692 (lines=18) @@
672
     *
673
     * @return array
674
     */
675
    protected function replaceKeywordLabelById($condition)
676
    {
677
        $conditionWithoutOperator = preg_replace(explode('|', KeywordableTraitInterface::OPERATOR_SPLIT), ' ', $condition);
678
        $conditionArray = explode(' ', $conditionWithoutOperator);
679
680
        foreach ($conditionArray as $keyword) {
681
            if ($keyword != '') {
682
                $keywordDocument = $this->keywordRepository->findOneByLabel($keyword);
683
                if (!is_null($keywordDocument)) {
684
                    $condition = str_replace($keyword, $keywordDocument->getId(), $condition);
685
                } else {
686
                    return '';
687
                }
688
            }
689
        }
690
691
        return $condition;
692
    }
693
}
694