Passed
Push — feature/init ( aaad7a...5c8912 )
by Yo
02:13
created

OpenAPIDocCreatedEvent::__construct()   A

Complexity

Conditions 1
Paths 1

Size

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