@@ -385,6 +385,9 @@ discard block |
||
385 | 385 | return $this->level; |
386 | 386 | } |
387 | 387 | |
388 | + /** |
|
389 | + * @param integer $level |
|
390 | + */ |
|
388 | 391 | public function setLevel($level) |
389 | 392 | { |
390 | 393 | switch ($level) { |
@@ -426,6 +429,9 @@ discard block |
||
426 | 429 | return $this->htmlTemplate; |
427 | 430 | } |
428 | 431 | |
432 | + /** |
|
433 | + * @param string $var |
|
434 | + */ |
|
429 | 435 | public function parseHtmlTemplate($var) |
430 | 436 | { |
431 | 437 | $cplaces = array('%title%' => $this->title, '%shorttext%' => $this->shortText); |
@@ -53,6 +53,9 @@ discard block |
||
53 | 53 | } |
54 | 54 | } |
55 | 55 | |
56 | + /** |
|
57 | + * @param PersonInterface $person |
|
58 | + */ |
|
56 | 59 | public function getTotalUnreadGroupByClient($person) |
57 | 60 | { |
58 | 61 | $qb = $this->getEntityManager()->createQueryBuilder('n') |
@@ -70,6 +73,9 @@ discard block |
||
70 | 73 | ->getResult(); |
71 | 74 | } |
72 | 75 | |
76 | + /** |
|
77 | + * @param PersonInterface $person |
|
78 | + */ |
|
73 | 79 | public function getTotalUnread($person) |
74 | 80 | { |
75 | 81 | return $this->getEntityManager()->createQueryBuilder('n') |
@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use Doctrine\ORM\EntityRepository; |
6 | 6 | use LoginCidadao\CoreBundle\Entity\Person; |
7 | -use Doctrine\ORM\Query; |
|
8 | 7 | use LoginCidadao\CoreBundle\Model\PersonInterface; |
9 | 8 | use LoginCidadao\OAuthBundle\Model\ClientInterface; |
10 | 9 |
@@ -12,8 +12,8 @@ discard block |
||
12 | 12 | { |
13 | 13 | |
14 | 14 | public function findNextNotifications(Person $person, $items = 8, |
15 | - $lastId = 0, |
|
16 | - ClientInterface $client = null) |
|
15 | + $lastId = 0, |
|
16 | + ClientInterface $client = null) |
|
17 | 17 | { |
18 | 18 | $qb = $this->getEntityManager()->createQueryBuilder() |
19 | 19 | ->select('n') |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | return $this->getEntityManager()->createQueryBuilder('n') |
76 | 76 | ->select('COUNT(n.id) total') |
77 | 77 | ->from('LoginCidadaoNotificationBundle:Notification', |
78 | - 'n') |
|
78 | + 'n') |
|
79 | 79 | ->where('n.person = :person') |
80 | 80 | ->andWhere('n.readDate IS NULL') |
81 | 81 | ->setParameter('person', $person) |
@@ -2,17 +2,10 @@ |
||
2 | 2 | |
3 | 3 | namespace LoginCidadao\NotificationBundle\Handler; |
4 | 4 | |
5 | -use Doctrine\Common\Persistence\ObjectManager; |
|
6 | -use Symfony\Component\Form\FormFactoryInterface; |
|
7 | 5 | use LoginCidadao\NotificationBundle\Handler\NotificationHandlerInterface; |
8 | -use LoginCidadao\NotificationBundle\Form\NotificationType; |
|
9 | -use LoginCidadao\NotificationBundle\Model\NotificationInterface; |
|
10 | -use LoginCidadao\NotificationBundle\Exception\InvalidFormException; |
|
11 | 6 | use LoginCidadao\CoreBundle\Model\PersonInterface; |
12 | 7 | use LoginCidadao\OAuthBundle\Model\ClientInterface; |
13 | 8 | use LoginCidadao\NotificationBundle\Model\CategoryInterface; |
14 | -use LoginCidadao\NotificationBundle\Entity\PersonNotificationOption; |
|
15 | -use LoginCidadao\NotificationBundle\Model\NotificationSettings; |
|
16 | 9 | use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; |
17 | 10 | |
18 | 11 | class AuthenticatedNotificationHandler implements AuthenticatedNotificationHandlerInterface |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | public function getAllFromClient(ClientInterface $client, $limit = 5, |
48 | - $offset = 0, $orderby = null) |
|
48 | + $offset = 0, $orderby = null) |
|
49 | 49 | { |
50 | 50 | return $this->handler->getAllFromPersonByClient($this->person, $client, |
51 | 51 | $limit, $offset, |
@@ -78,10 +78,10 @@ discard block |
||
78 | 78 | } |
79 | 79 | |
80 | 80 | public function getGroupedSettings(ClientInterface $client = null, |
81 | - CategoryInterface $category = null) |
|
81 | + CategoryInterface $category = null) |
|
82 | 82 | { |
83 | 83 | return $this->handler->getGroupedSettings($this->person, $client, |
84 | - $category); |
|
84 | + $category); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | public function countUnread() |
@@ -372,6 +372,9 @@ |
||
372 | 372 | return $this->oauthDefaultClient; |
373 | 373 | } |
374 | 374 | |
375 | + /** |
|
376 | + * @param resource $ch |
|
377 | + */ |
|
375 | 378 | protected function registerFailedCallback(NotificationInterface $notification, |
376 | 379 | ObjectManager $om, $ch, |
377 | 380 | $curlResponse) |
@@ -66,16 +66,16 @@ discard block |
||
66 | 66 | } |
67 | 67 | |
68 | 68 | public function getAllFromPerson(PersonInterface $person, $limit = 5, |
69 | - $offset = 0, $orderby = null) |
|
69 | + $offset = 0, $orderby = null) |
|
70 | 70 | { |
71 | 71 | return $this->repository->findBy(array('person' => $person), $orderby, |
72 | 72 | $limit, $offset); |
73 | 73 | } |
74 | 74 | |
75 | 75 | public function getAllFromPersonByClient(PersonInterface $person, |
76 | - ClientInterface $client, |
|
77 | - $limit = 5, $offset = 0, |
|
78 | - $orderby = null) |
|
76 | + ClientInterface $client, |
|
77 | + $limit = 5, $offset = 0, |
|
78 | + $orderby = null) |
|
79 | 79 | { |
80 | 80 | return $this->repository->findBy(array('person' => $person, 'sender' => $client), |
81 | 81 | $orderby, $limit, $offset); |
@@ -114,8 +114,8 @@ discard block |
||
114 | 114 | * @throws \LoginCidadao\CoreBundle\Exception\Notification\InvalidFormException |
115 | 115 | */ |
116 | 116 | private function processForm(NotificationInterface $notification, |
117 | - array $parameters, $method = "PUT", |
|
118 | - PersonInterface $person = null) |
|
117 | + array $parameters, $method = "PUT", |
|
118 | + PersonInterface $person = null) |
|
119 | 119 | { |
120 | 120 | $form = $this->formFactory->create($this->notificationType, |
121 | 121 | $notification, compact('method')); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | } |
195 | 195 | |
196 | 196 | public function initializeSettings(PersonInterface $person, |
197 | - ClientInterface $client = null) |
|
197 | + ClientInterface $client = null) |
|
198 | 198 | { |
199 | 199 | $om = $this->om; |
200 | 200 | $categoriesRepo = $om->getRepository('LoginCidadaoNotificationBundle:Category'); |
@@ -266,8 +266,8 @@ discard block |
||
266 | 266 | } |
267 | 267 | |
268 | 268 | public function getGroupedSettings(PersonInterface $person, |
269 | - ClientInterface $client = null, |
|
270 | - CategoryInterface $category = null) |
|
269 | + ClientInterface $client = null, |
|
270 | + CategoryInterface $category = null) |
|
271 | 271 | { |
272 | 272 | $settings = new NotificationSettings(); |
273 | 273 | |
@@ -290,8 +290,8 @@ discard block |
||
290 | 290 | } |
291 | 291 | |
292 | 292 | public function getAllFromPersonIdOffset(PersonInterface $person, |
293 | - $limit = 5, $offset = 0, |
|
294 | - ClientInterface $client = null) |
|
293 | + $limit = 5, $offset = 0, |
|
294 | + ClientInterface $client = null) |
|
295 | 295 | { |
296 | 296 | return $this->repository->findNextNotifications($person, $limit, |
297 | 297 | $offset, $client); |
@@ -348,9 +348,9 @@ discard block |
||
348 | 348 | } |
349 | 349 | |
350 | 350 | public static function renderEmailByCategory($category, |
351 | - $replacePlaceholders = null, |
|
352 | - $replaceTitle = null, |
|
353 | - $replaceShortText = null) |
|
351 | + $replacePlaceholders = null, |
|
352 | + $replaceTitle = null, |
|
353 | + $replaceShortText = null) |
|
354 | 354 | { |
355 | 355 | return self::_renderHtml($category->getMailTemplate(), |
356 | 356 | $replacePlaceholders, $replaceTitle, $replaceShortText); |
@@ -373,8 +373,8 @@ discard block |
||
373 | 373 | } |
374 | 374 | |
375 | 375 | protected function registerFailedCallback(NotificationInterface $notification, |
376 | - ObjectManager $om, $ch, |
|
377 | - $curlResponse) |
|
376 | + ObjectManager $om, $ch, |
|
377 | + $curlResponse) |
|
378 | 378 | { |
379 | 379 | $info = curl_getinfo($ch); |
380 | 380 | |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | } |
394 | 394 | |
395 | 395 | private function sendCallback(NotificationInterface $notification, |
396 | - ObjectManager $om) |
|
396 | + ObjectManager $om) |
|
397 | 397 | { |
398 | 398 | if ($notification->getCallbackUrl()) { |
399 | 399 | $secret = $notification->getCategory()->getClient()->getSecret(); |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | * Same as getAllFromPerson but uses the notification's id as the offset. |
49 | 49 | * |
50 | 50 | * @param PersonInterface $person |
51 | - * @param type $limit |
|
52 | - * @param type $offset the id of the last notification received |
|
51 | + * @param integer $limit |
|
52 | + * @param integer $offset the id of the last notification received |
|
53 | 53 | * @param ClientInterface $client optionally filters by OAuth Client |
54 | 54 | * |
55 | 55 | * @return NotificationInterface[] |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * Retrieves a person's settings. |
114 | 114 | * |
115 | 115 | * @param PersonInterface $person |
116 | - * @param CategoryInterface $client optionally filter by category |
|
116 | + * @param ClientInterface $client optionally filter by category |
|
117 | 117 | * @param ClientInterface $client optionally filter by client |
118 | 118 | * |
119 | 119 | * @return PersonNotificationOption[] |
@@ -184,7 +184,6 @@ discard block |
||
184 | 184 | /** |
185 | 185 | * Return a person's number of unread notifications grouping by Client |
186 | 186 | * @param PersonInterface $person |
187 | - * @param ClientInterface $client |
|
188 | 187 | * |
189 | 188 | * @return array |
190 | 189 | */ |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @return NotificationInterface[] |
43 | 43 | */ |
44 | 44 | public function getAllFromPerson(PersonInterface $person, $limit = 5, |
45 | - $offset = 0, $orderby = null); |
|
45 | + $offset = 0, $orderby = null); |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * Same as getAllFromPerson but uses the notification's id as the offset. |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | * @return NotificationInterface[] |
56 | 56 | */ |
57 | 57 | public function getAllFromPersonIdOffset(PersonInterface $person, |
58 | - $limit = 5, $offset = 0, |
|
59 | - ClientInterface $client = null); |
|
58 | + $limit = 5, $offset = 0, |
|
59 | + ClientInterface $client = null); |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * Get a list of an user's Notifications restricted by Client. |
@@ -70,9 +70,9 @@ discard block |
||
70 | 70 | * @return NotificationInterface[] |
71 | 71 | */ |
72 | 72 | public function getAllFromPersonByClient(PersonInterface $person, |
73 | - ClientInterface $client, |
|
74 | - $limit = 5, $offset = 0, |
|
75 | - $orderby = null); |
|
73 | + ClientInterface $client, |
|
74 | + $limit = 5, $offset = 0, |
|
75 | + $orderby = null); |
|
76 | 76 | |
77 | 77 | /** |
78 | 78 | * Post Notification, creates a new Notification |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * @return boolean |
143 | 143 | */ |
144 | 144 | public function initializeSettings(PersonInterface $person, |
145 | - ClientInterface $client); |
|
145 | + ClientInterface $client); |
|
146 | 146 | |
147 | 147 | /** |
148 | 148 | * Mark the specified range of IDs as read. |
@@ -163,8 +163,8 @@ discard block |
||
163 | 163 | * @return NotificationSettings PersonNotificationOptions grouped by Client |
164 | 164 | */ |
165 | 165 | public function getGroupedSettings(PersonInterface $person, |
166 | - ClientInterface $client = null, |
|
167 | - CategoryInterface $category = null); |
|
166 | + ClientInterface $client = null, |
|
167 | + CategoryInterface $category = null); |
|
168 | 168 | |
169 | 169 | /** |
170 | 170 | * |
@@ -69,6 +69,9 @@ discard block |
||
69 | 69 | return $this->em->getRepository("LoginCidadaoNotificationBundle:Notification"); |
70 | 70 | } |
71 | 71 | |
72 | + /** |
|
73 | + * @return \LoginCidadao\CoreBundle\Model\PersonInterface |
|
74 | + */ |
|
72 | 75 | public function getUser() |
73 | 76 | { |
74 | 77 | return $this->context->getToken()->getUser(); |
@@ -101,6 +104,16 @@ discard block |
||
101 | 104 | } |
102 | 105 | } |
103 | 106 | |
107 | + /** |
|
108 | + * @param string $title |
|
109 | + * @param string $shortText |
|
110 | + * @param string $text |
|
111 | + * @param string $icon |
|
112 | + * @param Notification $notification |
|
113 | + * @param Placeholder[] $parameters |
|
114 | + * |
|
115 | + * @return NotificationInterface |
|
116 | + */ |
|
104 | 117 | private function getDefaultNotification(Person $person, $title, $shortText, |
105 | 118 | $text, $icon, Category $category, |
106 | 119 | $notification, $parameters = null) |
@@ -10,12 +10,7 @@ |
||
10 | 10 | use LoginCidadao\NotificationBundle\Entity\Notification; |
11 | 11 | use LoginCidadao\NotificationBundle\Entity\Category; |
12 | 12 | use LoginCidadao\NotificationBundle\Exception\MissingCategoryException; |
13 | -use Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer; |
|
14 | -use Symfony\Component\Serializer\Encoder\JsonEncoder; |
|
15 | -use Symfony\Component\Serializer\Serializer; |
|
16 | -use LoginCidadao\NotificationBundle\Form\NotificationType; |
|
17 | 13 | use JMS\Serializer\SerializationContext; |
18 | -use LoginCidadao\NotificationBundle\Handler\NotificationHandler; |
|
19 | 14 | use LoginCidadao\NotificationBundle\Entity\Placeholder; |
20 | 15 | |
21 | 16 | class NotificationsHelper |
@@ -3,7 +3,6 @@ |
||
3 | 3 | namespace LoginCidadao\NotificationBundle\Model; |
4 | 4 | |
5 | 5 | use LoginCidadao\NotificationBundle\Entity\Placeholder; |
6 | -use Doctrine\Common\Collections\ArrayCollection; |
|
7 | 6 | use Doctrine\ORM\EntityManager; |
8 | 7 | |
9 | 8 | class BroadcastPlaceholder |
@@ -34,13 +34,13 @@ |
||
34 | 34 | |
35 | 35 | public function getValue() |
36 | 36 | { |
37 | - return $this->value; |
|
37 | + return $this->value; |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | public function setValue($value) |
41 | 41 | { |
42 | - $this->value = $value; |
|
43 | - return $this; |
|
42 | + $this->value = $value; |
|
43 | + return $this; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | public function getName() |
@@ -214,6 +214,9 @@ discard block |
||
214 | 214 | return $this->name; |
215 | 215 | } |
216 | 216 | |
217 | + /** |
|
218 | + * @param string $description |
|
219 | + */ |
|
217 | 220 | public function setDescription($description) |
218 | 221 | { |
219 | 222 | $this->description = $description; |
@@ -382,8 +385,8 @@ discard block |
||
382 | 385 | |
383 | 386 | /** |
384 | 387 | * Sets the Unique Id of the Entity. |
385 | - * @param string $id the entity UID |
|
386 | - * @return AbstractUniqueEntity |
|
388 | + * @param string $uid the entity UID |
|
389 | + * @return Client |
|
387 | 390 | */ |
388 | 391 | public function setUid($uid = null) |
389 | 392 | { |
@@ -8,7 +8,6 @@ |
||
8 | 8 | use LoginCidadao\NotificationBundle\Entity\Notification; |
9 | 9 | use Symfony\Component\HttpFoundation\File\File; |
10 | 10 | use Symfony\Component\Validator\Constraints as Assert; |
11 | -use JMS\Serializer\Tests\Fixtures\Publisher; |
|
12 | 11 | use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; |
13 | 12 | use JMS\Serializer\Annotation as JMS; |
14 | 13 | use OAuth2\OAuth2; |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | |
140 | 140 | /** |
141 | 141 | * @param PersonInterface[] $members |
142 | - * @return \Organization |
|
142 | + * @return Organization |
|
143 | 143 | */ |
144 | 144 | public function setMembers(array $members) |
145 | 145 | { |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | |
159 | 159 | /** |
160 | 160 | * @param \DateTime $verifiedAt |
161 | - * @return \Organization |
|
161 | + * @return Organization |
|
162 | 162 | */ |
163 | 163 | public function setVerifiedAt($verifiedAt) |
164 | 164 | { |