Card   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 29
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A toArray() 0 8 1
1
<?php
2
3
namespace Baguette\Mastodon\Entity;
4
5
/**
6
 * Card
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#card
12
 * @property-read string $url   The url associated with the card
13
 * @property-read string $title The title of the card
14
 * @property-read string $description The card description
15
 */
16
class Card extends Entity
17
{
18
    use \Teto\Object\TypedProperty;
19
20
    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...
21
        'url'   => 'string',
22
        'title' => 'string',
23
        'description' => 'string',
24
    ];
25
26 2
    public function __construct(array $properties)
27
    {
28 2
        $this->setProperties($properties);
29 2
    }
30
31
    /**
32
     * Returns attachment data as array
33
     *
34
     * @return array
35
     */
36 2
    public function toArray()
37
    {
38
        return [
39 2
            'url'   => $this->url,
40 2
            'title' => $this->title,
41 2
            'description' => $this->description,
42
        ];
43
    }
44
}
45