Message::getNetworksToPublishOn()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MartinGeorgiev\SocialPost;
6
7
use MartinGeorgiev\SocialPost\SocialNetwork\Enum;
8
9
/**
10
 * Representation of a public message (status update) for a social network
11
 *
12
 * @license https://opensource.org/licenses/MIT
13
 * @link https://github.com/martin-georgiev/social-post
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 string[]
44
     *
45
     * @see Enum::ANY List of available networks
46
     */
47
    private $networksToPublishOn = [Enum::ANY];
48
49
    /**
50
     * @param string $message The main message
51
     * @param string $link Optional link to a web-page to display along the message
52
     * @param string $pictureLink Optional address of a picture to display along the message
53
     * @param string $caption Optional caption to display along the message
54
     * @param string $description Optional description to display along the message
55
     */
56
    public function __construct(
57
        string $message,
58
        string $link = '',
59
        string $pictureLink = '',
60
        string $caption = '',
61
        string $description = ''
62
    ) {
63
        $this->message = $message;
64
        $this->link = $link;
65
        $this->pictureLink = $pictureLink;
66
        $this->caption = $caption;
67
        $this->description = $description;
68
    }
69
70
    public function getMessage(): string
71
    {
72
        return $this->message;
73
    }
74
75
    public function getLink(): string
76
    {
77
        return $this->link;
78
    }
79
80
    public function getPictureLink(): string
81
    {
82
        return $this->pictureLink;
83
    }
84
85
    public function getCaption(): string
86
    {
87
        return $this->caption;
88
    }
89
90
    public function getDescription(): string
91
    {
92
        return $this->description;
93
    }
94
95
    /**
96
     * @param string[] $networksToPublishOn
97
     *
98
     * @see Enum::ANY List of available networks
99
     */
100
    public function setNetworksToPublishOn(array $networksToPublishOn): self
101
    {
102
        $this->networksToPublishOn = $networksToPublishOn;
103
104
        return $this;
105
    }
106
107
    /**
108
     * @return string[]
109
     *
110
     * @see Enum::ANY List of available networks
111
     */
112
    public function getNetworksToPublishOn(): array
113
    {
114
        return $this->networksToPublishOn;
115
    }
116
}
117