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

QueryExecutionContext::getEndpoint()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
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\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