Passed
Push — develop ( fefadb...6c2c37 )
by Martin
32s
created

Message::getNetworksToPublishOn()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MartinGeorgiev\SocialPost\Provider;
6
7
/**
8
 * Representation of a public message (status update) for a social network
9
 *
10
 * @since 2.0.0
11
 * @author Martin Georgiev <[email protected]>
12
 * @license https://opensource.org/licenses/MIT MIT
13
 * @link https://github.com/martin-georgiev/social-post-bundle Package's homepage
14
 */
15
class Message
16
{
17
    /**
18
     * @var string
19
     */
20
    private $message;
21
22
    /**
23
     * @var string
24
     */
25
    private $link;
26
27
    /**
28
     * @var string
29
     */
30
    private $pictureLink;
31
32
    /**
33
     * @var string
34
     */
35
    private $caption;
36
37
    /**
38
     * @var string
39
     */
40
    private $description;
41
42
    /**
43
     * @var array
44
     * @see SocialNetwork::ANY List of available networks
45
     */
46
    private $networksToPublishOn = [SocialNetwork::ANY];
47
48
    /**
49
     * @param string $message The main message
50
     * @param string $link Optional link to a webpage to display along the message
51
     * @param string $pictureLink Optional address of a picture to display along the message
52
     * @param string $caption Optional caption to display along the message
53
     * @param string $description Optional description to display along the message
54
     */
55
    public function __construct(
56
        string $message,
57
        string $link = '',
58
        string $pictureLink = '',
59
        string $caption = '',
60
        string $description = ''
61
    ) {
62
        $this->message = $message;
63
        $this->link = $link;
64
        $this->pictureLink = $pictureLink;
65
        $this->caption = $caption;
66
        $this->description = $description;
67
    }
68
69
    /**
70
     * @return string
71
     */
72
    public function getMessage(): string
73
    {
74
        return $this->message;
75
    }
76
77
    /**
78
     * @return string
79
     */
80
    public function getLink(): string
81
    {
82
        return $this->link;
83
    }
84
85
    /**
86
     * @return string
87
     */
88
    public function getPictureLink(): string
89
    {
90
        return $this->pictureLink;
91
    }
92
93
    /**
94
     * @return string
95
     */
96
    public function getCaption(): string
97
    {
98
        return $this->caption;
99
    }
100
101
    /**
102
     * @return string
103
     */
104
    public function getDescription(): string
105
    {
106
        return $this->description;
107
    }
108
109
    /**
110
     * @return Message
111
     */
112
    public function setNetworksToPublishOn(array $networksToPublishOn): Message
113
    {
114
        $this->networksToPublishOn = $networksToPublishOn;
115
        
116
        return $this;
117
    }
118
119
    /**
120
     * @return array
121
     */
122
    public function getNetworksToPublishOn(): array
123
    {
124
        return $this->networksToPublishOn;
125
    }
126
}
127