AbstractEntity::getId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 2
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Shlinkio\Shlink\Common\Entity;
6
7
abstract class AbstractEntity
8
{
9
    protected ?string $id = null;
10
11
    public function getId(): string
12
    {
13
        return $this->id;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->id could return the type null which is incompatible with the type-hinted return string. Consider adding an additional type-check to rule them out.
Loading history...
14
    }
15
16
    /**
17
     * @internal
18
     */
19
    public function setId(string $id): self
20
    {
21
        $this->id = $id;
22
        return $this;
23
    }
24
}
25