Passed
Push — master ( c66900...e3cbf5 )
by Rafael
06:44
created

SubscriptionLink::getHeartbeatUrl()   A

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\Subscription;
12
13
use Ynlo\GraphQLBundle\Annotation as GraphQL;
14
15
/**
16
 * @GraphQL\ObjectType(description="
17
The subscription link have all required information to subscribe to server events.
18
19
Can susbribe to a service using something like:
20
21
    new EventSource(subscription.url)
22
")
23
 */
24
class SubscriptionLink
25
{
26
    /**
27
     * @var string
28
     *
29
     * @GraphQL\Field(type="string!", description="corresponding subscription url containing a unique subscription ID. The client can
30
subscribe to the event stream corresponding to this subscription by creating a `new EventSource`.")
31
     */
32
    protected $url;
33
34
    /**
35
     * SubscriptionLink constructor.
36
     *
37
     * @param string  $url
38
     */
39
    public function __construct(string $url)
40
    {
41
        $this->url = $url;
42
    }
43
44
    /**
45
     * @return string
46
     */
47
    public function getUrl(): string
48
    {
49
        return $this->url;
50
    }
51
}
52