ResponseHelperTrait::getResponseJsonArray()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 0
cts 3
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
1
<?php
2
/*******************************************************************************
3
 *  This file is part of the GraphQL Bundle package.
4
 *
5
 *  (c) YnloUltratech <[email protected]>
6
 *
7
 *  For the full copyright and license information, please view the LICENSE
8
 *  file that was distributed with this source code.
9
 ******************************************************************************/
10
11
namespace Ynlo\GraphQLBundle\Test\Helper;
12
13
use Symfony\Bundle\FrameworkBundle\Client;
14
use Symfony\Component\HttpFoundation\Response;
15
16
/**
17
 * @method Client getClient()
18
 *
19
 * @requires JsonHelperTrait
20
 *
21
 * @deprecated in favor of Behat tests
22
 */
23
trait ResponseHelperTrait
24
{
25
    public static function getResponse(): Response
26
    {
27
        return static::getClient()->getResponse();
0 ignored issues
show
Bug Best Practice introduced by
The method Ynlo\GraphQLBundle\Test\...elperTrait::getClient() is not static, but was called statically. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

27
        return static::/** @scrutinizer ignore-call */ getClient()->getResponse();
Loading history...
28
    }
29
30
    public static function getResponseJsonArray(): array
31
    {
32
        return json_decode(static::getResponse()->getContent(), true);
33
    }
34
35
    /**
36
     * @param string $path
37
     *
38
     * @return mixed|null
39
     */
40
    public static function getResponseJsonPathValue(string $path)
41
    {
42
        return static::getJsonPathValue(static::getResponseJsonArray(), $path);
43
    }
44
}
45