@@ -31,169 +31,169 @@ |
||
31 | 31 | |
32 | 32 | class Calendar extends Base { |
33 | 33 | |
34 | - const SUBJECT_ADD = 'calendar_add'; |
|
35 | - const SUBJECT_UPDATE = 'calendar_update'; |
|
36 | - const SUBJECT_DELETE = 'calendar_delete'; |
|
37 | - const SUBJECT_SHARE_USER = 'calendar_user_share'; |
|
38 | - const SUBJECT_SHARE_GROUP = 'calendar_group_share'; |
|
39 | - const SUBJECT_UNSHARE_USER = 'calendar_user_unshare'; |
|
40 | - const SUBJECT_UNSHARE_GROUP = 'calendar_group_unshare'; |
|
41 | - |
|
42 | - /** @var IFactory */ |
|
43 | - protected $languageFactory; |
|
44 | - |
|
45 | - /** @var IL10N */ |
|
46 | - protected $l; |
|
47 | - |
|
48 | - /** @var IURLGenerator */ |
|
49 | - protected $url; |
|
50 | - |
|
51 | - /** @var IManager */ |
|
52 | - protected $activityManager; |
|
53 | - |
|
54 | - /** @var IEventMerger */ |
|
55 | - protected $eventMerger; |
|
56 | - |
|
57 | - /** |
|
58 | - * @param IFactory $languageFactory |
|
59 | - * @param IURLGenerator $url |
|
60 | - * @param IManager $activityManager |
|
61 | - * @param IUserManager $userManager |
|
62 | - * @param IEventMerger $eventMerger |
|
63 | - */ |
|
64 | - public function __construct(IFactory $languageFactory, IURLGenerator $url, IManager $activityManager, IUserManager $userManager, IEventMerger $eventMerger) { |
|
65 | - parent::__construct($userManager); |
|
66 | - $this->languageFactory = $languageFactory; |
|
67 | - $this->url = $url; |
|
68 | - $this->activityManager = $activityManager; |
|
69 | - $this->eventMerger = $eventMerger; |
|
70 | - } |
|
71 | - |
|
72 | - /** |
|
73 | - * @param string $language |
|
74 | - * @param IEvent $event |
|
75 | - * @param IEvent|null $previousEvent |
|
76 | - * @return IEvent |
|
77 | - * @throws \InvalidArgumentException |
|
78 | - * @since 11.0.0 |
|
79 | - */ |
|
80 | - public function parse($language, IEvent $event, IEvent $previousEvent = null) { |
|
81 | - if ($event->getApp() !== 'dav' || $event->getType() !== 'calendar') { |
|
82 | - throw new \InvalidArgumentException(); |
|
83 | - } |
|
84 | - |
|
85 | - $this->l = $this->languageFactory->get('dav', $language); |
|
86 | - |
|
87 | - $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.svg'))); |
|
88 | - |
|
89 | - if ($event->getSubject() === self::SUBJECT_ADD) { |
|
90 | - $subject = $this->l->t('{actor} created calendar {calendar}'); |
|
91 | - } else if ($event->getSubject() === self::SUBJECT_ADD . '_self') { |
|
92 | - $subject = $this->l->t('You created calendar {calendar}'); |
|
93 | - } else if ($event->getSubject() === self::SUBJECT_DELETE) { |
|
94 | - $subject = $this->l->t('{actor} deleted calendar {calendar}'); |
|
95 | - } else if ($event->getSubject() === self::SUBJECT_DELETE . '_self') { |
|
96 | - $subject = $this->l->t('You deleted calendar {calendar}'); |
|
97 | - } else if ($event->getSubject() === self::SUBJECT_UPDATE) { |
|
98 | - $subject = $this->l->t('{actor} updated calendar {calendar}'); |
|
99 | - } else if ($event->getSubject() === self::SUBJECT_UPDATE . '_self') { |
|
100 | - $subject = $this->l->t('You updated calendar {calendar}'); |
|
101 | - |
|
102 | - } else if ($event->getSubject() === self::SUBJECT_SHARE_USER) { |
|
103 | - $subject = $this->l->t('{actor} shared calendar {calendar} with you'); |
|
104 | - } else if ($event->getSubject() === self::SUBJECT_SHARE_USER . '_you') { |
|
105 | - $subject = $this->l->t('You shared calendar {calendar} with {user}'); |
|
106 | - } else if ($event->getSubject() === self::SUBJECT_SHARE_USER . '_by') { |
|
107 | - $subject = $this->l->t('{actor} shared calendar {calendar} with {user}'); |
|
108 | - } else if ($event->getSubject() === self::SUBJECT_UNSHARE_USER) { |
|
109 | - $subject = $this->l->t('{actor} unshared calendar {calendar} from you'); |
|
110 | - } else if ($event->getSubject() === self::SUBJECT_UNSHARE_USER . '_you') { |
|
111 | - $subject = $this->l->t('You unshared calendar {calendar} from {user}'); |
|
112 | - } else if ($event->getSubject() === self::SUBJECT_UNSHARE_USER . '_by') { |
|
113 | - $subject = $this->l->t('{actor} unshared calendar {calendar} from {user}'); |
|
114 | - } else if ($event->getSubject() === self::SUBJECT_UNSHARE_USER . '_self') { |
|
115 | - $subject = $this->l->t('{actor} unshared calendar {calendar} from themselves'); |
|
116 | - |
|
117 | - } else if ($event->getSubject() === self::SUBJECT_SHARE_GROUP . '_you') { |
|
118 | - $subject = $this->l->t('You shared calendar {calendar} with group {group}'); |
|
119 | - } else if ($event->getSubject() === self::SUBJECT_SHARE_GROUP . '_by') { |
|
120 | - $subject = $this->l->t('{actor} shared calendar {calendar} with group {group}'); |
|
121 | - } else if ($event->getSubject() === self::SUBJECT_UNSHARE_GROUP . '_you') { |
|
122 | - $subject = $this->l->t('You unshared calendar {calendar} from group {group}'); |
|
123 | - } else if ($event->getSubject() === self::SUBJECT_UNSHARE_GROUP . '_by') { |
|
124 | - $subject = $this->l->t('{actor} unshared calendar {calendar} from group {group}'); |
|
125 | - } else { |
|
126 | - throw new \InvalidArgumentException(); |
|
127 | - } |
|
128 | - |
|
129 | - $parsedParameters = $this->getParameters($event); |
|
130 | - $this->setSubjects($event, $subject, $parsedParameters); |
|
131 | - |
|
132 | - $event = $this->eventMerger->mergeEvents('calendar', $event, $previousEvent); |
|
133 | - |
|
134 | - if ($event->getChildEvent() === null) { |
|
135 | - if (isset($parsedParameters['user'])) { |
|
136 | - // Couldn't group by calendar, maybe we can group by users |
|
137 | - $event = $this->eventMerger->mergeEvents('user', $event, $previousEvent); |
|
138 | - } else if (isset($parsedParameters['group'])) { |
|
139 | - // Couldn't group by calendar, maybe we can group by groups |
|
140 | - $event = $this->eventMerger->mergeEvents('group', $event, $previousEvent); |
|
141 | - } |
|
142 | - } |
|
143 | - |
|
144 | - return $event; |
|
145 | - } |
|
146 | - |
|
147 | - /** |
|
148 | - * @param IEvent $event |
|
149 | - * @return array |
|
150 | - */ |
|
151 | - protected function getParameters(IEvent $event) { |
|
152 | - $subject = $event->getSubject(); |
|
153 | - $parameters = $event->getSubjectParameters(); |
|
154 | - |
|
155 | - switch ($subject) { |
|
156 | - case self::SUBJECT_ADD: |
|
157 | - case self::SUBJECT_ADD . '_self': |
|
158 | - case self::SUBJECT_DELETE: |
|
159 | - case self::SUBJECT_DELETE . '_self': |
|
160 | - case self::SUBJECT_UPDATE: |
|
161 | - case self::SUBJECT_UPDATE . '_self': |
|
162 | - case self::SUBJECT_SHARE_USER: |
|
163 | - case self::SUBJECT_UNSHARE_USER: |
|
164 | - case self::SUBJECT_UNSHARE_USER . '_self': |
|
165 | - return [ |
|
166 | - 'actor' => $this->generateUserParameter($parameters[0]), |
|
167 | - 'calendar' => $this->generateCalendarParameter($event->getObjectId(), $parameters[1]), |
|
168 | - ]; |
|
169 | - case self::SUBJECT_SHARE_USER . '_you': |
|
170 | - case self::SUBJECT_UNSHARE_USER . '_you': |
|
171 | - return [ |
|
172 | - 'user' => $this->generateUserParameter($parameters[0]), |
|
173 | - 'calendar' => $this->generateCalendarParameter($event->getObjectId(), $parameters[1]), |
|
174 | - ]; |
|
175 | - case self::SUBJECT_SHARE_USER . '_by': |
|
176 | - case self::SUBJECT_UNSHARE_USER . '_by': |
|
177 | - return [ |
|
178 | - 'user' => $this->generateUserParameter($parameters[0]), |
|
179 | - 'calendar' => $this->generateCalendarParameter($event->getObjectId(), $parameters[1]), |
|
180 | - 'actor' => $this->generateUserParameter($parameters[2]), |
|
181 | - ]; |
|
182 | - case self::SUBJECT_SHARE_GROUP . '_you': |
|
183 | - case self::SUBJECT_UNSHARE_GROUP . '_you': |
|
184 | - return [ |
|
185 | - 'group' => $this->generateGroupParameter($parameters[0]), |
|
186 | - 'calendar' => $this->generateCalendarParameter($event->getObjectId(), $parameters[1]), |
|
187 | - ]; |
|
188 | - case self::SUBJECT_SHARE_GROUP . '_by': |
|
189 | - case self::SUBJECT_UNSHARE_GROUP . '_by': |
|
190 | - return [ |
|
191 | - 'group' => $this->generateGroupParameter($parameters[0]), |
|
192 | - 'calendar' => $this->generateCalendarParameter($event->getObjectId(), $parameters[1]), |
|
193 | - 'actor' => $this->generateUserParameter($parameters[2]), |
|
194 | - ]; |
|
195 | - } |
|
196 | - |
|
197 | - throw new \InvalidArgumentException(); |
|
198 | - } |
|
34 | + const SUBJECT_ADD = 'calendar_add'; |
|
35 | + const SUBJECT_UPDATE = 'calendar_update'; |
|
36 | + const SUBJECT_DELETE = 'calendar_delete'; |
|
37 | + const SUBJECT_SHARE_USER = 'calendar_user_share'; |
|
38 | + const SUBJECT_SHARE_GROUP = 'calendar_group_share'; |
|
39 | + const SUBJECT_UNSHARE_USER = 'calendar_user_unshare'; |
|
40 | + const SUBJECT_UNSHARE_GROUP = 'calendar_group_unshare'; |
|
41 | + |
|
42 | + /** @var IFactory */ |
|
43 | + protected $languageFactory; |
|
44 | + |
|
45 | + /** @var IL10N */ |
|
46 | + protected $l; |
|
47 | + |
|
48 | + /** @var IURLGenerator */ |
|
49 | + protected $url; |
|
50 | + |
|
51 | + /** @var IManager */ |
|
52 | + protected $activityManager; |
|
53 | + |
|
54 | + /** @var IEventMerger */ |
|
55 | + protected $eventMerger; |
|
56 | + |
|
57 | + /** |
|
58 | + * @param IFactory $languageFactory |
|
59 | + * @param IURLGenerator $url |
|
60 | + * @param IManager $activityManager |
|
61 | + * @param IUserManager $userManager |
|
62 | + * @param IEventMerger $eventMerger |
|
63 | + */ |
|
64 | + public function __construct(IFactory $languageFactory, IURLGenerator $url, IManager $activityManager, IUserManager $userManager, IEventMerger $eventMerger) { |
|
65 | + parent::__construct($userManager); |
|
66 | + $this->languageFactory = $languageFactory; |
|
67 | + $this->url = $url; |
|
68 | + $this->activityManager = $activityManager; |
|
69 | + $this->eventMerger = $eventMerger; |
|
70 | + } |
|
71 | + |
|
72 | + /** |
|
73 | + * @param string $language |
|
74 | + * @param IEvent $event |
|
75 | + * @param IEvent|null $previousEvent |
|
76 | + * @return IEvent |
|
77 | + * @throws \InvalidArgumentException |
|
78 | + * @since 11.0.0 |
|
79 | + */ |
|
80 | + public function parse($language, IEvent $event, IEvent $previousEvent = null) { |
|
81 | + if ($event->getApp() !== 'dav' || $event->getType() !== 'calendar') { |
|
82 | + throw new \InvalidArgumentException(); |
|
83 | + } |
|
84 | + |
|
85 | + $this->l = $this->languageFactory->get('dav', $language); |
|
86 | + |
|
87 | + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.svg'))); |
|
88 | + |
|
89 | + if ($event->getSubject() === self::SUBJECT_ADD) { |
|
90 | + $subject = $this->l->t('{actor} created calendar {calendar}'); |
|
91 | + } else if ($event->getSubject() === self::SUBJECT_ADD . '_self') { |
|
92 | + $subject = $this->l->t('You created calendar {calendar}'); |
|
93 | + } else if ($event->getSubject() === self::SUBJECT_DELETE) { |
|
94 | + $subject = $this->l->t('{actor} deleted calendar {calendar}'); |
|
95 | + } else if ($event->getSubject() === self::SUBJECT_DELETE . '_self') { |
|
96 | + $subject = $this->l->t('You deleted calendar {calendar}'); |
|
97 | + } else if ($event->getSubject() === self::SUBJECT_UPDATE) { |
|
98 | + $subject = $this->l->t('{actor} updated calendar {calendar}'); |
|
99 | + } else if ($event->getSubject() === self::SUBJECT_UPDATE . '_self') { |
|
100 | + $subject = $this->l->t('You updated calendar {calendar}'); |
|
101 | + |
|
102 | + } else if ($event->getSubject() === self::SUBJECT_SHARE_USER) { |
|
103 | + $subject = $this->l->t('{actor} shared calendar {calendar} with you'); |
|
104 | + } else if ($event->getSubject() === self::SUBJECT_SHARE_USER . '_you') { |
|
105 | + $subject = $this->l->t('You shared calendar {calendar} with {user}'); |
|
106 | + } else if ($event->getSubject() === self::SUBJECT_SHARE_USER . '_by') { |
|
107 | + $subject = $this->l->t('{actor} shared calendar {calendar} with {user}'); |
|
108 | + } else if ($event->getSubject() === self::SUBJECT_UNSHARE_USER) { |
|
109 | + $subject = $this->l->t('{actor} unshared calendar {calendar} from you'); |
|
110 | + } else if ($event->getSubject() === self::SUBJECT_UNSHARE_USER . '_you') { |
|
111 | + $subject = $this->l->t('You unshared calendar {calendar} from {user}'); |
|
112 | + } else if ($event->getSubject() === self::SUBJECT_UNSHARE_USER . '_by') { |
|
113 | + $subject = $this->l->t('{actor} unshared calendar {calendar} from {user}'); |
|
114 | + } else if ($event->getSubject() === self::SUBJECT_UNSHARE_USER . '_self') { |
|
115 | + $subject = $this->l->t('{actor} unshared calendar {calendar} from themselves'); |
|
116 | + |
|
117 | + } else if ($event->getSubject() === self::SUBJECT_SHARE_GROUP . '_you') { |
|
118 | + $subject = $this->l->t('You shared calendar {calendar} with group {group}'); |
|
119 | + } else if ($event->getSubject() === self::SUBJECT_SHARE_GROUP . '_by') { |
|
120 | + $subject = $this->l->t('{actor} shared calendar {calendar} with group {group}'); |
|
121 | + } else if ($event->getSubject() === self::SUBJECT_UNSHARE_GROUP . '_you') { |
|
122 | + $subject = $this->l->t('You unshared calendar {calendar} from group {group}'); |
|
123 | + } else if ($event->getSubject() === self::SUBJECT_UNSHARE_GROUP . '_by') { |
|
124 | + $subject = $this->l->t('{actor} unshared calendar {calendar} from group {group}'); |
|
125 | + } else { |
|
126 | + throw new \InvalidArgumentException(); |
|
127 | + } |
|
128 | + |
|
129 | + $parsedParameters = $this->getParameters($event); |
|
130 | + $this->setSubjects($event, $subject, $parsedParameters); |
|
131 | + |
|
132 | + $event = $this->eventMerger->mergeEvents('calendar', $event, $previousEvent); |
|
133 | + |
|
134 | + if ($event->getChildEvent() === null) { |
|
135 | + if (isset($parsedParameters['user'])) { |
|
136 | + // Couldn't group by calendar, maybe we can group by users |
|
137 | + $event = $this->eventMerger->mergeEvents('user', $event, $previousEvent); |
|
138 | + } else if (isset($parsedParameters['group'])) { |
|
139 | + // Couldn't group by calendar, maybe we can group by groups |
|
140 | + $event = $this->eventMerger->mergeEvents('group', $event, $previousEvent); |
|
141 | + } |
|
142 | + } |
|
143 | + |
|
144 | + return $event; |
|
145 | + } |
|
146 | + |
|
147 | + /** |
|
148 | + * @param IEvent $event |
|
149 | + * @return array |
|
150 | + */ |
|
151 | + protected function getParameters(IEvent $event) { |
|
152 | + $subject = $event->getSubject(); |
|
153 | + $parameters = $event->getSubjectParameters(); |
|
154 | + |
|
155 | + switch ($subject) { |
|
156 | + case self::SUBJECT_ADD: |
|
157 | + case self::SUBJECT_ADD . '_self': |
|
158 | + case self::SUBJECT_DELETE: |
|
159 | + case self::SUBJECT_DELETE . '_self': |
|
160 | + case self::SUBJECT_UPDATE: |
|
161 | + case self::SUBJECT_UPDATE . '_self': |
|
162 | + case self::SUBJECT_SHARE_USER: |
|
163 | + case self::SUBJECT_UNSHARE_USER: |
|
164 | + case self::SUBJECT_UNSHARE_USER . '_self': |
|
165 | + return [ |
|
166 | + 'actor' => $this->generateUserParameter($parameters[0]), |
|
167 | + 'calendar' => $this->generateCalendarParameter($event->getObjectId(), $parameters[1]), |
|
168 | + ]; |
|
169 | + case self::SUBJECT_SHARE_USER . '_you': |
|
170 | + case self::SUBJECT_UNSHARE_USER . '_you': |
|
171 | + return [ |
|
172 | + 'user' => $this->generateUserParameter($parameters[0]), |
|
173 | + 'calendar' => $this->generateCalendarParameter($event->getObjectId(), $parameters[1]), |
|
174 | + ]; |
|
175 | + case self::SUBJECT_SHARE_USER . '_by': |
|
176 | + case self::SUBJECT_UNSHARE_USER . '_by': |
|
177 | + return [ |
|
178 | + 'user' => $this->generateUserParameter($parameters[0]), |
|
179 | + 'calendar' => $this->generateCalendarParameter($event->getObjectId(), $parameters[1]), |
|
180 | + 'actor' => $this->generateUserParameter($parameters[2]), |
|
181 | + ]; |
|
182 | + case self::SUBJECT_SHARE_GROUP . '_you': |
|
183 | + case self::SUBJECT_UNSHARE_GROUP . '_you': |
|
184 | + return [ |
|
185 | + 'group' => $this->generateGroupParameter($parameters[0]), |
|
186 | + 'calendar' => $this->generateCalendarParameter($event->getObjectId(), $parameters[1]), |
|
187 | + ]; |
|
188 | + case self::SUBJECT_SHARE_GROUP . '_by': |
|
189 | + case self::SUBJECT_UNSHARE_GROUP . '_by': |
|
190 | + return [ |
|
191 | + 'group' => $this->generateGroupParameter($parameters[0]), |
|
192 | + 'calendar' => $this->generateCalendarParameter($event->getObjectId(), $parameters[1]), |
|
193 | + 'actor' => $this->generateUserParameter($parameters[2]), |
|
194 | + ]; |
|
195 | + } |
|
196 | + |
|
197 | + throw new \InvalidArgumentException(); |
|
198 | + } |
|
199 | 199 | } |
@@ -28,102 +28,102 @@ |
||
28 | 28 | |
29 | 29 | abstract class Base implements IProvider { |
30 | 30 | |
31 | - /** @var IUserManager */ |
|
32 | - protected $userManager; |
|
31 | + /** @var IUserManager */ |
|
32 | + protected $userManager; |
|
33 | 33 | |
34 | - /** @var string[] cached displayNames - key is the UID and value the displayname */ |
|
35 | - protected $displayNames = []; |
|
34 | + /** @var string[] cached displayNames - key is the UID and value the displayname */ |
|
35 | + protected $displayNames = []; |
|
36 | 36 | |
37 | - /** |
|
38 | - * @param IUserManager $userManager |
|
39 | - */ |
|
40 | - public function __construct(IUserManager $userManager) { |
|
41 | - $this->userManager = $userManager; |
|
42 | - } |
|
37 | + /** |
|
38 | + * @param IUserManager $userManager |
|
39 | + */ |
|
40 | + public function __construct(IUserManager $userManager) { |
|
41 | + $this->userManager = $userManager; |
|
42 | + } |
|
43 | 43 | |
44 | - /** |
|
45 | - * @param IEvent $event |
|
46 | - * @param string $subject |
|
47 | - * @param array $parameters |
|
48 | - */ |
|
49 | - protected function setSubjects(IEvent $event, $subject, array $parameters) { |
|
50 | - $placeholders = $replacements = []; |
|
51 | - foreach ($parameters as $placeholder => $parameter) { |
|
52 | - $placeholders[] = '{' . $placeholder . '}'; |
|
53 | - $replacements[] = $parameter['name']; |
|
54 | - } |
|
44 | + /** |
|
45 | + * @param IEvent $event |
|
46 | + * @param string $subject |
|
47 | + * @param array $parameters |
|
48 | + */ |
|
49 | + protected function setSubjects(IEvent $event, $subject, array $parameters) { |
|
50 | + $placeholders = $replacements = []; |
|
51 | + foreach ($parameters as $placeholder => $parameter) { |
|
52 | + $placeholders[] = '{' . $placeholder . '}'; |
|
53 | + $replacements[] = $parameter['name']; |
|
54 | + } |
|
55 | 55 | |
56 | - $event->setParsedSubject(str_replace($placeholders, $replacements, $subject)) |
|
57 | - ->setRichSubject($subject, $parameters); |
|
58 | - } |
|
56 | + $event->setParsedSubject(str_replace($placeholders, $replacements, $subject)) |
|
57 | + ->setRichSubject($subject, $parameters); |
|
58 | + } |
|
59 | 59 | |
60 | - /** |
|
61 | - * @param array $eventData |
|
62 | - * @return array |
|
63 | - */ |
|
64 | - protected function generateObjectParameter($eventData) { |
|
65 | - if (!is_array($eventData) || !isset($eventData['id']) || !isset($eventData['name'])) { |
|
66 | - throw new \InvalidArgumentException(); |
|
67 | - }; |
|
60 | + /** |
|
61 | + * @param array $eventData |
|
62 | + * @return array |
|
63 | + */ |
|
64 | + protected function generateObjectParameter($eventData) { |
|
65 | + if (!is_array($eventData) || !isset($eventData['id']) || !isset($eventData['name'])) { |
|
66 | + throw new \InvalidArgumentException(); |
|
67 | + }; |
|
68 | 68 | |
69 | - return [ |
|
70 | - 'type' => 'calendar-event', |
|
71 | - 'id' => $eventData['id'], |
|
72 | - 'name' => $eventData['name'], |
|
73 | - ]; |
|
74 | - } |
|
69 | + return [ |
|
70 | + 'type' => 'calendar-event', |
|
71 | + 'id' => $eventData['id'], |
|
72 | + 'name' => $eventData['name'], |
|
73 | + ]; |
|
74 | + } |
|
75 | 75 | |
76 | - /** |
|
77 | - * @param int $id |
|
78 | - * @param string $name |
|
79 | - * @return array |
|
80 | - */ |
|
81 | - protected function generateCalendarParameter($id, $name) { |
|
82 | - return [ |
|
83 | - 'type' => 'calendar', |
|
84 | - 'id' => $id, |
|
85 | - 'name' => $name, |
|
86 | - ]; |
|
87 | - } |
|
76 | + /** |
|
77 | + * @param int $id |
|
78 | + * @param string $name |
|
79 | + * @return array |
|
80 | + */ |
|
81 | + protected function generateCalendarParameter($id, $name) { |
|
82 | + return [ |
|
83 | + 'type' => 'calendar', |
|
84 | + 'id' => $id, |
|
85 | + 'name' => $name, |
|
86 | + ]; |
|
87 | + } |
|
88 | 88 | |
89 | - /** |
|
90 | - * @param string $id |
|
91 | - * @return array |
|
92 | - */ |
|
93 | - protected function generateGroupParameter($id) { |
|
94 | - return [ |
|
95 | - 'type' => 'group', |
|
96 | - 'id' => $id, |
|
97 | - 'name' => $id, |
|
98 | - ]; |
|
99 | - } |
|
89 | + /** |
|
90 | + * @param string $id |
|
91 | + * @return array |
|
92 | + */ |
|
93 | + protected function generateGroupParameter($id) { |
|
94 | + return [ |
|
95 | + 'type' => 'group', |
|
96 | + 'id' => $id, |
|
97 | + 'name' => $id, |
|
98 | + ]; |
|
99 | + } |
|
100 | 100 | |
101 | - /** |
|
102 | - * @param string $uid |
|
103 | - * @return array |
|
104 | - */ |
|
105 | - protected function generateUserParameter($uid) { |
|
106 | - if (!isset($this->displayNames[$uid])) { |
|
107 | - $this->displayNames[$uid] = $this->getDisplayName($uid); |
|
108 | - } |
|
101 | + /** |
|
102 | + * @param string $uid |
|
103 | + * @return array |
|
104 | + */ |
|
105 | + protected function generateUserParameter($uid) { |
|
106 | + if (!isset($this->displayNames[$uid])) { |
|
107 | + $this->displayNames[$uid] = $this->getDisplayName($uid); |
|
108 | + } |
|
109 | 109 | |
110 | - return [ |
|
111 | - 'type' => 'user', |
|
112 | - 'id' => $uid, |
|
113 | - 'name' => $this->displayNames[$uid], |
|
114 | - ]; |
|
115 | - } |
|
110 | + return [ |
|
111 | + 'type' => 'user', |
|
112 | + 'id' => $uid, |
|
113 | + 'name' => $this->displayNames[$uid], |
|
114 | + ]; |
|
115 | + } |
|
116 | 116 | |
117 | - /** |
|
118 | - * @param string $uid |
|
119 | - * @return string |
|
120 | - */ |
|
121 | - protected function getDisplayName($uid) { |
|
122 | - $user = $this->userManager->get($uid); |
|
123 | - if ($user instanceof IUser) { |
|
124 | - return $user->getDisplayName(); |
|
125 | - } else { |
|
126 | - return $uid; |
|
127 | - } |
|
128 | - } |
|
117 | + /** |
|
118 | + * @param string $uid |
|
119 | + * @return string |
|
120 | + */ |
|
121 | + protected function getDisplayName($uid) { |
|
122 | + $user = $this->userManager->get($uid); |
|
123 | + if ($user instanceof IUser) { |
|
124 | + return $user->getDisplayName(); |
|
125 | + } else { |
|
126 | + return $uid; |
|
127 | + } |
|
128 | + } |
|
129 | 129 | } |
@@ -31,107 +31,107 @@ |
||
31 | 31 | |
32 | 32 | class Event extends Base { |
33 | 33 | |
34 | - const SUBJECT_OBJECT_ADD = 'object_add'; |
|
35 | - const SUBJECT_OBJECT_UPDATE = 'object_update'; |
|
36 | - const SUBJECT_OBJECT_DELETE = 'object_delete'; |
|
37 | - |
|
38 | - /** @var IFactory */ |
|
39 | - protected $languageFactory; |
|
40 | - |
|
41 | - /** @var IL10N */ |
|
42 | - protected $l; |
|
43 | - |
|
44 | - /** @var IURLGenerator */ |
|
45 | - protected $url; |
|
46 | - |
|
47 | - /** @var IManager */ |
|
48 | - protected $activityManager; |
|
49 | - |
|
50 | - /** @var IEventMerger */ |
|
51 | - protected $eventMerger; |
|
52 | - |
|
53 | - /** |
|
54 | - * @param IFactory $languageFactory |
|
55 | - * @param IURLGenerator $url |
|
56 | - * @param IManager $activityManager |
|
57 | - * @param IUserManager $userManager |
|
58 | - * @param IEventMerger $eventMerger |
|
59 | - */ |
|
60 | - public function __construct(IFactory $languageFactory, IURLGenerator $url, IManager $activityManager, IUserManager $userManager, IEventMerger $eventMerger) { |
|
61 | - parent::__construct($userManager); |
|
62 | - $this->languageFactory = $languageFactory; |
|
63 | - $this->url = $url; |
|
64 | - $this->activityManager = $activityManager; |
|
65 | - $this->eventMerger = $eventMerger; |
|
66 | - } |
|
67 | - |
|
68 | - /** |
|
69 | - * @param string $language |
|
70 | - * @param IEvent $event |
|
71 | - * @param IEvent|null $previousEvent |
|
72 | - * @return IEvent |
|
73 | - * @throws \InvalidArgumentException |
|
74 | - * @since 11.0.0 |
|
75 | - */ |
|
76 | - public function parse($language, IEvent $event, IEvent $previousEvent = null) { |
|
77 | - if ($event->getApp() !== 'dav' || $event->getType() !== 'calendar_event') { |
|
78 | - throw new \InvalidArgumentException(); |
|
79 | - } |
|
80 | - |
|
81 | - $this->l = $this->languageFactory->get('dav', $language); |
|
82 | - |
|
83 | - $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.svg'))); |
|
84 | - |
|
85 | - if ($event->getSubject() === self::SUBJECT_OBJECT_ADD . '_event') { |
|
86 | - $subject = $this->l->t('{actor} created event {event} in calendar {calendar}'); |
|
87 | - } else if ($event->getSubject() === self::SUBJECT_OBJECT_ADD . '_event_self') { |
|
88 | - $subject = $this->l->t('You created event {event} in calendar {calendar}'); |
|
89 | - } else if ($event->getSubject() === self::SUBJECT_OBJECT_DELETE . '_event') { |
|
90 | - $subject = $this->l->t('{actor} deleted event {event} from calendar {calendar}'); |
|
91 | - } else if ($event->getSubject() === self::SUBJECT_OBJECT_DELETE . '_event_self') { |
|
92 | - $subject = $this->l->t('You deleted event {event} from calendar {calendar}'); |
|
93 | - } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_event') { |
|
94 | - $subject = $this->l->t('{actor} updated event {event} in calendar {calendar}'); |
|
95 | - } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_event_self') { |
|
96 | - $subject = $this->l->t('You updated event {event} in calendar {calendar}'); |
|
97 | - } else { |
|
98 | - throw new \InvalidArgumentException(); |
|
99 | - } |
|
100 | - |
|
101 | - $parsedParameters = $this->getParameters($event); |
|
102 | - $this->setSubjects($event, $subject, $parsedParameters); |
|
103 | - |
|
104 | - $event = $this->eventMerger->mergeEvents('event', $event, $previousEvent); |
|
105 | - |
|
106 | - return $event; |
|
107 | - } |
|
108 | - |
|
109 | - /** |
|
110 | - * @param IEvent $event |
|
111 | - * @return array |
|
112 | - */ |
|
113 | - protected function getParameters(IEvent $event) { |
|
114 | - $subject = $event->getSubject(); |
|
115 | - $parameters = $event->getSubjectParameters(); |
|
116 | - |
|
117 | - switch ($subject) { |
|
118 | - case self::SUBJECT_OBJECT_ADD . '_event': |
|
119 | - case self::SUBJECT_OBJECT_DELETE . '_event': |
|
120 | - case self::SUBJECT_OBJECT_UPDATE . '_event': |
|
121 | - return [ |
|
122 | - 'actor' => $this->generateUserParameter($parameters[0]), |
|
123 | - 'calendar' => $this->generateCalendarParameter($event->getObjectId(), $parameters[1]), |
|
124 | - 'event' => $this->generateObjectParameter($parameters[2]), |
|
125 | - ]; |
|
126 | - case self::SUBJECT_OBJECT_ADD . '_event_self': |
|
127 | - case self::SUBJECT_OBJECT_DELETE . '_event_self': |
|
128 | - case self::SUBJECT_OBJECT_UPDATE . '_event_self': |
|
129 | - return [ |
|
130 | - 'calendar' => $this->generateCalendarParameter($event->getObjectId(), $parameters[1]), |
|
131 | - 'event' => $this->generateObjectParameter($parameters[2]), |
|
132 | - ]; |
|
133 | - } |
|
134 | - |
|
135 | - throw new \InvalidArgumentException(); |
|
136 | - } |
|
34 | + const SUBJECT_OBJECT_ADD = 'object_add'; |
|
35 | + const SUBJECT_OBJECT_UPDATE = 'object_update'; |
|
36 | + const SUBJECT_OBJECT_DELETE = 'object_delete'; |
|
37 | + |
|
38 | + /** @var IFactory */ |
|
39 | + protected $languageFactory; |
|
40 | + |
|
41 | + /** @var IL10N */ |
|
42 | + protected $l; |
|
43 | + |
|
44 | + /** @var IURLGenerator */ |
|
45 | + protected $url; |
|
46 | + |
|
47 | + /** @var IManager */ |
|
48 | + protected $activityManager; |
|
49 | + |
|
50 | + /** @var IEventMerger */ |
|
51 | + protected $eventMerger; |
|
52 | + |
|
53 | + /** |
|
54 | + * @param IFactory $languageFactory |
|
55 | + * @param IURLGenerator $url |
|
56 | + * @param IManager $activityManager |
|
57 | + * @param IUserManager $userManager |
|
58 | + * @param IEventMerger $eventMerger |
|
59 | + */ |
|
60 | + public function __construct(IFactory $languageFactory, IURLGenerator $url, IManager $activityManager, IUserManager $userManager, IEventMerger $eventMerger) { |
|
61 | + parent::__construct($userManager); |
|
62 | + $this->languageFactory = $languageFactory; |
|
63 | + $this->url = $url; |
|
64 | + $this->activityManager = $activityManager; |
|
65 | + $this->eventMerger = $eventMerger; |
|
66 | + } |
|
67 | + |
|
68 | + /** |
|
69 | + * @param string $language |
|
70 | + * @param IEvent $event |
|
71 | + * @param IEvent|null $previousEvent |
|
72 | + * @return IEvent |
|
73 | + * @throws \InvalidArgumentException |
|
74 | + * @since 11.0.0 |
|
75 | + */ |
|
76 | + public function parse($language, IEvent $event, IEvent $previousEvent = null) { |
|
77 | + if ($event->getApp() !== 'dav' || $event->getType() !== 'calendar_event') { |
|
78 | + throw new \InvalidArgumentException(); |
|
79 | + } |
|
80 | + |
|
81 | + $this->l = $this->languageFactory->get('dav', $language); |
|
82 | + |
|
83 | + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.svg'))); |
|
84 | + |
|
85 | + if ($event->getSubject() === self::SUBJECT_OBJECT_ADD . '_event') { |
|
86 | + $subject = $this->l->t('{actor} created event {event} in calendar {calendar}'); |
|
87 | + } else if ($event->getSubject() === self::SUBJECT_OBJECT_ADD . '_event_self') { |
|
88 | + $subject = $this->l->t('You created event {event} in calendar {calendar}'); |
|
89 | + } else if ($event->getSubject() === self::SUBJECT_OBJECT_DELETE . '_event') { |
|
90 | + $subject = $this->l->t('{actor} deleted event {event} from calendar {calendar}'); |
|
91 | + } else if ($event->getSubject() === self::SUBJECT_OBJECT_DELETE . '_event_self') { |
|
92 | + $subject = $this->l->t('You deleted event {event} from calendar {calendar}'); |
|
93 | + } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_event') { |
|
94 | + $subject = $this->l->t('{actor} updated event {event} in calendar {calendar}'); |
|
95 | + } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_event_self') { |
|
96 | + $subject = $this->l->t('You updated event {event} in calendar {calendar}'); |
|
97 | + } else { |
|
98 | + throw new \InvalidArgumentException(); |
|
99 | + } |
|
100 | + |
|
101 | + $parsedParameters = $this->getParameters($event); |
|
102 | + $this->setSubjects($event, $subject, $parsedParameters); |
|
103 | + |
|
104 | + $event = $this->eventMerger->mergeEvents('event', $event, $previousEvent); |
|
105 | + |
|
106 | + return $event; |
|
107 | + } |
|
108 | + |
|
109 | + /** |
|
110 | + * @param IEvent $event |
|
111 | + * @return array |
|
112 | + */ |
|
113 | + protected function getParameters(IEvent $event) { |
|
114 | + $subject = $event->getSubject(); |
|
115 | + $parameters = $event->getSubjectParameters(); |
|
116 | + |
|
117 | + switch ($subject) { |
|
118 | + case self::SUBJECT_OBJECT_ADD . '_event': |
|
119 | + case self::SUBJECT_OBJECT_DELETE . '_event': |
|
120 | + case self::SUBJECT_OBJECT_UPDATE . '_event': |
|
121 | + return [ |
|
122 | + 'actor' => $this->generateUserParameter($parameters[0]), |
|
123 | + 'calendar' => $this->generateCalendarParameter($event->getObjectId(), $parameters[1]), |
|
124 | + 'event' => $this->generateObjectParameter($parameters[2]), |
|
125 | + ]; |
|
126 | + case self::SUBJECT_OBJECT_ADD . '_event_self': |
|
127 | + case self::SUBJECT_OBJECT_DELETE . '_event_self': |
|
128 | + case self::SUBJECT_OBJECT_UPDATE . '_event_self': |
|
129 | + return [ |
|
130 | + 'calendar' => $this->generateCalendarParameter($event->getObjectId(), $parameters[1]), |
|
131 | + 'event' => $this->generateObjectParameter($parameters[2]), |
|
132 | + ]; |
|
133 | + } |
|
134 | + |
|
135 | + throw new \InvalidArgumentException(); |
|
136 | + } |
|
137 | 137 | } |
@@ -25,86 +25,86 @@ |
||
25 | 25 | |
26 | 26 | class Todo extends Event { |
27 | 27 | |
28 | - /** |
|
29 | - * @param string $language |
|
30 | - * @param IEvent $event |
|
31 | - * @param IEvent|null $previousEvent |
|
32 | - * @return IEvent |
|
33 | - * @throws \InvalidArgumentException |
|
34 | - * @since 11.0.0 |
|
35 | - */ |
|
36 | - public function parse($language, IEvent $event, IEvent $previousEvent = null) { |
|
37 | - if ($event->getApp() !== 'dav' || $event->getType() !== 'calendar_todo') { |
|
38 | - throw new \InvalidArgumentException(); |
|
39 | - } |
|
28 | + /** |
|
29 | + * @param string $language |
|
30 | + * @param IEvent $event |
|
31 | + * @param IEvent|null $previousEvent |
|
32 | + * @return IEvent |
|
33 | + * @throws \InvalidArgumentException |
|
34 | + * @since 11.0.0 |
|
35 | + */ |
|
36 | + public function parse($language, IEvent $event, IEvent $previousEvent = null) { |
|
37 | + if ($event->getApp() !== 'dav' || $event->getType() !== 'calendar_todo') { |
|
38 | + throw new \InvalidArgumentException(); |
|
39 | + } |
|
40 | 40 | |
41 | - $this->l = $this->languageFactory->get('dav', $language); |
|
41 | + $this->l = $this->languageFactory->get('dav', $language); |
|
42 | 42 | |
43 | - $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/checkmark.svg'))); |
|
43 | + $event->setIcon($this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/checkmark.svg'))); |
|
44 | 44 | |
45 | - if ($event->getSubject() === self::SUBJECT_OBJECT_ADD . '_todo') { |
|
46 | - $subject = $this->l->t('{actor} created todo {todo} in list {calendar}'); |
|
47 | - } else if ($event->getSubject() === self::SUBJECT_OBJECT_ADD . '_todo_self') { |
|
48 | - $subject = $this->l->t('You created todo {todo} in list {calendar}'); |
|
49 | - } else if ($event->getSubject() === self::SUBJECT_OBJECT_DELETE . '_todo') { |
|
50 | - $subject = $this->l->t('{actor} deleted todo {todo} from list {calendar}'); |
|
51 | - } else if ($event->getSubject() === self::SUBJECT_OBJECT_DELETE . '_todo_self') { |
|
52 | - $subject = $this->l->t('You deleted todo {todo} from list {calendar}'); |
|
53 | - } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo') { |
|
54 | - $subject = $this->l->t('{actor} updated todo {todo} in list {calendar}'); |
|
55 | - } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_self') { |
|
56 | - $subject = $this->l->t('You updated todo {todo} in list {calendar}'); |
|
45 | + if ($event->getSubject() === self::SUBJECT_OBJECT_ADD . '_todo') { |
|
46 | + $subject = $this->l->t('{actor} created todo {todo} in list {calendar}'); |
|
47 | + } else if ($event->getSubject() === self::SUBJECT_OBJECT_ADD . '_todo_self') { |
|
48 | + $subject = $this->l->t('You created todo {todo} in list {calendar}'); |
|
49 | + } else if ($event->getSubject() === self::SUBJECT_OBJECT_DELETE . '_todo') { |
|
50 | + $subject = $this->l->t('{actor} deleted todo {todo} from list {calendar}'); |
|
51 | + } else if ($event->getSubject() === self::SUBJECT_OBJECT_DELETE . '_todo_self') { |
|
52 | + $subject = $this->l->t('You deleted todo {todo} from list {calendar}'); |
|
53 | + } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo') { |
|
54 | + $subject = $this->l->t('{actor} updated todo {todo} in list {calendar}'); |
|
55 | + } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_self') { |
|
56 | + $subject = $this->l->t('You updated todo {todo} in list {calendar}'); |
|
57 | 57 | |
58 | - } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_completed') { |
|
59 | - $subject = $this->l->t('{actor} solved todo {todo} in list {calendar}'); |
|
60 | - } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_completed_self') { |
|
61 | - $subject = $this->l->t('You solved todo {todo} in list {calendar}'); |
|
62 | - } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action') { |
|
63 | - $subject = $this->l->t('{actor} reopened todo {todo} in list {calendar}'); |
|
64 | - } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action_self') { |
|
65 | - $subject = $this->l->t('You reopened todo {todo} in list {calendar}'); |
|
66 | - } else { |
|
67 | - throw new \InvalidArgumentException(); |
|
68 | - } |
|
58 | + } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_completed') { |
|
59 | + $subject = $this->l->t('{actor} solved todo {todo} in list {calendar}'); |
|
60 | + } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_completed_self') { |
|
61 | + $subject = $this->l->t('You solved todo {todo} in list {calendar}'); |
|
62 | + } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action') { |
|
63 | + $subject = $this->l->t('{actor} reopened todo {todo} in list {calendar}'); |
|
64 | + } else if ($event->getSubject() === self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action_self') { |
|
65 | + $subject = $this->l->t('You reopened todo {todo} in list {calendar}'); |
|
66 | + } else { |
|
67 | + throw new \InvalidArgumentException(); |
|
68 | + } |
|
69 | 69 | |
70 | - $parsedParameters = $this->getParameters($event); |
|
71 | - $this->setSubjects($event, $subject, $parsedParameters); |
|
70 | + $parsedParameters = $this->getParameters($event); |
|
71 | + $this->setSubjects($event, $subject, $parsedParameters); |
|
72 | 72 | |
73 | - $event = $this->eventMerger->mergeEvents('todo', $event, $previousEvent); |
|
73 | + $event = $this->eventMerger->mergeEvents('todo', $event, $previousEvent); |
|
74 | 74 | |
75 | - return $event; |
|
76 | - } |
|
75 | + return $event; |
|
76 | + } |
|
77 | 77 | |
78 | - /** |
|
79 | - * @param IEvent $event |
|
80 | - * @return array |
|
81 | - */ |
|
82 | - protected function getParameters(IEvent $event) { |
|
83 | - $subject = $event->getSubject(); |
|
84 | - $parameters = $event->getSubjectParameters(); |
|
78 | + /** |
|
79 | + * @param IEvent $event |
|
80 | + * @return array |
|
81 | + */ |
|
82 | + protected function getParameters(IEvent $event) { |
|
83 | + $subject = $event->getSubject(); |
|
84 | + $parameters = $event->getSubjectParameters(); |
|
85 | 85 | |
86 | - switch ($subject) { |
|
87 | - case self::SUBJECT_OBJECT_ADD . '_todo': |
|
88 | - case self::SUBJECT_OBJECT_DELETE . '_todo': |
|
89 | - case self::SUBJECT_OBJECT_UPDATE . '_todo': |
|
90 | - case self::SUBJECT_OBJECT_UPDATE . '_todo_completed': |
|
91 | - case self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action': |
|
92 | - return [ |
|
93 | - 'actor' => $this->generateUserParameter($parameters[0]), |
|
94 | - 'calendar' => $this->generateCalendarParameter($event->getObjectId(), $parameters[1]), |
|
95 | - 'todo' => $this->generateObjectParameter($parameters[2]), |
|
96 | - ]; |
|
97 | - case self::SUBJECT_OBJECT_ADD . '_todo_self': |
|
98 | - case self::SUBJECT_OBJECT_DELETE . '_todo_self': |
|
99 | - case self::SUBJECT_OBJECT_UPDATE . '_todo_self': |
|
100 | - case self::SUBJECT_OBJECT_UPDATE . '_todo_completed_self': |
|
101 | - case self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action_self': |
|
102 | - return [ |
|
103 | - 'calendar' => $this->generateCalendarParameter($event->getObjectId(), $parameters[1]), |
|
104 | - 'todo' => $this->generateObjectParameter($parameters[2]), |
|
105 | - ]; |
|
106 | - } |
|
86 | + switch ($subject) { |
|
87 | + case self::SUBJECT_OBJECT_ADD . '_todo': |
|
88 | + case self::SUBJECT_OBJECT_DELETE . '_todo': |
|
89 | + case self::SUBJECT_OBJECT_UPDATE . '_todo': |
|
90 | + case self::SUBJECT_OBJECT_UPDATE . '_todo_completed': |
|
91 | + case self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action': |
|
92 | + return [ |
|
93 | + 'actor' => $this->generateUserParameter($parameters[0]), |
|
94 | + 'calendar' => $this->generateCalendarParameter($event->getObjectId(), $parameters[1]), |
|
95 | + 'todo' => $this->generateObjectParameter($parameters[2]), |
|
96 | + ]; |
|
97 | + case self::SUBJECT_OBJECT_ADD . '_todo_self': |
|
98 | + case self::SUBJECT_OBJECT_DELETE . '_todo_self': |
|
99 | + case self::SUBJECT_OBJECT_UPDATE . '_todo_self': |
|
100 | + case self::SUBJECT_OBJECT_UPDATE . '_todo_completed_self': |
|
101 | + case self::SUBJECT_OBJECT_UPDATE . '_todo_needs_action_self': |
|
102 | + return [ |
|
103 | + 'calendar' => $this->generateCalendarParameter($event->getObjectId(), $parameters[1]), |
|
104 | + 'todo' => $this->generateObjectParameter($parameters[2]), |
|
105 | + ]; |
|
106 | + } |
|
107 | 107 | |
108 | - throw new \InvalidArgumentException(); |
|
109 | - } |
|
108 | + throw new \InvalidArgumentException(); |
|
109 | + } |
|
110 | 110 | } |
@@ -28,65 +28,65 @@ |
||
28 | 28 | |
29 | 29 | class Calendar implements IFilter { |
30 | 30 | |
31 | - /** @var IL10N */ |
|
32 | - protected $l; |
|
31 | + /** @var IL10N */ |
|
32 | + protected $l; |
|
33 | 33 | |
34 | - /** @var IURLGenerator */ |
|
35 | - protected $url; |
|
34 | + /** @var IURLGenerator */ |
|
35 | + protected $url; |
|
36 | 36 | |
37 | - public function __construct(IL10N $l, IURLGenerator $url) { |
|
38 | - $this->l = $l; |
|
39 | - $this->url = $url; |
|
40 | - } |
|
37 | + public function __construct(IL10N $l, IURLGenerator $url) { |
|
38 | + $this->l = $l; |
|
39 | + $this->url = $url; |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * @return string Lowercase a-z and underscore only identifier |
|
44 | - * @since 11.0.0 |
|
45 | - */ |
|
46 | - public function getIdentifier() { |
|
47 | - return 'calendar'; |
|
48 | - } |
|
42 | + /** |
|
43 | + * @return string Lowercase a-z and underscore only identifier |
|
44 | + * @since 11.0.0 |
|
45 | + */ |
|
46 | + public function getIdentifier() { |
|
47 | + return 'calendar'; |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * @return string A translated string |
|
52 | - * @since 11.0.0 |
|
53 | - */ |
|
54 | - public function getName() { |
|
55 | - return $this->l->t('Calendar'); |
|
56 | - } |
|
50 | + /** |
|
51 | + * @return string A translated string |
|
52 | + * @since 11.0.0 |
|
53 | + */ |
|
54 | + public function getName() { |
|
55 | + return $this->l->t('Calendar'); |
|
56 | + } |
|
57 | 57 | |
58 | - /** |
|
59 | - * @return int whether the filter should be rather on the top or bottom of |
|
60 | - * the admin section. The filters are arranged in ascending order of the |
|
61 | - * priority values. It is required to return a value between 0 and 100. |
|
62 | - * @since 11.0.0 |
|
63 | - */ |
|
64 | - public function getPriority() { |
|
65 | - return 40; |
|
66 | - } |
|
58 | + /** |
|
59 | + * @return int whether the filter should be rather on the top or bottom of |
|
60 | + * the admin section. The filters are arranged in ascending order of the |
|
61 | + * priority values. It is required to return a value between 0 and 100. |
|
62 | + * @since 11.0.0 |
|
63 | + */ |
|
64 | + public function getPriority() { |
|
65 | + return 40; |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * @return string Full URL to an icon, empty string when none is given |
|
70 | - * @since 11.0.0 |
|
71 | - */ |
|
72 | - public function getIcon() { |
|
73 | - return $this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.svg')); |
|
74 | - } |
|
68 | + /** |
|
69 | + * @return string Full URL to an icon, empty string when none is given |
|
70 | + * @since 11.0.0 |
|
71 | + */ |
|
72 | + public function getIcon() { |
|
73 | + return $this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.svg')); |
|
74 | + } |
|
75 | 75 | |
76 | - /** |
|
77 | - * @param string[] $types |
|
78 | - * @return string[] An array of allowed apps from which activities should be displayed |
|
79 | - * @since 11.0.0 |
|
80 | - */ |
|
81 | - public function filterTypes(array $types) { |
|
82 | - return array_intersect(['calendar', 'calendar_event'], $types); |
|
83 | - } |
|
76 | + /** |
|
77 | + * @param string[] $types |
|
78 | + * @return string[] An array of allowed apps from which activities should be displayed |
|
79 | + * @since 11.0.0 |
|
80 | + */ |
|
81 | + public function filterTypes(array $types) { |
|
82 | + return array_intersect(['calendar', 'calendar_event'], $types); |
|
83 | + } |
|
84 | 84 | |
85 | - /** |
|
86 | - * @return string[] An array of allowed apps from which activities should be displayed |
|
87 | - * @since 11.0.0 |
|
88 | - */ |
|
89 | - public function allowedApps() { |
|
90 | - return []; |
|
91 | - } |
|
85 | + /** |
|
86 | + * @return string[] An array of allowed apps from which activities should be displayed |
|
87 | + * @since 11.0.0 |
|
88 | + */ |
|
89 | + public function allowedApps() { |
|
90 | + return []; |
|
91 | + } |
|
92 | 92 | } |
@@ -28,65 +28,65 @@ |
||
28 | 28 | |
29 | 29 | class Todo implements IFilter { |
30 | 30 | |
31 | - /** @var IL10N */ |
|
32 | - protected $l; |
|
31 | + /** @var IL10N */ |
|
32 | + protected $l; |
|
33 | 33 | |
34 | - /** @var IURLGenerator */ |
|
35 | - protected $url; |
|
34 | + /** @var IURLGenerator */ |
|
35 | + protected $url; |
|
36 | 36 | |
37 | - public function __construct(IL10N $l, IURLGenerator $url) { |
|
38 | - $this->l = $l; |
|
39 | - $this->url = $url; |
|
40 | - } |
|
37 | + public function __construct(IL10N $l, IURLGenerator $url) { |
|
38 | + $this->l = $l; |
|
39 | + $this->url = $url; |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * @return string Lowercase a-z and underscore only identifier |
|
44 | - * @since 11.0.0 |
|
45 | - */ |
|
46 | - public function getIdentifier() { |
|
47 | - return 'calendar_todo'; |
|
48 | - } |
|
42 | + /** |
|
43 | + * @return string Lowercase a-z and underscore only identifier |
|
44 | + * @since 11.0.0 |
|
45 | + */ |
|
46 | + public function getIdentifier() { |
|
47 | + return 'calendar_todo'; |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * @return string A translated string |
|
52 | - * @since 11.0.0 |
|
53 | - */ |
|
54 | - public function getName() { |
|
55 | - return $this->l->t('Todos'); |
|
56 | - } |
|
50 | + /** |
|
51 | + * @return string A translated string |
|
52 | + * @since 11.0.0 |
|
53 | + */ |
|
54 | + public function getName() { |
|
55 | + return $this->l->t('Todos'); |
|
56 | + } |
|
57 | 57 | |
58 | - /** |
|
59 | - * @return int whether the filter should be rather on the top or bottom of |
|
60 | - * the admin section. The filters are arranged in ascending order of the |
|
61 | - * priority values. It is required to return a value between 0 and 100. |
|
62 | - * @since 11.0.0 |
|
63 | - */ |
|
64 | - public function getPriority() { |
|
65 | - return 40; |
|
66 | - } |
|
58 | + /** |
|
59 | + * @return int whether the filter should be rather on the top or bottom of |
|
60 | + * the admin section. The filters are arranged in ascending order of the |
|
61 | + * priority values. It is required to return a value between 0 and 100. |
|
62 | + * @since 11.0.0 |
|
63 | + */ |
|
64 | + public function getPriority() { |
|
65 | + return 40; |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * @return string Full URL to an icon, empty string when none is given |
|
70 | - * @since 11.0.0 |
|
71 | - */ |
|
72 | - public function getIcon() { |
|
73 | - return $this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/checkmark.svg')); |
|
74 | - } |
|
68 | + /** |
|
69 | + * @return string Full URL to an icon, empty string when none is given |
|
70 | + * @since 11.0.0 |
|
71 | + */ |
|
72 | + public function getIcon() { |
|
73 | + return $this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/checkmark.svg')); |
|
74 | + } |
|
75 | 75 | |
76 | - /** |
|
77 | - * @param string[] $types |
|
78 | - * @return string[] An array of allowed apps from which activities should be displayed |
|
79 | - * @since 11.0.0 |
|
80 | - */ |
|
81 | - public function filterTypes(array $types) { |
|
82 | - return array_intersect(['calendar_todo'], $types); |
|
83 | - } |
|
76 | + /** |
|
77 | + * @param string[] $types |
|
78 | + * @return string[] An array of allowed apps from which activities should be displayed |
|
79 | + * @since 11.0.0 |
|
80 | + */ |
|
81 | + public function filterTypes(array $types) { |
|
82 | + return array_intersect(['calendar_todo'], $types); |
|
83 | + } |
|
84 | 84 | |
85 | - /** |
|
86 | - * @return string[] An array of allowed apps from which activities should be displayed |
|
87 | - * @since 11.0.0 |
|
88 | - */ |
|
89 | - public function allowedApps() { |
|
90 | - return []; |
|
91 | - } |
|
85 | + /** |
|
86 | + * @return string[] An array of allowed apps from which activities should be displayed |
|
87 | + * @since 11.0.0 |
|
88 | + */ |
|
89 | + public function allowedApps() { |
|
90 | + return []; |
|
91 | + } |
|
92 | 92 | } |
@@ -27,72 +27,72 @@ |
||
27 | 27 | |
28 | 28 | class Calendar implements ISetting { |
29 | 29 | |
30 | - /** @var IL10N */ |
|
31 | - protected $l; |
|
30 | + /** @var IL10N */ |
|
31 | + protected $l; |
|
32 | 32 | |
33 | - /** |
|
34 | - * @param IL10N $l |
|
35 | - */ |
|
36 | - public function __construct(IL10N $l) { |
|
37 | - $this->l = $l; |
|
38 | - } |
|
33 | + /** |
|
34 | + * @param IL10N $l |
|
35 | + */ |
|
36 | + public function __construct(IL10N $l) { |
|
37 | + $this->l = $l; |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * @return string Lowercase a-z and underscore only identifier |
|
42 | - * @since 11.0.0 |
|
43 | - */ |
|
44 | - public function getIdentifier() { |
|
45 | - return 'calendar'; |
|
46 | - } |
|
40 | + /** |
|
41 | + * @return string Lowercase a-z and underscore only identifier |
|
42 | + * @since 11.0.0 |
|
43 | + */ |
|
44 | + public function getIdentifier() { |
|
45 | + return 'calendar'; |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * @return string A translated string |
|
50 | - * @since 11.0.0 |
|
51 | - */ |
|
52 | - public function getName() { |
|
53 | - return $this->l->t('A <strong>calendar</strong> was modified'); |
|
54 | - } |
|
48 | + /** |
|
49 | + * @return string A translated string |
|
50 | + * @since 11.0.0 |
|
51 | + */ |
|
52 | + public function getName() { |
|
53 | + return $this->l->t('A <strong>calendar</strong> was modified'); |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * @return int whether the filter should be rather on the top or bottom of |
|
58 | - * the admin section. The filters are arranged in ascending order of the |
|
59 | - * priority values. It is required to return a value between 0 and 100. |
|
60 | - * @since 11.0.0 |
|
61 | - */ |
|
62 | - public function getPriority() { |
|
63 | - return 50; |
|
64 | - } |
|
56 | + /** |
|
57 | + * @return int whether the filter should be rather on the top or bottom of |
|
58 | + * the admin section. The filters are arranged in ascending order of the |
|
59 | + * priority values. It is required to return a value between 0 and 100. |
|
60 | + * @since 11.0.0 |
|
61 | + */ |
|
62 | + public function getPriority() { |
|
63 | + return 50; |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * @return bool True when the option can be changed for the stream |
|
68 | - * @since 11.0.0 |
|
69 | - */ |
|
70 | - public function canChangeStream() { |
|
71 | - return true; |
|
72 | - } |
|
66 | + /** |
|
67 | + * @return bool True when the option can be changed for the stream |
|
68 | + * @since 11.0.0 |
|
69 | + */ |
|
70 | + public function canChangeStream() { |
|
71 | + return true; |
|
72 | + } |
|
73 | 73 | |
74 | - /** |
|
75 | - * @return bool True when the option can be changed for the stream |
|
76 | - * @since 11.0.0 |
|
77 | - */ |
|
78 | - public function isDefaultEnabledStream() { |
|
79 | - return true; |
|
80 | - } |
|
74 | + /** |
|
75 | + * @return bool True when the option can be changed for the stream |
|
76 | + * @since 11.0.0 |
|
77 | + */ |
|
78 | + public function isDefaultEnabledStream() { |
|
79 | + return true; |
|
80 | + } |
|
81 | 81 | |
82 | - /** |
|
83 | - * @return bool True when the option can be changed for the mail |
|
84 | - * @since 11.0.0 |
|
85 | - */ |
|
86 | - public function canChangeMail() { |
|
87 | - return true; |
|
88 | - } |
|
82 | + /** |
|
83 | + * @return bool True when the option can be changed for the mail |
|
84 | + * @since 11.0.0 |
|
85 | + */ |
|
86 | + public function canChangeMail() { |
|
87 | + return true; |
|
88 | + } |
|
89 | 89 | |
90 | - /** |
|
91 | - * @return bool True when the option can be changed for the stream |
|
92 | - * @since 11.0.0 |
|
93 | - */ |
|
94 | - public function isDefaultEnabledMail() { |
|
95 | - return false; |
|
96 | - } |
|
90 | + /** |
|
91 | + * @return bool True when the option can be changed for the stream |
|
92 | + * @since 11.0.0 |
|
93 | + */ |
|
94 | + public function isDefaultEnabledMail() { |
|
95 | + return false; |
|
96 | + } |
|
97 | 97 | } |
98 | 98 |
@@ -27,72 +27,72 @@ |
||
27 | 27 | |
28 | 28 | class Event implements ISetting { |
29 | 29 | |
30 | - /** @var IL10N */ |
|
31 | - protected $l; |
|
30 | + /** @var IL10N */ |
|
31 | + protected $l; |
|
32 | 32 | |
33 | - /** |
|
34 | - * @param IL10N $l |
|
35 | - */ |
|
36 | - public function __construct(IL10N $l) { |
|
37 | - $this->l = $l; |
|
38 | - } |
|
33 | + /** |
|
34 | + * @param IL10N $l |
|
35 | + */ |
|
36 | + public function __construct(IL10N $l) { |
|
37 | + $this->l = $l; |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * @return string Lowercase a-z and underscore only identifier |
|
42 | - * @since 11.0.0 |
|
43 | - */ |
|
44 | - public function getIdentifier() { |
|
45 | - return 'calendar_event'; |
|
46 | - } |
|
40 | + /** |
|
41 | + * @return string Lowercase a-z and underscore only identifier |
|
42 | + * @since 11.0.0 |
|
43 | + */ |
|
44 | + public function getIdentifier() { |
|
45 | + return 'calendar_event'; |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * @return string A translated string |
|
50 | - * @since 11.0.0 |
|
51 | - */ |
|
52 | - public function getName() { |
|
53 | - return $this->l->t('A calendar <strong>event</strong> was modified'); |
|
54 | - } |
|
48 | + /** |
|
49 | + * @return string A translated string |
|
50 | + * @since 11.0.0 |
|
51 | + */ |
|
52 | + public function getName() { |
|
53 | + return $this->l->t('A calendar <strong>event</strong> was modified'); |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * @return int whether the filter should be rather on the top or bottom of |
|
58 | - * the admin section. The filters are arranged in ascending order of the |
|
59 | - * priority values. It is required to return a value between 0 and 100. |
|
60 | - * @since 11.0.0 |
|
61 | - */ |
|
62 | - public function getPriority() { |
|
63 | - return 50; |
|
64 | - } |
|
56 | + /** |
|
57 | + * @return int whether the filter should be rather on the top or bottom of |
|
58 | + * the admin section. The filters are arranged in ascending order of the |
|
59 | + * priority values. It is required to return a value between 0 and 100. |
|
60 | + * @since 11.0.0 |
|
61 | + */ |
|
62 | + public function getPriority() { |
|
63 | + return 50; |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * @return bool True when the option can be changed for the stream |
|
68 | - * @since 11.0.0 |
|
69 | - */ |
|
70 | - public function canChangeStream() { |
|
71 | - return true; |
|
72 | - } |
|
66 | + /** |
|
67 | + * @return bool True when the option can be changed for the stream |
|
68 | + * @since 11.0.0 |
|
69 | + */ |
|
70 | + public function canChangeStream() { |
|
71 | + return true; |
|
72 | + } |
|
73 | 73 | |
74 | - /** |
|
75 | - * @return bool True when the option can be changed for the stream |
|
76 | - * @since 11.0.0 |
|
77 | - */ |
|
78 | - public function isDefaultEnabledStream() { |
|
79 | - return true; |
|
80 | - } |
|
74 | + /** |
|
75 | + * @return bool True when the option can be changed for the stream |
|
76 | + * @since 11.0.0 |
|
77 | + */ |
|
78 | + public function isDefaultEnabledStream() { |
|
79 | + return true; |
|
80 | + } |
|
81 | 81 | |
82 | - /** |
|
83 | - * @return bool True when the option can be changed for the mail |
|
84 | - * @since 11.0.0 |
|
85 | - */ |
|
86 | - public function canChangeMail() { |
|
87 | - return true; |
|
88 | - } |
|
82 | + /** |
|
83 | + * @return bool True when the option can be changed for the mail |
|
84 | + * @since 11.0.0 |
|
85 | + */ |
|
86 | + public function canChangeMail() { |
|
87 | + return true; |
|
88 | + } |
|
89 | 89 | |
90 | - /** |
|
91 | - * @return bool True when the option can be changed for the stream |
|
92 | - * @since 11.0.0 |
|
93 | - */ |
|
94 | - public function isDefaultEnabledMail() { |
|
95 | - return false; |
|
96 | - } |
|
90 | + /** |
|
91 | + * @return bool True when the option can be changed for the stream |
|
92 | + * @since 11.0.0 |
|
93 | + */ |
|
94 | + public function isDefaultEnabledMail() { |
|
95 | + return false; |
|
96 | + } |
|
97 | 97 | } |
98 | 98 |
@@ -27,72 +27,72 @@ |
||
27 | 27 | |
28 | 28 | class Todo implements ISetting { |
29 | 29 | |
30 | - /** @var IL10N */ |
|
31 | - protected $l; |
|
30 | + /** @var IL10N */ |
|
31 | + protected $l; |
|
32 | 32 | |
33 | - /** |
|
34 | - * @param IL10N $l |
|
35 | - */ |
|
36 | - public function __construct(IL10N $l) { |
|
37 | - $this->l = $l; |
|
38 | - } |
|
33 | + /** |
|
34 | + * @param IL10N $l |
|
35 | + */ |
|
36 | + public function __construct(IL10N $l) { |
|
37 | + $this->l = $l; |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * @return string Lowercase a-z and underscore only identifier |
|
42 | - * @since 11.0.0 |
|
43 | - */ |
|
44 | - public function getIdentifier() { |
|
45 | - return 'calendar_todo'; |
|
46 | - } |
|
40 | + /** |
|
41 | + * @return string Lowercase a-z and underscore only identifier |
|
42 | + * @since 11.0.0 |
|
43 | + */ |
|
44 | + public function getIdentifier() { |
|
45 | + return 'calendar_todo'; |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * @return string A translated string |
|
50 | - * @since 11.0.0 |
|
51 | - */ |
|
52 | - public function getName() { |
|
53 | - return $this->l->t('A calendar <strong>todo</strong> was modified'); |
|
54 | - } |
|
48 | + /** |
|
49 | + * @return string A translated string |
|
50 | + * @since 11.0.0 |
|
51 | + */ |
|
52 | + public function getName() { |
|
53 | + return $this->l->t('A calendar <strong>todo</strong> was modified'); |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * @return int whether the filter should be rather on the top or bottom of |
|
58 | - * the admin section. The filters are arranged in ascending order of the |
|
59 | - * priority values. It is required to return a value between 0 and 100. |
|
60 | - * @since 11.0.0 |
|
61 | - */ |
|
62 | - public function getPriority() { |
|
63 | - return 50; |
|
64 | - } |
|
56 | + /** |
|
57 | + * @return int whether the filter should be rather on the top or bottom of |
|
58 | + * the admin section. The filters are arranged in ascending order of the |
|
59 | + * priority values. It is required to return a value between 0 and 100. |
|
60 | + * @since 11.0.0 |
|
61 | + */ |
|
62 | + public function getPriority() { |
|
63 | + return 50; |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * @return bool True when the option can be changed for the stream |
|
68 | - * @since 11.0.0 |
|
69 | - */ |
|
70 | - public function canChangeStream() { |
|
71 | - return true; |
|
72 | - } |
|
66 | + /** |
|
67 | + * @return bool True when the option can be changed for the stream |
|
68 | + * @since 11.0.0 |
|
69 | + */ |
|
70 | + public function canChangeStream() { |
|
71 | + return true; |
|
72 | + } |
|
73 | 73 | |
74 | - /** |
|
75 | - * @return bool True when the option can be changed for the stream |
|
76 | - * @since 11.0.0 |
|
77 | - */ |
|
78 | - public function isDefaultEnabledStream() { |
|
79 | - return true; |
|
80 | - } |
|
74 | + /** |
|
75 | + * @return bool True when the option can be changed for the stream |
|
76 | + * @since 11.0.0 |
|
77 | + */ |
|
78 | + public function isDefaultEnabledStream() { |
|
79 | + return true; |
|
80 | + } |
|
81 | 81 | |
82 | - /** |
|
83 | - * @return bool True when the option can be changed for the mail |
|
84 | - * @since 11.0.0 |
|
85 | - */ |
|
86 | - public function canChangeMail() { |
|
87 | - return true; |
|
88 | - } |
|
82 | + /** |
|
83 | + * @return bool True when the option can be changed for the mail |
|
84 | + * @since 11.0.0 |
|
85 | + */ |
|
86 | + public function canChangeMail() { |
|
87 | + return true; |
|
88 | + } |
|
89 | 89 | |
90 | - /** |
|
91 | - * @return bool True when the option can be changed for the stream |
|
92 | - * @since 11.0.0 |
|
93 | - */ |
|
94 | - public function isDefaultEnabledMail() { |
|
95 | - return false; |
|
96 | - } |
|
90 | + /** |
|
91 | + * @return bool True when the option can be changed for the stream |
|
92 | + * @since 11.0.0 |
|
93 | + */ |
|
94 | + public function isDefaultEnabledMail() { |
|
95 | + return false; |
|
96 | + } |
|
97 | 97 | } |
98 | 98 |