Total Complexity | 5 |
Total Lines | 47 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php declare(strict_types=1); |
||
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 |
||
54 | } |
||
55 | } |
||
56 |