SwaggerDocCreatedEvent::setSwaggerDoc()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 10
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 4
    public function __construct(
24
        array $swaggerDoc,
25
        HttpServerDoc $serverDoc = null
26
    ) {
27 4
        $this->swaggerDoc = $swaggerDoc;
28 4
        $this->serverDoc = $serverDoc;
29
    }
30
31
    /**
32
     * @return array
33
     */
34 4
    public function getSwaggerDoc()
35
    {
36 4
        return $this->swaggerDoc;
37
    }
38
39
    /**
40
     * @return HttpServerDoc|null
41
     */
42 1
    public function getServerDoc()
43
    {
44 1
        return $this->serverDoc;
45
    }
46
47
    /**
48
     * @param array $swaggerDoc
49
     *
50
     * @return SwaggerDocCreatedEvent
51
     */
52 2
    public function setSwaggerDoc(array $swaggerDoc)
53
    {
54 2
        $this->swaggerDoc = $swaggerDoc;
55
56 2
        return $this;
57
    }
58
}
59