@@ -6,7 +6,6 @@ |
||
6 | 6 | use KI\CoreBundle\Service\CurlService; |
7 | 7 | use KI\CoreBundle\Service\ImageService; |
8 | 8 | use KI\UserBundle\Entity\User; |
9 | - |
|
10 | 9 | use KI\UserBundle\Event\UserRegistrationEvent; |
11 | 10 | |
12 | 11 | class FacebookImportUserRegistrationListener |
@@ -33,26 +33,26 @@ |
||
33 | 33 | switch ($user->getPromo()) { |
34 | 34 | // Attention, toujours préciser l'id facebook de la promo d'après |
35 | 35 | // pour avoir les étrangers |
36 | - case '015': |
|
37 | - $id = '359646667495742'; |
|
38 | - break; // Wei't spirit |
|
39 | - case '016': |
|
40 | - $id = '1451446761806184'; |
|
41 | - break; // Wei't the phoque |
|
42 | - case '017': |
|
43 | - $id = '737969042997359'; |
|
44 | - break; // F'wei'ght Club |
|
45 | - case '018': |
|
46 | - $id = '1739424532975028'; |
|
47 | - break; // WEI'STED |
|
48 | - case '019': |
|
49 | - $id = '313192685791329'; |
|
50 | - break; // WEI'T FOR IT |
|
51 | - case '020': |
|
52 | - $id = '313192685791329'; |
|
53 | - break; // WEI'T FOR IT |
|
54 | - default: |
|
55 | - return; |
|
36 | + case '015': |
|
37 | + $id = '359646667495742'; |
|
38 | + break; // Wei't spirit |
|
39 | + case '016': |
|
40 | + $id = '1451446761806184'; |
|
41 | + break; // Wei't the phoque |
|
42 | + case '017': |
|
43 | + $id = '737969042997359'; |
|
44 | + break; // F'wei'ght Club |
|
45 | + case '018': |
|
46 | + $id = '1739424532975028'; |
|
47 | + break; // WEI'STED |
|
48 | + case '019': |
|
49 | + $id = '313192685791329'; |
|
50 | + break; // WEI'T FOR IT |
|
51 | + case '020': |
|
52 | + $id = '313192685791329'; |
|
53 | + break; // WEI'T FOR IT |
|
54 | + default: |
|
55 | + return; |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | // On récupère la liste des membres |
@@ -24,10 +24,10 @@ discard block |
||
24 | 24 | $this->fbToken = $facebookToken; |
25 | 25 | } |
26 | 26 | |
27 | - public function facebookImport(UserRegistrationEvent $event){ |
|
27 | + public function facebookImport(UserRegistrationEvent $event) { |
|
28 | 28 | $user = $event->getUser(); |
29 | 29 | |
30 | - $token = '?access_token=' . $this->fbToken; |
|
30 | + $token = '?access_token='.$this->fbToken; |
|
31 | 31 | |
32 | 32 | // Ids des différents groupes facebook |
33 | 33 | switch ($user->getPromo()) { |
@@ -35,29 +35,29 @@ discard block |
||
35 | 35 | // pour avoir les étrangers |
36 | 36 | case '015': |
37 | 37 | $id = '359646667495742'; |
38 | - break; // Wei't spirit |
|
38 | + break; // Wei't spirit |
|
39 | 39 | case '016': |
40 | 40 | $id = '1451446761806184'; |
41 | 41 | break; // Wei't the phoque |
42 | 42 | case '017': |
43 | 43 | $id = '737969042997359'; |
44 | - break; // F'wei'ght Club |
|
44 | + break; // F'wei'ght Club |
|
45 | 45 | case '018': |
46 | 46 | $id = '1739424532975028'; |
47 | - break; // WEI'STED |
|
47 | + break; // WEI'STED |
|
48 | 48 | case '019': |
49 | 49 | $id = '313192685791329'; |
50 | - break; // WEI'T FOR IT |
|
50 | + break; // WEI'T FOR IT |
|
51 | 51 | case '020': |
52 | 52 | $id = '313192685791329'; |
53 | - break; // WEI'T FOR IT |
|
53 | + break; // WEI'T FOR IT |
|
54 | 54 | default: |
55 | 55 | return; |
56 | 56 | } |
57 | 57 | |
58 | 58 | // On récupère la liste des membres |
59 | 59 | $baseUrl = 'https://graph.facebook.com/v2.10'; |
60 | - $data = json_decode($this->curlService->curl($baseUrl . '/' . $id . '/members' . $token . '&limit=10000'), true); |
|
60 | + $data = json_decode($this->curlService->curl($baseUrl.'/'.$id.'/members'.$token.'&limit=10000'), true); |
|
61 | 61 | |
62 | 62 | $bestMatch = null; |
63 | 63 | $bestPercent = -1; |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | } |
71 | 71 | |
72 | 72 | if ($bestPercent > 85) { |
73 | - $url = '/' . $bestMatch['id'] . '/picture' . $token . '&width=9999&redirect=false'; |
|
74 | - $dataImage = json_decode($this->curlService->curl($baseUrl . $url), true); |
|
73 | + $url = '/'.$bestMatch['id'].'/picture'.$token.'&width=9999&redirect=false'; |
|
74 | + $dataImage = json_decode($this->curlService->curl($baseUrl.$url), true); |
|
75 | 75 | $image = $this->imageService->upload($dataImage['data']['url'], true); |
76 | 76 | $user->setImage($image); |
77 | 77 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | private function isSimilar(User $user, array $member) |
85 | 85 | { |
86 | 86 | $percent = 0; |
87 | - similar_text($user->getFirstName() . ' ' . $user->getLastName(), $member['name'], $percent); |
|
87 | + similar_text($user->getFirstName().' '.$user->getLastName(), $member['name'], $percent); |
|
88 | 88 | return $percent; |
89 | 89 | } |
90 | 90 | } |
@@ -11,7 +11,6 @@ |
||
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 |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $username = $credentials['username']; |
71 | 71 | |
72 | 72 | $email = $credentials['mail']; |
73 | - if(!preg_match('/@eleves\.enpc\.fr$/', $email)) |
|
73 | + if (!preg_match('/@eleves\.enpc\.fr$/', $email)) |
|
74 | 74 | throw new AccessDeniedException(); |
75 | 75 | |
76 | 76 | $user = null; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | |
82 | 82 | } |
83 | 83 | |
84 | - if(!$user) { |
|
84 | + if (!$user) { |
|
85 | 85 | $user = $this->userRepository->findOneBy(['email' => $credentials['mail']]); |
86 | 86 | } |
87 | 87 |
@@ -223,7 +223,7 @@ discard block |
||
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 |
||
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. |
@@ -786,14 +786,14 @@ |
||
786 | 786 | $size = (int) substr($size, 0, -1); |
787 | 787 | } |
788 | 788 | switch ($unit) { |
789 | - case 'g': |
|
790 | - return $size * 1024 * 1024 * 1024; |
|
791 | - case 'm': |
|
792 | - return $size * 1024 * 1024; |
|
793 | - case 'k': |
|
794 | - return $size * 1024; |
|
795 | - default: |
|
796 | - return (int) $size; |
|
789 | + case 'g': |
|
790 | + return $size * 1024 * 1024 * 1024; |
|
791 | + case 'm': |
|
792 | + return $size * 1024 * 1024; |
|
793 | + case 'k': |
|
794 | + return $size * 1024; |
|
795 | + default: |
|
796 | + return (int) $size; |
|
797 | 797 | } |
798 | 798 | } |
799 | 799 |
@@ -49,11 +49,11 @@ discard block |
||
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 |
||
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 |
||
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 at least 5M in php.ini', |
744 | 744 | 'Setting "<strong>realpath_cache_size</strong>" to e.g. "<strong>5242880</strong>" or "<strong>5M</strong>" in php.ini<a href="#phpini">*</a> may improve performance on Windows significantly in some cases.' |
745 | 745 | ); |
@@ -783,17 +783,17 @@ discard block |
||
783 | 783 | $unit = ''; |
784 | 784 | if (!ctype_digit($size)) { |
785 | 785 | $unit = strtolower(substr($size, -1, 1)); |
786 | - $size = (int) substr($size, 0, -1); |
|
786 | + $size = (int)substr($size, 0, -1); |
|
787 | 787 | } |
788 | 788 | switch ($unit) { |
789 | 789 | case 'g': |
790 | - return $size * 1024 * 1024 * 1024; |
|
790 | + return $size*1024*1024*1024; |
|
791 | 791 | case 'm': |
792 | - return $size * 1024 * 1024; |
|
792 | + return $size*1024*1024; |
|
793 | 793 | case 'k': |
794 | - return $size * 1024; |
|
794 | + return $size*1024; |
|
795 | 795 | default: |
796 | - return (int) $size; |
|
796 | + return (int)$size; |
|
797 | 797 | } |
798 | 798 | } |
799 | 799 | |
@@ -815,7 +815,7 @@ discard block |
||
815 | 815 | continue; |
816 | 816 | } |
817 | 817 | |
818 | - return (int) $package['version'][1] > 2 ? self::REQUIRED_PHP_VERSION : self::LEGACY_REQUIRED_PHP_VERSION; |
|
818 | + return (int)$package['version'][1] > 2 ? self::REQUIRED_PHP_VERSION : self::LEGACY_REQUIRED_PHP_VERSION; |
|
819 | 819 | } |
820 | 820 | |
821 | 821 | return false; |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $orders = $request->request->get('orders'); |
99 | 99 | $isAuthenticated = $this->isGranted('IS_AUTHENTICATED_REMEMBERED'); |
100 | 100 | |
101 | - if(!$isAuthenticated) { |
|
101 | + if (!$isAuthenticated) { |
|
102 | 102 | $firstName = $request->request->get('firstName'); |
103 | 103 | $lastName = $request->request->get('lastName'); |
104 | 104 | $email = $request->request->get('email'); |
@@ -133,10 +133,10 @@ discard block |
||
133 | 133 | 'dateRetrieve' => $basketDate, |
134 | 134 | ]); |
135 | 135 | |
136 | - if($basketDate->isLocked()) |
|
136 | + if ($basketDate->isLocked()) |
|
137 | 137 | continue; |
138 | 138 | |
139 | - if($ordered && $basketOrder === null) { |
|
139 | + if ($ordered && $basketOrder === null) { |
|
140 | 140 | $basketOrder = new BasketOrder(); |
141 | 141 | $basketOrder->setBasket($basket); |
142 | 142 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | $this->manager->persist($basketOrder); |
153 | 153 | } |
154 | 154 | |
155 | - if(!$ordered && $basketOrder !== null){ |
|
155 | + if (!$ordered && $basketOrder !== null) { |
|
156 | 156 | $this->manager->remove($basketOrder); |
157 | 157 | } |
158 | 158 | } |
@@ -37,7 +37,7 @@ |
||
37 | 37 | protected function getOne($slug, $auth = false) |
38 | 38 | { |
39 | 39 | $this->trust(!$this->is('EXTERIEUR') || $auth); |
40 | - $item = $this->findBySlug($slug); |
|
40 | + $item = $this->findBySlug($slug); |
|
41 | 41 | return $item; |
42 | 42 | } |
43 | 43 |
@@ -89,7 +89,7 @@ |
||
89 | 89 | public function tags() |
90 | 90 | { |
91 | 91 | $tags = []; |
92 | - if(is_array($this->listTags) || is_object($this->listTags)) { |
|
92 | + if (is_array($this->listTags) || is_object($this->listTags)) { |
|
93 | 93 | foreach ($this->listTags as $tag) { |
94 | 94 | $tags[] = $tag->getName(); |
95 | 95 | } |
@@ -410,9 +410,9 @@ |
||
410 | 410 | return $this->users = $users; |
411 | 411 | } |
412 | 412 | |
413 | - /** |
|
414 | - * @JMS\Expose |
|
415 | - */ |
|
413 | + /** |
|
414 | + * @JMS\Expose |
|
415 | + */ |
|
416 | 416 | protected $downloaded = false; |
417 | 417 | |
418 | 418 | public function hasBeenDownloaded() |
@@ -123,7 +123,7 @@ |
||
123 | 123 | */ |
124 | 124 | public function downloadGameAction($slug) |
125 | 125 | { |
126 | - $item = $this->getOne($slug, !$this->is('EXTERIEUR')); |
|
126 | + $item = $this->getOne($slug, !$this->is('EXTERIEUR')); |
|
127 | 127 | return $this->download($item); |
128 | 128 | } |
129 | 129 | } |
@@ -123,7 +123,7 @@ |
||
123 | 123 | */ |
124 | 124 | public function downloadOtherAction($slug) |
125 | 125 | { |
126 | - $item = $this->getOne($slug, !$this->is('EXTERIEUR')); |
|
126 | + $item = $this->getOne($slug, !$this->is('EXTERIEUR')); |
|
127 | 127 | return $this->download($item); |
128 | 128 | } |
129 | 129 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | */ |
124 | 124 | public function getSerieEpisodesAction($slug) |
125 | 125 | { |
126 | - $episodes = $this->getAllSub($slug, 'Episode'); |
|
126 | + $episodes = $this->getAllSub($slug, 'Episode'); |
|
127 | 127 | |
128 | 128 | return $this->json($episodes); |
129 | 129 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function getSerieEpisodeAction($slug, $id) |
148 | 148 | { |
149 | - $episode = $this->getOneSub($slug, 'Episode', $id); |
|
149 | + $episode = $this->getOneSub($slug, 'Episode', $id); |
|
150 | 150 | |
151 | 151 | return $this->json($episode); |
152 | 152 | } |