Tag::setId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php declare(strict_types=1);
2
3
namespace One\Model;
4
5
use One\Collection;
6
7
class Tag extends Model
8
{
9
    /**
10
     * identifier
11
     *
12
     * @var string
13
     */
14
    protected $identifier = null;
15
16
    /**
17
     * constructor
18
     *
19
     * @param \Psr\Http\Message\UriInterface|string $name
20
     * @param integer $order
21
     * @param bool $trending
22
     */
23
    public function __construct(
24
        string $name,
25
        $trending = false,
26
        $identifier = null
27
    ) {
28
        $properties = [
29
            'name' => $this->filterStringInstance($name),
30
            'trending' => $trending ? 1 : 0,
31
        ];
32
33
        $this->collection = new Collection($properties);
34
35
        if ($identifier) {
36
            $this->setId((string) $identifier);
37
        }
38
    }
39
40
    /**
41
     * setIdentifier from rest api response
42
     */
43
    public function setId(string $identifier): void
44
    {
45
        $this->identifier = $identifier;
46
    }
47
48
    /**
49
     * getIdentifier set before
50
     */
51
    public function getId(): string
52
    {
53
        return $this->identifier;
54
    }
55
}
56