Tag   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 10
c 1
b 0
f 1
dl 0
loc 47
rs 10
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 3 1
A setId() 0 3 1
A __construct() 0 14 3
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