Completed
Push — master ( 6d226f...cc9b98 )
by Louis
182:05 queued 126:54
created
back/src/KI/UserBundle/Entity/CoreUser.php 1 patch
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -218,8 +218,8 @@  discard block
 block discarded – undo
218 218
     /**
219 219
      * Add group
220 220
      *
221
-     * @param \KI\UserBundle\Entity\User $group
222
-     * @return Comment
221
+     * @param Group $group
222
+     * @return CoreUser
223 223
      */
224 224
     public function addGroupUser(\KI\UserBundle\Entity\Group $group)
225 225
     {
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
     /**
233 233
      * Remove group
234 234
      *
235
-     * @param \KI\UserBundle\Entity\User $group
235
+     * @param Group $group
236 236
      */
237 237
     public function removeGroupUser(\KI\UserBundle\Entity\Group $group)
238 238
     {
Please login to merge, or discard this patch.
back/src/KI/UserBundle/Repository/UserRepository.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
      */
18 18
     public function findFollowedEvents($userId, $limit = null, $page = null)
19 19
     {
20
-         $query = $this->getEntityManager()->createQuery('SELECT event FROM
20
+            $query = $this->getEntityManager()->createQuery('SELECT event FROM
21 21
             KIPublicationBundle:Event event,
22 22
             KIUserBundle:Club club,
23 23
             KIUserBundle:User user
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,11 +33,11 @@  discard block
 block discarded – undo
33 33
         ')
34 34
             ->setParameter('userId', $userId);
35 35
 
36
-        if($limit !== null && $limit > 0) {
36
+        if ($limit !== null && $limit > 0) {
37 37
             $query->setMaxResults($limit);
38 38
 
39 39
             if ($page !== null && $page > 0)
40
-                $query->setFirstResult(($page - 1) * $limit);
40
+                $query->setFirstResult(($page - 1)*$limit);
41 41
         }
42 42
 
43 43
         return $query->getResult();
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
     public function getOnlineUsers($delay = 30) {
102 102
         return $this->createQueryBuilder('u')
103 103
             ->where('u.lastConnect > :date')
104
-            ->setParameter('date', time() - $delay * 60)
104
+            ->setParameter('date', time() - $delay*60)
105 105
             ->getQuery()
106 106
             ->getResult();
107 107
     }
Please login to merge, or discard this patch.
back/src/KI/UserBundle/Command/FacegameAchievementsCommand.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,23 +47,23 @@
 block discarded – undo
47 47
             $wrongAnswers = $facegame->getWrongAnswers();
48 48
             $duration = $facegame->getDuration();
49 49
 
50
-            if ($wrongAnswers == 0 && $promoGame == $promoUser - 1 && $duration < 60 * 1000) {
50
+            if ($wrongAnswers == 0 && $promoGame == $promoUser - 1 && $duration < 60*1000) {
51 51
 
52 52
                 $achievementCheck = new AchievementCheckEvent(Achievement::GAME_BEFORE, $user);
53 53
                 $dispatcher->dispatch('upont.achievement', $achievementCheck);
54 54
 
55
-            } else if ($wrongAnswers == 0 && $promoGame == $promoUser && $duration < 60 * 1000) {
55
+            } else if ($wrongAnswers == 0 && $promoGame == $promoUser && $duration < 60*1000) {
56 56
 
57 57
                 $achievementCheck = new AchievementCheckEvent(Achievement::GAME_SELF, $user);
58 58
                 $dispatcher->dispatch('upont.achievement', $achievementCheck);
59 59
 
60
-            } else if ($wrongAnswers == 0 && $promoGame == $promoUser + 1 && $duration < 60 * 1000) {
60
+            } else if ($wrongAnswers == 0 && $promoGame == $promoUser + 1 && $duration < 60*1000) {
61 61
 
62 62
                 $achievementCheck = new AchievementCheckEvent(Achievement::GAME_NEXT, $user);
63 63
                 $dispatcher->dispatch('upont.achievement', $achievementCheck);
64 64
 
65 65
             }
66
-            if ($wrongAnswers == 0 && $promoGame < $promoUser && $facegame->getHardcore() && $duration < 60 * 1000) {
66
+            if ($wrongAnswers == 0 && $promoGame < $promoUser && $facegame->getHardcore() && $duration < 60*1000) {
67 67
 
68 68
                 $achievementCheck = new AchievementCheckEvent(Achievement::GAME_OLD, $user);
69 69
                 $dispatcher->dispatch('upont.achievement', $achievementCheck);
Please login to merge, or discard this patch.
back/src/KI/CoreBundle/Helper/FormHelper.php 2 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -5,9 +5,7 @@
 block discarded – undo
5 5
 use Doctrine\ORM\EntityManager;
6 6
 use Symfony\Bundle\FrameworkBundle\Routing\Router;
7 7
 use Symfony\Component\Form\FormFactory;
8
-use Symfony\Component\HttpFoundation\JsonResponse;
9 8
 use Symfony\Component\HttpFoundation\RequestStack;
10
-use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
11 9
 
12 10
 // Valide les formulaires pour une entité et affiche la réponse à la demande
13 11
 class FormHelper
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
     public function formData($item, $method, $flush = true)
39 39
     {
40 40
         // On devine le formulaire à partir du chemin de la classe
41
-        $formName = str_replace('Entity', 'Form', get_class($item)) . 'Type';
41
+        $formName = str_replace('Entity', 'Form', get_class($item)).'Type';
42 42
         $form = $this->formFactory->create($formName, $item, ['method' => $method]);
43 43
         $form->handleRequest($this->request);
44 44
         $code = 400;
Please login to merge, or discard this patch.
back/src/KI/CoreBundle/Helper/PaginateHelper.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,6 @@
 block discarded – undo
4 4
 
5 5
 use Doctrine\ORM\EntityManager;
6 6
 use Doctrine\ORM\EntityRepository;
7
-use Symfony\Component\HttpFoundation\JsonResponse;
8 7
 use Symfony\Component\HttpFoundation\RequestStack;
9 8
 use Symfony\Component\HttpFoundation\Response;
10 9
 
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -63,23 +63,23 @@
 block discarded – undo
63 63
 
64 64
         // On compte le nombre total d'entrées dans la BDD
65 65
         $queryBuilder->select('count(o.id)');
66
-        foreach ($findBy as $key => $values){
66
+        foreach ($findBy as $key => $values) {
67 67
             $andCount = 0;
68 68
             $and = '';
69
-            foreach($values as $value){
70
-                if($andCount > 0){
69
+            foreach ($values as $value) {
70
+                if ($andCount > 0) {
71 71
                     $and .= ' OR ';
72 72
                 }
73
-                $and .= 'o.' . $key . ' = :' . $key . $andCount;
74
-                $queryBuilder->setParameter($key . $andCount, $value);
73
+                $and .= 'o.'.$key.' = :'.$key.$andCount;
74
+                $queryBuilder->setParameter($key.$andCount, $value);
75 75
 
76 76
                 $andCount++;
77 77
             }
78 78
             $queryBuilder->andWhere($and);
79 79
         }
80 80
 
81
-        foreach($sortBy as $field => $order){
82
-            $queryBuilder->addOrderBy('o.' . $field, $order);
81
+        foreach ($sortBy as $field => $order) {
82
+            $queryBuilder->addOrderBy('o.'.$field, $order);
83 83
         }
84 84
 
85 85
         $count = $queryBuilder->getQuery()->getSingleScalarResult();
Please login to merge, or discard this patch.
back/src/KI/DvpBundle/Command/SendOrdersCommand.php 2 patches
Unused Use Statements   +1 added lines, -6 removed lines patch added patch discarded remove patch
@@ -2,17 +2,12 @@
 block discarded – undo
2 2
 
3 3
 namespace KI\DvpBundle\Command;
4 4
 
5
-use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
6
-use Doctrine\ORM\NoResultException;
7 5
 use KI\DvpBundle\Entity\BasketDate;;
6
+use Swift_Message;
8 7
 use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
9
-use Symfony\Component\Console\Input\InputArgument;
10 8
 use Symfony\Component\Console\Input\InputInterface;
11
-use Symfony\Component\Console\Input\InputOption;
12 9
 use Symfony\Component\Console\Output\OutputInterface;
13 10
 
14
-use Swift_Message;
15
-
16 11
 
17 12
 class SendOrdersCommand extends ContainerAwareCommand
18 13
 {
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 
5 5
 use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
6 6
 use Doctrine\ORM\NoResultException;
7
-use KI\DvpBundle\Entity\BasketDate;;
7
+use KI\DvpBundle\Entity\BasketDate; ;
8 8
 use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
9 9
 use Symfony\Component\Console\Input\InputArgument;
10 10
 use Symfony\Component\Console\Input\InputInterface;
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
          */
40 40
         $basketDate = $query->getOneOrNullResult();
41 41
 
42
-        if($basketDate) {
42
+        if ($basketDate) {
43 43
 
44 44
             $orders = $basketDate->getOrders();
45 45
 
46 46
             // Envoi du mail
47 47
             $message = Swift_Message::newInstance()
48
-                ->setSubject('Commandes du ' . $basketDate->getDateRetrieve()->format('l d F Y'))
48
+                ->setSubject('Commandes du '.$basketDate->getDateRetrieve()->format('l d F Y'))
49 49
                 ->setFrom('[email protected]')
50 50
                 ->setTo('[email protected]')
51 51
                 ->setBody($this->getContainer()->get('twig')->render('KIDvpBundle::basket-orders.html.twig', [
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 
73 73
         $count = $query->getSingleScalarResult();
74 74
 
75
-        while($count < 4) {
75
+        while ($count < 4) {
76 76
             $prevDate->modify('next thursday');
77 77
 
78 78
             $dateExists = $query = $em->createQuery('SELECT COUNT(date.id) 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
                 ->setParameter('dateAdding', $prevDate)
82 82
                 ->getSingleScalarResult();
83 83
 
84
-            if($dateExists == 0) {
84
+            if ($dateExists == 0) {
85 85
                 $nextBasketDate = new BasketDate();
86 86
                 $nextBasketDate->setDateRetrieve($prevDate);
87 87
                 $em->persist($nextBasketDate);
Please login to merge, or discard this patch.
back/src/KI/DvpBundle/Controller/BasketDatesController.php 1 patch
Unused Use Statements   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,12 +3,11 @@
 block discarded – undo
3 3
 namespace KI\DvpBundle\Controller;
4 4
 
5 5
 use KI\CoreBundle\Controller\ResourceController;
6
+use Nelmio\ApiDocBundle\Annotation\ApiDoc;
6 7
 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
7 8
 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
8
-use Nelmio\ApiDocBundle\Annotation\ApiDoc;
9 9
 use Symfony\Component\DependencyInjection\ContainerInterface;
10 10
 use Symfony\Component\HttpFoundation\Request;
11
-use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
12 11
 
13 12
 class BasketDatesController extends ResourceController
14 13
 {
Please login to merge, or discard this patch.
back/src/KI/DvpBundle/Controller/BasketsController.php 1 patch
Unused Use Statements   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,11 +3,10 @@
 block discarded – undo
3 3
 namespace KI\DvpBundle\Controller;
4 4
 
5 5
 use KI\CoreBundle\Controller\ResourceController;
6
+use Nelmio\ApiDocBundle\Annotation\ApiDoc;
6 7
 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
7 8
 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
8
-use Nelmio\ApiDocBundle\Annotation\ApiDoc;
9 9
 use Symfony\Component\DependencyInjection\ContainerInterface;
10
-use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
11 10
 
12 11
 class BasketsController extends ResourceController
13 12
 {
Please login to merge, or discard this patch.
back/src/KI/UserBundle/Controller/UsersController.php 3 patches
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,6 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 namespace KI\UserBundle\Controller;
4 4
 
5
+use Exception;
5 6
 use KI\CoreBundle\Controller\ResourceController;
6 7
 use KI\UserBundle\Entity\Achievement;
7 8
 use KI\UserBundle\Entity\User;
@@ -13,7 +14,6 @@  discard block
 block discarded – undo
13 14
 use Symfony\Component\HttpFoundation\Request;
14 15
 use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
15 16
 use Symfony\Component\Security\Core\Exception\AccessDeniedException;
16
-use Exception;
17 17
 
18 18
 class UsersController extends ResourceController
19 19
 {
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
             throw new BadRequestHttpException('Cet utilisateur existe déjà.');
222 222
 
223 223
         // Si le login existe déjà, on ajoute une lettre du prénom
224
-        $login = strtolower(str_replace(' ', '-', substr($this->stripAccents($lastName), 0, 7) . $this->stripAccents($firstName)[0]));
224
+        $login = strtolower(str_replace(' ', '-', substr($this->stripAccents($lastName), 0, 7).$this->stripAccents($firstName)[0]));
225 225
         $i = 1;
226 226
         while (count($repo->findByUsername($login)) > 0) {
227 227
             if (isset($firstName[$i]))
@@ -278,9 +278,9 @@  discard block
 block discarded – undo
278 278
         }
279 279
 
280 280
         // On récupère le contenu du fichier
281
-        $path = __DIR__ . '/../../../../web/uploads/tmp/';
281
+        $path = __DIR__.'/../../../../web/uploads/tmp/';
282 282
         $file->move($path, 'users.list');
283
-        $list = fopen($path . 'users.list', 'r+');
283
+        $list = fopen($path.'users.list', 'r+');
284 284
         if ($list === false)
285 285
             throw new BadRequestHttpException('Erreur lors de l\'upload du fichier');
286 286
 
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
         while (!feof($list)) {
291 291
             // On enlève le caractère de fin de ligne
292 292
             $line = str_replace(["\r", "\n"], ['', ''], fgets($list));
293
-            if(empty($line))
293
+            if (empty($line))
294 294
                 continue;
295 295
 
296 296
             $gender = $login = $firstName = $lastName = $email = $promo = $department = $origin = null;
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
                 $e[] = 'Adresse mail non utilisable';
307 307
 
308 308
             if (count($e) > 0) {
309
-                $fails[] = $line . ' : ' . implode(', ', $e);
309
+                $fails[] = $line.' : '.implode(', ', $e);
310 310
             } else {
311 311
 
312 312
                 /**
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
                 }
334 334
                 $user->setGender($gender);
335 335
 
336
-                $success[] = $firstName . ' ' . $lastName;
336
+                $success[] = $firstName.' '.$lastName;
337 337
             }
338 338
         }
339 339
 
Please login to merge, or discard this patch.
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -343,6 +343,9 @@
 block discarded – undo
343 343
         ], 201);
344 344
     }
345 345
 
346
+    /**
347
+     * @return string
348
+     */
346 349
     private function stripAccents($string)
347 350
     {
348 351
         return str_replace(
Please login to merge, or discard this patch.