1 | <?php |
||
18 | abstract class AbstractMessage implements MessageInterface |
||
19 | { |
||
20 | /** |
||
21 | * Message edit timeout |
||
22 | */ |
||
23 | protected const MESSAGE_EDIT_TIMEOUT = -1; |
||
24 | |||
25 | /** |
||
26 | * @var ChannelInterface |
||
27 | */ |
||
28 | protected $channel; |
||
29 | |||
30 | /** |
||
31 | * @var UserInterface |
||
32 | */ |
||
33 | protected $author; |
||
34 | |||
35 | /** |
||
36 | * @var string |
||
37 | */ |
||
38 | protected $id; |
||
39 | |||
40 | /** |
||
41 | * @var string |
||
42 | */ |
||
43 | protected $body; |
||
44 | |||
45 | /** |
||
46 | * @var array|UserInterface[] |
||
47 | */ |
||
48 | protected $mentions = []; |
||
49 | |||
50 | /** |
||
51 | * @var \DateTimeInterface |
||
52 | */ |
||
53 | protected $createdAt; |
||
54 | |||
55 | /** |
||
56 | * AbstractMessage constructor. |
||
57 | * @param ChannelInterface $channel |
||
58 | * @param UserInterface $author |
||
59 | * @param string $id |
||
60 | * @param string $body |
||
61 | */ |
||
62 | public function __construct(ChannelInterface $channel, UserInterface $author, string $id, string $body) |
||
70 | |||
71 | /** |
||
72 | * @return bool |
||
73 | */ |
||
74 | public function canBeUpdated(): bool |
||
86 | |||
87 | /** |
||
88 | * @return \DateTimeInterface |
||
89 | */ |
||
90 | public function at(): \DateTimeInterface |
||
94 | |||
95 | /** |
||
96 | * @return array |
||
97 | */ |
||
98 | public function __debugInfo(): array |
||
109 | |||
110 | /** |
||
111 | * @return string |
||
112 | */ |
||
113 | public function getId(): string |
||
117 | |||
118 | /** |
||
119 | * @return string |
||
120 | */ |
||
121 | public function getBody(): string |
||
125 | |||
126 | /** |
||
127 | * @return UserInterface |
||
128 | */ |
||
129 | public function getUser(): UserInterface |
||
133 | |||
134 | /** |
||
135 | * @return ChannelInterface |
||
136 | */ |
||
137 | public function getChannel(): ChannelInterface |
||
141 | |||
142 | /** |
||
143 | * @return \Traversable |
||
144 | */ |
||
145 | public function getMentions(): \Traversable |
||
149 | } |
||
150 |
As per the PSR-2 coding standard, case statements should not be wrapped in curly braces. There is no need for braces, since each case is terminated by the next
break
.There is also the option to use a semicolon instead of a colon, this is discouraged because many programmers do not even know it works and the colon is universal between programming languages.
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.