MethodDocCreatedEvent::setMethod()   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
eloc 2
c 1
b 0
f 0
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
1
<?php
2
namespace Yoanm\SymfonyJsonRpcHttpServerDoc\Event;
3
4
use Yoanm\JsonRpcServer\Domain\JsonRpcMethodInterface;
5
use Yoanm\JsonRpcServerDoc\Domain\Model\MethodDoc;
6
7
/**
8
 * Class MethodDocCreatedEvent
9
 */
10
class MethodDocCreatedEvent extends DocEvent
11
{
12
    const EVENT_NAME = 'json_rpc_http_server_doc.method_doc_created';
13
14
    /** @var MethodDoc */
15
    private $doc;
16
    /** @var JsonRpcMethodInterface|null */
17
    private $method;
18
19
    /**
20
     * @param MethodDoc $doc
21
     */
22 6
    public function __construct(MethodDoc $doc)
23
    {
24 6
        $this->doc = $doc;
25
    }
26
27
    /**
28
     * @return MethodDoc
29
     */
30 5
    public function getDoc() : MethodDoc
31
    {
32 5
        return $this->doc;
33
    }
34
35
    /**
36
     * @return null|JsonRpcMethodInterface
37
     */
38 3
    public function getMethod() : ?JsonRpcMethodInterface
39
    {
40 3
        return $this->method;
41
    }
42
43
    /**
44
     * @param JsonRpcMethodInterface $method
45
     *
46
     * @return MethodDocCreatedEvent
47
     */
48 4
    public function setMethod(JsonRpcMethodInterface $method) : MethodDocCreatedEvent
49
    {
50 4
        $this->method = $method;
51
52 4
        return $this;
53
    }
54
55
    /**
56
     * @param MethodDoc $doc
57
     *
58
     * @return MethodDocCreatedEvent
59
     */
60 1
    public function setDoc(MethodDoc $doc) : MethodDocCreatedEvent
61
    {
62 1
        $this->doc = $doc;
63
64 1
        return $this;
65
    }
66
}
67