Code Duplication    Length = 14-14 lines in 2 locations

src/Search/Query/Joining/HasParentQuery.php 1 location

@@ 21-34 (lines=14) @@
18
    /**
19
     * @inheritdoc
20
     */
21
    public function toArray()
22
    {
23
        $hasParent = [
24
            'parent_type'  => $this->getType(),
25
            'query'        => $this->getQuery()->toArray(),
26
        ];
27
28
        $scoreMode = $this->getScoreMode();
29
        if (!is_null($scoreMode)) {
30
            $hasParent['score_mode'] = $scoreMode;
31
        }
32
33
        return ['has_parent' => $hasParent];
34
    }
35
}
36

src/Search/Query/Joining/NestedQuery.php 1 location

@@ 24-37 (lines=14) @@
21
    /**
22
     * @inheritdoc
23
     */
24
    public function toArray()
25
    {
26
        $nested = [
27
            'path'  => $this->getPath(),
28
            'query' => $this->getQuery()->toArray(),
29
        ];
30
31
        $scoreMode = $this->getScoreMode();
32
        if (!is_null($scoreMode)) {
33
            $nested['score_mode'] = $scoreMode;
34
        }
35
36
        return ['nested' => $nested];
37
    }
38
39
    /**
40
     * @param string $path