Failed Conditions
Push — feature/init ( 5c8912...d71ff1 )
by Yo
03:32
created

OpenAPIDocCreatedEvent   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 48
ccs 0
cts 19
cp 0
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setOpenAPIDoc() 0 5 1
A getOpenAPIDoc() 0 3 1
A __construct() 0 7 1
A getServerDoc() 0 3 1
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