Code Duplication    Length = 45-45 lines in 2 locations

src/system/SearchModule/Tests/Api/Fixtures/SearchableBar.php 1 location

@@ 19-63 (lines=45) @@
16
use Zikula\SearchModule\Entity\SearchResultEntity;
17
use Zikula\SearchModule\SearchableInterface;
18
19
class SearchableBar implements SearchableInterface
20
{
21
    /**
22
     * * {@inheritdoc}
23
     */
24
    public function amendForm(FormBuilderInterface $form)
25
    {
26
        // TODO: Implement amendForm() method.
27
    }
28
29
    /**
30
     * * {@inheritdoc}
31
     */
32
    public function getResults(array $words, $searchType = 'AND', $modVars = null)
33
    {
34
        $results = [];
35
        if (in_array('top', $words)) {
36
            $r = $this->getBaseResult();
37
            $r->setText(sprintf('ZikulaBarModule found using %s', implode(', ', $words)));
38
            $results[] = $r;
39
        }
40
41
        return $results;
42
    }
43
44
    /**
45
     * * {@inheritdoc}
46
     */
47
    public function getErrors()
48
    {
49
        return [];
50
    }
51
52
    private function getBaseResult()
53
    {
54
        $r = new SearchResultEntity();
55
        $r->setCreated(new \DateTime())
56
            ->setModule('ZikulaBarModule')
57
            ->setSesid('test')
58
            ->setTitle('ZikulaBarModule result')
59
            ->setUrl(RouteUrl::createFromRoute('zikulabarmodule_user_index'));
60
61
        return $r;
62
    }
63
}
64

src/system/SearchModule/Tests/Api/Fixtures/SearchableFoo.php 1 location

@@ 19-63 (lines=45) @@
16
use Zikula\SearchModule\Entity\SearchResultEntity;
17
use Zikula\SearchModule\SearchableInterface;
18
19
class SearchableFoo implements SearchableInterface
20
{
21
    /**
22
     * * {@inheritdoc}
23
     */
24
    public function amendForm(FormBuilderInterface $form)
25
    {
26
        // TODO: Implement amendForm() method.
27
    }
28
29
    /**
30
     * * {@inheritdoc}
31
     */
32
    public function getResults(array $words, $searchType = 'AND', $modVars = null)
33
    {
34
        $results = [];
35
        if (in_array('bar', $words)) {
36
            $r = $this->getBaseResult();
37
            $r->setText(sprintf('ZikulaFooModule found using %s', implode(', ', $words)));
38
            $results[] = $r;
39
        }
40
41
        return $results;
42
    }
43
44
    /**
45
     * * {@inheritdoc}
46
     */
47
    public function getErrors()
48
    {
49
        return [];
50
    }
51
52
    private function getBaseResult()
53
    {
54
        $r = new SearchResultEntity();
55
        $r->setCreated(new \DateTime())
56
            ->setModule('ZikulaFooModule')
57
            ->setSesid('test')
58
            ->setTitle('ZikulaFooModule result')
59
            ->setUrl(RouteUrl::createFromRoute('zikulafoomodule_user_index'));
60
61
        return $r;
62
    }
63
}
64