Code Duplication    Length = 12-12 lines in 3 locations

src/Context/JsonContext.php 3 locations

@@ 56-67 (lines=12) @@
53
     *
54
     * @Then the JSON node :node should be equal to :text
55
     */
56
    public function theJsonNodeShouldBeEqualTo($node, $text)
57
    {
58
        $json = $this->getJson();
59
60
        $actual = $this->inspector->evaluate($json, $node);
61
62
        if ($actual != $text) {
63
            throw new \Exception(
64
                sprintf("The node value is '%s'", json_encode($actual))
65
            );
66
        }
67
    }
68
69
    /**
70
     * Checks, that given JSON nodes are equal to givens values
@@ 176-187 (lines=12) @@
173
     *
174
     * @Then the JSON node :node should be equal to the string :text
175
     */
176
    public function theJsonNodeShouldBeEqualToTheString($node, $text)
177
    {
178
        $json = $this->getJson();
179
180
        $actual = $this->inspector->evaluate($json, $node);
181
182
        if ($actual !== $text) {
183
            throw new \Exception(
184
                sprintf('The node value is `%s`', json_encode($actual))
185
            );
186
        }
187
    }
188
189
    /**
190
     * Checks, that given JSON node is equal to the given number
@@ 194-205 (lines=12) @@
191
     *
192
     * @Then the JSON node :node should be equal to the number :number
193
     */
194
    public function theJsonNodeShouldBeEqualToTheNumber($node, $number)
195
    {
196
        $json = $this->getJson();
197
198
        $actual = $this->inspector->evaluate($json, $node);
199
200
        if ($actual !== (float) $number && $actual !== (int) $number) {
201
            throw new \Exception(
202
                sprintf('The node value is `%s`', json_encode($actual))
203
            );
204
        }
205
    }
206
207
    /**
208
     * Checks, that given JSON node has N element(s)