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