Tag::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 4
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Baguette\Mastodon\Entity;
4
5
/**
6
 * Tag
7
 *
8
 * @author    USAMI Kenta <[email protected]>
9
 * @copyright 2017 Baguette HQ
10
 * @license   https://www.gnu.org/licenses/gpl-3.0.html GPL-3.0
11
 * @see https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md#tag
12
 * @property-read string $name The hashtag, not including the preceding #
13
 * @property-read string $url  The URL of the hashtag
14
 */
15 View Code Duplication
class Tag extends Entity
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
16
{
17
    use \Teto\Object\TypedProperty;
18
19
    private static $property_types = [
0 ignored issues
show
Unused Code introduced by
The property $property_types is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
20
        'name' => 'string',
21
        'url'  => 'string',
22
    ];
23
24 2
    public function __construct(array $properties)
25
    {
26 2
        $this->setProperties($properties);
27 2
    }
28
29
    /**
30
     * Returns tag data as array
31
     *
32
     * @return array
33
     */
34 3
    public function toArray()
35
    {
36
        return [
37 3
            'name' => $this->name,
38 3
            'url'  => $this->url,
39
        ];
40
    }
41
}
42