Completed
Push — master ( 096baa...85634b )
by Louis
26s queued 13s
created
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   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,8 +58,8 @@
 block discarded – undo
58 58
 
59 59
         // On compte le nombre total d'entrées dans la BDD
60 60
         $queryBuilder->select('count(o.id)');
61
-        foreach ($findBy as $key => $value){
62
-            $queryBuilder->andWhere('o.' . $key . ' = :' . $key);
61
+        foreach ($findBy as $key => $value) {
62
+            $queryBuilder->andWhere('o.'.$key.' = :'.$key);
63 63
             $queryBuilder->setParameter($key, $value);
64 64
         }
65 65
         $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/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/Factory/UserFactory.php 2 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -18,6 +18,12 @@
 block discarded – undo
18 18
         $this->eventDispatcher = $eventDispatcher;
19 19
     }
20 20
 
21
+    /**
22
+     * @param string $key
23
+     * @param string $default_value
24
+     *
25
+     * @return string
26
+     */
21 27
     private function array_value($array, $key, $default_value = null)
22 28
     {
23 29
         if (!is_array($array))
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,8 +48,8 @@
 block discarded – undo
48 48
         $user->setEmail($email);
49 49
 
50 50
         $password = $this->array_value($attributes, 'password');
51
-        if(!$password) {
52
-            $password = substr(str_shuffle(strtolower(sha1(rand() . time() . 'salt'))), 0, 8);
51
+        if (!$password) {
52
+            $password = substr(str_shuffle(strtolower(sha1(rand().time().'salt'))), 0, 8);
53 53
             $attributes['password'] = $password;
54 54
         }
55 55
 
Please login to merge, or discard this patch.
back/src/KI/UserBundle/Listener/SendMailUserRegistrationListener.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,6 @@
 block discarded – undo
2 2
 
3 3
 namespace KI\UserBundle\Listener;
4 4
 
5
-use KI\UserBundle\Entity\User;
6 5
 use KI\UserBundle\Event\UserRegistrationEvent;
7 6
 use Swift_Mailer;
8 7
 use Swift_Message;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
         $this->swiftMailer->send($message);
37 37
 
38 38
         $message = Swift_Message::newInstance()
39
-            ->setSubject('[uPont] Nouvelle inscription (' . $username . ')')
39
+            ->setSubject('[uPont] Nouvelle inscription ('.$username.')')
40 40
             ->setFrom('[email protected]')
41 41
             ->setTo('[email protected]')
42 42
             ->setBody($this->twigEngine->render('KIUserBundle::registration-ki.txt.twig', $attributes));
Please login to merge, or discard this patch.
back/src/KI/UserBundle/Security/SsoEnpcLoginAuthenticator.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,6 @@
 block discarded – undo
11 11
 use Symfony\Component\Security\Core\Exception\CustomUserMessageAuthenticationException;
12 12
 use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
13 13
 use Symfony\Component\Security\Core\User\UserInterface;
14
-
15 14
 use Symfony\Component\Security\Core\User\UserProviderInterface;
16 15
 
17 16
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         $username = $credentials['username'];
68 68
 
69 69
         $email = $credentials['mail'];
70
-        if(!preg_match('/@eleves\.enpc\.fr$/', $email))
70
+        if (!preg_match('/@eleves\.enpc\.fr$/', $email))
71 71
             throw new AccessDeniedException();
72 72
 
73 73
         $user = null;
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 
79 79
         }
80 80
 
81
-        if(!$user) {
81
+        if (!$user) {
82 82
             $user = $this->userRepository->findOneBy(['email' => $credentials['mail']]);
83 83
         }
84 84
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
                 'firstName' => $credentials['givenName'],
89 89
                 'lastName' => ucwords(strtolower($credentials['sn'])),
90 90
                 'email' => $credentials['mail'],
91
-                'promo' => '0' . ( substr(strftime('%Y'), 2) + 3)
91
+                'promo' => '0'.(substr(strftime('%Y'), 2) + 3)
92 92
             ];
93 93
 
94 94
             $user = $this->userFactory->createUser($username, [], $credentials);
Please login to merge, or discard this patch.
back/var/SymfonyRequirements.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
      * Adds a mandatory requirement in form of a php.ini configuration.
224 224
      *
225 225
      * @param string        $cfgName           The configuration name used for ini_get()
226
-     * @param bool|callback $evaluation        Either a boolean indicating whether the configuration should evaluate to true or false,
226
+     * @param boolean|string $evaluation        Either a boolean indicating whether the configuration should evaluate to true or false,
227 227
      *                                         or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
228 228
      * @param bool          $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false.
229 229
      *                                         This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
      * Adds an optional recommendation in form of a php.ini configuration.
242 242
      *
243 243
      * @param string        $cfgName           The configuration name used for ini_get()
244
-     * @param bool|callback $evaluation        Either a boolean indicating whether the configuration should evaluate to true or false,
244
+     * @param string|false $evaluation        Either a boolean indicating whether the configuration should evaluate to true or false,
245 245
      *                                         or a callback function receiving the configuration value as parameter to determine the fulfillment of the requirement
246 246
      * @param bool          $approveCfgAbsence If true the Requirement will be fulfilled even if the configuration option does not exist, i.e. ini_get() returns false.
247 247
      *                                         This is helpful for abandoned configs in later PHP versions or configs of an optional extension, like Suhosin.
Please login to merge, or discard this patch.
Switch Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -782,14 +782,14 @@
 block discarded – undo
782 782
         $size = trim($size);
783 783
         $unit = strtolower(substr($size, -1, 1));
784 784
         switch ($unit) {
785
-            case 'g':
786
-                return $size * 1024 * 1024 * 1024;
787
-            case 'm':
788
-                return $size * 1024 * 1024;
789
-            case 'k':
790
-                return $size * 1024;
791
-            default:
792
-                return (int) $size;
785
+        case 'g':
786
+            return $size * 1024 * 1024 * 1024;
787
+        case 'm':
788
+            return $size * 1024 * 1024;
789
+        case 'k':
790
+            return $size * 1024;
791
+        default:
792
+            return (int) $size;
793 793
         }
794 794
     }
795 795
 
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -49,11 +49,11 @@  discard block
 block discarded – undo
49 49
      */
50 50
     public function __construct($fulfilled, $testMessage, $helpHtml, $helpText = null, $optional = false)
51 51
     {
52
-        $this->fulfilled = (bool) $fulfilled;
53
-        $this->testMessage = (string) $testMessage;
54
-        $this->helpHtml = (string) $helpHtml;
55
-        $this->helpText = null === $helpText ? strip_tags($this->helpHtml) : (string) $helpText;
56
-        $this->optional = (bool) $optional;
52
+        $this->fulfilled = (bool)$fulfilled;
53
+        $this->testMessage = (string)$testMessage;
54
+        $this->helpHtml = (string)$helpHtml;
55
+        $this->helpText = null === $helpText ? strip_tags($this->helpHtml) : (string)$helpText;
56
+        $this->optional = (bool)$optional;
57 57
     }
58 58
 
59 59
     /**
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
             );
545 545
         }
546 546
 
547
-        $pcreVersion = defined('PCRE_VERSION') ? (float) PCRE_VERSION : null;
547
+        $pcreVersion = defined('PCRE_VERSION') ? (float)PCRE_VERSION : null;
548 548
 
549 549
         $this->addRequirement(
550 550
             null !== $pcreVersion,
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
 
740 740
         if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
741 741
             $this->addRecommendation(
742
-                $this->getRealpathCacheSize() > 5 * 1024 * 1024,
742
+                $this->getRealpathCacheSize() > 5*1024*1024,
743 743
                 'realpath_cache_size should be above 5242880 in php.ini',
744 744
                 'Setting "<strong>realpath_cache_size</strong>" to e.g. "<strong>5242880</strong>" or "<strong>5000k</strong>" in php.ini<a href="#phpini">*</a> may improve performance on Windows significantly in some cases.'
745 745
             );
@@ -783,13 +783,13 @@  discard block
 block discarded – undo
783 783
         $unit = strtolower(substr($size, -1, 1));
784 784
         switch ($unit) {
785 785
             case 'g':
786
-                return $size * 1024 * 1024 * 1024;
786
+                return $size*1024*1024*1024;
787 787
             case 'm':
788
-                return $size * 1024 * 1024;
788
+                return $size*1024*1024;
789 789
             case 'k':
790
-                return $size * 1024;
790
+                return $size*1024;
791 791
             default:
792
-                return (int) $size;
792
+                return (int)$size;
793 793
         }
794 794
     }
795 795
 
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
                 continue;
812 812
             }
813 813
 
814
-            return (int) $package['version'][1] > 2 ? self::REQUIRED_PHP_VERSION : self::LEGACY_REQUIRED_PHP_VERSION;
814
+            return (int)$package['version'][1] > 2 ? self::REQUIRED_PHP_VERSION : self::LEGACY_REQUIRED_PHP_VERSION;
815 815
         }
816 816
 
817 817
         return false;
Please login to merge, or discard this patch.