Completed
Push — master ( 186982...2975e7 )
by Rafael
05:12
created

QueryExecutionContext   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 75%

Importance

Changes 0
Metric Value
wmc 3
dl 0
loc 37
ccs 6
cts 8
cp 0.75
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getEndpoint() 0 3 1
A getQueryId() 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\Resolver;
12
13
use Ynlo\GraphQLBundle\Definition\Registry\Endpoint;
14
15
/**
16
 * Context where a main query is executed
17
 */
18
class QueryExecutionContext
19
{
20
    /**
21
     * @var string
22
     */
23
    protected $queryId;
24
25
    /**
26
     * @var Endpoint
27
     */
28
    protected $endpoint;
29
30
    /**
31
     * QueryExecutionContext constructor.
32
     *
33
     * @param Endpoint $endpoint
34
     */
35 2
    public function __construct(Endpoint $endpoint)
36
    {
37 2
        $this->queryId = md5(time().mt_rand().spl_object_hash($this));
38 2
        $this->endpoint = $endpoint;
39 2
    }
40
41
    /**
42
     * @return string
43
     */
44 2
    public function getQueryId(): string
45
    {
46 2
        return $this->queryId;
47
    }
48
49
    /**
50
     * @return Endpoint
51
     */
52
    public function getEndpoint(): Endpoint
53
    {
54
        return $this->endpoint;
55
    }
56
}
57