Passed
Push — release/0.1.0 ( b74469...8bca68 )
by Yo
03:12
created

SwaggerDocCreatedEvent::setSwaggerDoc()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
ccs 0
cts 4
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
namespace Yoanm\SymfonyJsonRpcHttpServerSwaggerDoc\Event;
3
4
use Yoanm\JsonRpcServerDoc\Domain\Model\HttpServerDoc;
5
use Yoanm\SymfonyJsonRpcHttpServerDoc\Event\DocEvent;
6
7
/**
8
 * Class SwaggerDocCreatedEvent
9
 */
10
class SwaggerDocCreatedEvent extends DocEvent
11
{
12
    const EVENT_NAME = 'json_rpc_http_server_swagger_doc.array_created';
13
14
    /** @var array */
15
    private $swaggerDoc;
16
    /** @var HttpServerDoc|null */
17
    private $serverDoc;
18
19
    /**
20
     * @param array              $swaggerDoc
21
     * @param HttpServerDoc|null $serverDoc
22
     */
23
    public function __construct(
24
        array $swaggerDoc,
25
        HttpServerDoc $serverDoc = null
26
    ) {
27
        $this->swaggerDoc = $swaggerDoc;
28
        $this->serverDoc = $serverDoc;
29
    }
30
31
    /**
32
     * @return HttpServerDoc
33
     */
34
    public function getSwaggerDoc()
35
    {
36
        return $this->swaggerDoc;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->swaggerDoc returns the type array which is incompatible with the documented return type Yoanm\JsonRpcServerDoc\Domain\Model\HttpServerDoc.
Loading history...
37
    }
38
39
    /**
40
     * @return HttpServerDoc|null
41
     */
42
    public function getServerDoc()
43
    {
44
        return $this->serverDoc;
45
    }
46
47
    /**
48
     * @param array $swaggerDoc
49
     *
50
     * @return SwaggerDocCreatedEvent
51
     */
52
    public function setSwaggerDoc(array $swaggerDoc)
53
    {
54
        $this->swaggerDoc = $swaggerDoc;
55
56
        return $this;
57
    }
58
}
59