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

@@ 728-745 (lines=18) @@
725
     *
726
     * @return array
727
     */
728
    protected function replaceKeywordLabelById($condition)
729
    {
730
        $conditionWithoutOperator = preg_replace(explode('|', KeywordableTraitInterface::OPERATOR_SPLIT), ' ', $condition);
731
        $conditionArray = explode(' ', $conditionWithoutOperator);
732
733
        foreach ($conditionArray as $keyword) {
734
            if ($keyword != '') {
735
                $keywordDocument = $this->keywordRepository->findOneByLabel($keyword);
736
                if (!is_null($keywordDocument)) {
737
                    $condition = str_replace($keyword, $keywordDocument->getId(), $condition);
738
                } else {
739
                    return '';
740
                }
741
            }
742
        }
743
744
        return $condition;
745
    }
746
747
    /**
748
     * Test update embedded status