ResponseHelperTrait   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 4
c 1
b 0
f 0
dl 0
loc 20
ccs 0
cts 11
cp 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getResponseJsonPathValue() 0 3 1
A getResponse() 0 3 1
A getResponseJsonArray() 0 3 1
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