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

@@ 752-769 (lines=18) @@
749
     *
750
     * @return array
751
     */
752
    protected function replaceKeywordLabelById($condition)
753
    {
754
        $conditionWithoutOperator = preg_replace(explode('|', KeywordableTraitInterface::OPERATOR_SPLIT), ' ', $condition);
755
        $conditionArray = explode(' ', $conditionWithoutOperator);
756
757
        foreach ($conditionArray as $keyword) {
758
            if ($keyword != '') {
759
                $keywordDocument = $this->keywordRepository->findOneByLabel($keyword);
760
                if (!is_null($keywordDocument)) {
761
                    $condition = str_replace($keyword, $keywordDocument->getId(), $condition);
762
                } else {
763
                    return '';
764
                }
765
            }
766
        }
767
768
        return $condition;
769
    }
770
}
771