Code Duplication    Length = 17-17 lines in 2 locations

code/models/backends/PostgresJSONBackend.php 2 locations

@@ 24-40 (lines=17) @@
21
    /**
22
     * @inheritdoc
23
     */
24
    public function matchOnInt()
25
    {
26
        if (!is_int($this->operand)) {
27
            $msg = 'Non-integer passed to: ' . __FUNCTION__;
28
            throw new JSONTextException($msg);
29
        }
30
        
31
        $expr = '$.[' . $this->operand . ']';
32
        $fetch = $this->jsonText->getJSONStore()->get($expr);
33
        $vals = array_values($fetch);
34
        
35
        if (isset($vals[0])) {
36
            return [$this->operand => $vals[0]];
37
        }
38
39
        return [];
40
    }
41
42
    /**
43
     * @inheritdoc
@@ 45-61 (lines=17) @@
42
    /**
43
     * @inheritdoc
44
     */
45
    public function matchOnStr()
46
    {
47
        if (!is_string($this->operand)) {
48
            $msg = 'Non-string passed to: ' . __FUNCTION__;
49
            throw new JSONTextException($msg);
50
        }
51
        
52
        $expr = '$..' . $this->operand;
53
        $fetch = $this->jsonText->getJSONStore()->get($expr);
54
        $vals = array_values($fetch);
55
56
        if (isset($vals[0])) {
57
            return [$this->operand => $vals[0]];
58
        }
59
60
        return [];
61
    }
62
63
    /**
64
     * @inheritdoc