ContentObject::getUrl()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace ZpgRtf\Objects;
4
5
/**
6
 * A content object specifies a single piece of media content associated with the listing, such as an image or brochure.
7
 * The listing/update:content attribute is an array of these content objects, which will be displayed in the order
8
 * provided.
9
 */
10
class ContentObject implements \JsonSerializable
11
{
12
    /** @var null|string */
13
    private $url;
14
15
    /**
16
     * Enum(audio_tour, brochure, document, epc_graph, epc_report, floor_plan, home_pack, image,
17
     * site_plan, virtual_tour)
18
     *
19
     * @var null|string
20
     */
21
    private $type;
22
23
    /** @var null|string */
24
    private $caption;
25
26
    /**
27
     * @return null|string
28
     */
29 3
    public function getUrl()
30
    {
31 3
        return $this->url;
32
    }
33
34
    /**
35
     * @param string $url
36
     *
37
     * @return ContentObject
38
     */
39 2
    public function setUrl(string $url): self
40
    {
41 2
        $this->url = $url;
42
43 2
        return $this;
44
    }
45
46
    /**
47
     * @return null|string
48
     */
49 3
    public function getType()
50
    {
51 3
        return $this->type;
52
    }
53
54
    /**
55
     * @param string $type
56
     *
57
     * @return ContentObject
58
     */
59 2
    public function setType(string $type): self
60
    {
61 2
        $this->type = $type;
62
63 2
        return $this;
64
    }
65
66
    /**
67
     * @return null|string
68
     */
69 3
    public function getCaption()
70
    {
71 3
        return $this->caption;
72
    }
73
74
    /**
75
     * @param string $caption
76
     *
77
     * @return ContentObject
78
     */
79 2
    public function setCaption(string $caption): self
80
    {
81 2
        $this->caption = $caption;
82
83 2
        return $this;
84
    }
85
86
    /** {@inheritDoc} */
87 2
    public function jsonSerialize(): array
88
    {
89 2
        return array_filter([
90 2
            'url' => $this->getUrl(),
91 2
            'type' => $this->getType(),
92 2
            'caption' => $this->getCaption(),
93
        ]);
94
    }
95
}
96