Code Duplication    Length = 18-18 lines in 3 locations

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

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

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

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

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

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