@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | 'empty_data' => null, |
| 58 | 58 | 'class' => 'LoginCidadao\NotificationBundle\Entity\Category', |
| 59 | 59 | 'property' => 'name', |
| 60 | - 'query_builder' => function (CategoryRepository $repository) use ($person, $clientId) { |
|
| 60 | + 'query_builder' => function(CategoryRepository $repository) use ($person, $clientId) { |
|
| 61 | 61 | return $repository->getOwnedCategoriesQuery($person) |
| 62 | 62 | ->andWhere('c.id = :clientId') |
| 63 | 63 | ->setParameter('clientId', $clientId); |
@@ -66,10 +66,10 @@ discard block |
||
| 66 | 66 | $builder->add('client_id', 'hidden', |
| 67 | 67 | array('required' => false, 'mapped' => false, 'data' => $clientId)); |
| 68 | 68 | $builder->addEventListener(FormEvents::PRE_SUBMIT, |
| 69 | - function (FormEvent $event) use (&$receiversConfig, &$person, $clientId) { |
|
| 69 | + function(FormEvent $event) use (&$receiversConfig, &$person, $clientId) { |
|
| 70 | 70 | $entity = $event->getData(); |
| 71 | 71 | $form = $event->getForm(); |
| 72 | - $receiversConfig['query_builder'] = function (PersonRepository $repository) use ($clientId, &$entity) { |
|
| 72 | + $receiversConfig['query_builder'] = function(PersonRepository $repository) use ($clientId, &$entity) { |
|
| 73 | 73 | $sql = $repository->getFindAuthorizedByClientIdQuery($clientId); |
| 74 | 74 | if (!empty($entity['receivers'])) { |
| 75 | 75 | $sql->andWhere('p.id in (:receivers)'); |
@@ -80,10 +80,10 @@ discard block |
||
| 80 | 80 | $form->add('receivers', 'ajax_choice', $receiversConfig); |
| 81 | 81 | }); |
| 82 | 82 | $builder->addEventListener(FormEvents::PRE_SET_DATA, |
| 83 | - function (FormEvent $event) use (&$receiversConfig, &$person, &$clientId) { |
|
| 83 | + function(FormEvent $event) use (&$receiversConfig, &$person, &$clientId) { |
|
| 84 | 84 | $entity = $event->getData(); |
| 85 | 85 | $form = $event->getForm(); |
| 86 | - $receiversConfig['query_builder'] = function (PersonRepository $repository) { |
|
| 86 | + $receiversConfig['query_builder'] = function(PersonRepository $repository) { |
|
| 87 | 87 | $sql = $repository->createQueryBuilder('u'); |
| 88 | 88 | $sql->where('1 != 1'); |
| 89 | 89 | return $sql; |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | $em = $this->em; |
| 28 | 28 | $placesHoldersForm = $builder->create('placeholders', 'form'); |
| 29 | 29 | $builder->add($placesHoldersForm); |
| 30 | - $preSubmit = function (FormEvent $event) use (&$em) { |
|
| 30 | + $preSubmit = function(FormEvent $event) use (&$em) { |
|
| 31 | 31 | $data = $event->getData(); |
| 32 | 32 | $form = $event->getForm(); |
| 33 | 33 | $form |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | * @return array |
| 55 | 55 | */ |
| 56 | 56 | public function getAllFromClient(ClientInterface $client, $limit = 5, |
| 57 | - $offset = 0, $orderby = null); |
|
| 57 | + $offset = 0, $orderby = null); |
|
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | 60 | * Retrieves a person's settings. |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * @return NotificationSettings PersonNotificationOptions grouped by Client |
| 88 | 88 | */ |
| 89 | 89 | public function getGroupedSettings(ClientInterface $client = null, |
| 90 | - CategoryInterface $category = null); |
|
| 90 | + CategoryInterface $category = null); |
|
| 91 | 91 | |
| 92 | 92 | /** |
| 93 | 93 | * Return a person's number of unread notifications. |
@@ -3,7 +3,6 @@ |
||
| 3 | 3 | namespace LoginCidadao\APIBundle\Entity; |
| 4 | 4 | |
| 5 | 5 | use Doctrine\ORM\Mapping as ORM; |
| 6 | -use LoginCidadao\CoreBundle\Model\PersonInterface; |
|
| 7 | 6 | use LoginCidadao\OAuthBundle\Model\ClientInterface; |
| 8 | 7 | |
| 9 | 8 | /** |
@@ -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(); |
@@ -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 | * |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | return $this->category; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - public function setCategory($category) |
|
| 71 | + public function setCategory($category) |
|
| 72 | 72 | { |
| 73 | 73 | $this->$category = $category; |
| 74 | 74 | return $this; |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | return $this->broadcast->getTitle(); |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - public function setTitle($title) |
|
| 85 | + public function setTitle($title) |
|
| 86 | 86 | { |
| 87 | 87 | $this->broadcast->setTitle($title); |
| 88 | 88 | return $this; |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | return $this->broadcast->getShortText(); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - public function setShortText($shortText) |
|
| 99 | + public function setShortText($shortText) |
|
| 100 | 100 | { |
| 101 | 101 | $this->broadcast->setShortText($shortText); |
| 102 | 102 | return $this; |
@@ -22,8 +22,8 @@ |
||
| 22 | 22 | protected function getCurrentData() |
| 23 | 23 | { |
| 24 | 24 | return $this->handler->allIdOffset($this->getPerIteration(), |
| 25 | - $this->getOffset(), |
|
| 26 | - $this->client); |
|
| 25 | + $this->getOffset(), |
|
| 26 | + $this->client); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | } |
@@ -96,7 +96,7 @@ |
||
| 96 | 96 | protected function getCurrentData() |
| 97 | 97 | { |
| 98 | 98 | $notifications = $this->handler->allIdOffset($this->getPerIteration(), |
| 99 | - $this->getOffset()); |
|
| 99 | + $this->getOffset()); |
|
| 100 | 100 | |
| 101 | 101 | return $notifications; |
| 102 | 102 | } |
@@ -19,15 +19,15 @@ discard block |
||
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | public function getCountPerson(PersonInterface $person = null, |
| 22 | - $clientId = null) |
|
| 22 | + $clientId = null) |
|
| 23 | 23 | { |
| 24 | 24 | $qb = $this->getEntityManager()->createQueryBuilder() |
| 25 | - ->select('count(a.id) AS qty, c AS client') |
|
| 26 | - ->from('LoginCidadaoCoreBundle:Authorization', 'a') |
|
| 25 | + ->select('count(a.id) AS qty, c AS client') |
|
| 26 | + ->from('LoginCidadaoCoreBundle:Authorization', 'a') |
|
| 27 | 27 | ->innerJoin('LoginCidadaoOAuthBundle:Client', 'c', 'WITH', |
| 28 | 28 | 'a.client = c') |
| 29 | - ->where('c.published = true') |
|
| 30 | - ->groupBy('a.client, c') |
|
| 29 | + ->where('c.published = true') |
|
| 30 | + ->groupBy('a.client, c') |
|
| 31 | 31 | ->orderBy('qty', 'DESC'); |
| 32 | 32 | |
| 33 | 33 | if ($person !== null) { |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | public function statsUsersByServiceByDay($days, $clientId = null, |
| 55 | - PersonInterface $person = null) |
|
| 55 | + PersonInterface $person = null) |
|
| 56 | 56 | { |
| 57 | 57 | $date = new \DateTime("-$days days"); |
| 58 | 58 | |