Completed
Push — master ( 535b5e...300324 )
by Jasper
13s queued 13s
created

HasId::getId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Swis\JsonApi\Client\Concerns;
4
5
trait HasId
6
{
7
    /**
8
     * @var string|null
9
     */
10
    protected $id;
11
12
    /**
13
     * @return string|null
14
     */
15 250
    public function getId(): ?string
16
    {
17 250
        return $this->id;
18
    }
19
20
    /**
21
     * @param string|null $id
22
     *
23
     * @return static
24
     */
25 290
    public function setId(?string $id)
26
    {
27 290
        $this->id = $id;
28
29 290
        return $this;
30
    }
31
32
    /**
33
     * @return bool
34
     */
35 170
    public function hasId(): bool
36
    {
37 170
        return isset($this->id);
38
    }
39
}
40