1 | <?php |
||
24 | class Subscription extends AbstractHook |
||
25 | { |
||
26 | /** |
||
27 | * Body. |
||
28 | * |
||
29 | * @var string |
||
30 | */ |
||
31 | protected $body = "Hi {user.name} \n\r There have been made changes in your balloon directory."; |
||
32 | |||
33 | /** |
||
34 | * Subject. |
||
35 | * |
||
36 | * @var string |
||
37 | */ |
||
38 | protected $subject = 'change'; |
||
39 | |||
40 | /** |
||
41 | * Notification throttle. |
||
42 | * |
||
43 | * @var int |
||
44 | */ |
||
45 | protected $notification_throttle = 3600; |
||
46 | |||
47 | /** |
||
48 | * Notifier. |
||
49 | * |
||
50 | * @var Notifier |
||
51 | */ |
||
52 | protected $notifier; |
||
53 | |||
54 | /** |
||
55 | * Server. |
||
56 | * |
||
57 | * @var Server |
||
58 | */ |
||
59 | protected $server; |
||
60 | |||
61 | /** |
||
62 | * Logger. |
||
63 | * |
||
64 | * @var LoggerInterface |
||
65 | */ |
||
66 | protected $logger; |
||
67 | |||
68 | /** |
||
69 | * User. |
||
70 | * |
||
71 | * @var User |
||
72 | */ |
||
73 | protected $user; |
||
74 | |||
75 | /** |
||
76 | * Constructor. |
||
77 | * |
||
78 | * @param Notification $notifier |
||
79 | * @param Server $server |
||
80 | */ |
||
81 | public function __construct(Notifier $notifier, Server $server, LoggerInterface $logger, ?Iterable $config = null) |
||
89 | |||
90 | /** |
||
91 | * Set config. |
||
92 | * |
||
93 | * @param iterable $config |
||
94 | * |
||
95 | * @return AbstractHook |
||
96 | */ |
||
97 | public function setOptions(?Iterable $config = null): self |
||
117 | |||
118 | /** |
||
119 | * {@inheritdoc} |
||
120 | */ |
||
121 | public function postCreateCollection(Collection $parent, Collection $node, bool $clone): void |
||
125 | |||
126 | /** |
||
127 | * {@inheritdoc} |
||
128 | */ |
||
129 | public function postCreateFile(Collection $parent, File $node, bool $clone): void |
||
133 | |||
134 | /** |
||
135 | * {@inheritdoc} |
||
136 | */ |
||
137 | public function postDeleteCollection(Collection $node, bool $force, ?string $recursion, bool $recursion_first): void |
||
141 | |||
142 | /** |
||
143 | * {@inheritdoc} |
||
144 | */ |
||
145 | public function postRestoreFile(File $node, int $version): void |
||
149 | |||
150 | /** |
||
151 | * {@inheritdoc} |
||
152 | */ |
||
153 | public function postDeleteFile(File $node, bool $force, ?string $recursion, bool $recursion_first): void |
||
157 | |||
158 | /** |
||
159 | * {@inheritdoc} |
||
160 | */ |
||
161 | public function postPutFile(File $node, $content, bool $force, array $attributes): void |
||
165 | |||
166 | /** |
||
167 | * Check if we need to notify. |
||
168 | * |
||
169 | * @param Collection $collection |
||
170 | */ |
||
171 | protected function notify(Collection $collection): void |
||
200 | } |
||
201 |
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.