Completed
Push — master ( b71e6c...5e9553 )
by
unknown
156:05 queued 101:02
created
back/src/KI/UserBundle/Command/PhotoUpdateCommand.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,13 +36,13 @@
 block discarded – undo
36 36
         $isPreview = $input->getOption('preview');
37 37
         $users = $usersRepo->findByPromo($input->getArgument('promo'));
38 38
         $question = new ConfirmationQuestion('Update? ', false, '/^y/i');
39
-	    $serializer = new Serializer([new ObjectNormalizer()], [new CsvEncoder()]);
39
+        $serializer = new Serializer([new ObjectNormalizer()], [new CsvEncoder()]);
40 40
         $csvData = $serializer->decode(file_get_contents($input->getArgument('file')), 'csv');
41 41
         $noPhotoCount = 0;
42 42
         $notFoundCount = 0;
43 43
         $updatedNoPhotoCount = 0;
44 44
         $updatedExistingPhotoCount = 0;
45
-	    $similarityThreshold = $input->getOption("similarity-threshold");
45
+        $similarityThreshold = $input->getOption("similarity-threshold");
46 46
         $output->writeln('Importing facebook photos for users (> ' . $similarityThreshold . '% similar) :');
47 47
         foreach ($users as $user) {
48 48
             $noPhoto = $user->imageUrl() === 'uploads/others/default-user.png';
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         $updatedNoPhotoCount = 0;
44 44
         $updatedExistingPhotoCount = 0;
45 45
 	    $similarityThreshold = $input->getOption("similarity-threshold");
46
-        $output->writeln('Importing facebook photos for users (> ' . $similarityThreshold . '% similar) :');
46
+        $output->writeln('Importing facebook photos for users (> '.$similarityThreshold.'% similar) :');
47 47
         foreach ($users as $user) {
48 48
             $noPhoto = $user->imageUrl() === 'uploads/others/default-user.png';
49 49
             if (!$noPhoto) {
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
                     }
62 62
                 }
63 63
                 if ($bestPercent > $similarityThreshold) {
64
-                    $userFullName = $user->getFirstName() . ' ' . $user->getLastName();
64
+                    $userFullName = $user->getFirstName().' '.$user->getLastName();
65 65
                     $pictureInfo = $noPhoto ? '[Picture MISSING]' : '[Picture exists]';
66
-                    $output->writeln($userFullName . ' <- ' . $bestMatch['name'] . ' (' . $bestPercent . '% similar) ' . $pictureInfo);
66
+                    $output->writeln($userFullName.' <- '.$bestMatch['name'].' ('.$bestPercent.'% similar) '.$pictureInfo);
67 67
                     $updateConfirmation = $input->getOption('interactive') ? $questionHelper->ask($input, $output, $question) : true;
68 68
                     if ($updateConfirmation) {
69 69
                         if (!$noPhoto) {
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
                         } else {
72 72
                             $updatedNoPhotoCount++;
73 73
                         }
74
-                        if(!$isPreview) {
75
-                            $url = '/' . $bestMatch['id'] . '/picture?width=9999&redirect=false';
76
-                            $dataImage = json_decode($curlService->curl($this->FACEBOOK_API_URL . $url), true);
74
+                        if (!$isPreview) {
75
+                            $url = '/'.$bestMatch['id'].'/picture?width=9999&redirect=false';
76
+                            $dataImage = json_decode($curlService->curl($this->FACEBOOK_API_URL.$url), true);
77 77
                             $image = $imageService->upload($dataImage['data']['url'], true);
78 78
                             $user->setImage($image);
79 79
                         }
@@ -88,21 +88,21 @@  discard block
 block discarded – undo
88 88
         $output->writeln([
89 89
             'End of list',
90 90
             '',
91
-            'Students in promo ' . $input->getArgument('promo') . ' : ' . count($users)
91
+            'Students in promo '.$input->getArgument('promo').' : '.count($users)
92 92
         ]);
93 93
         if ($input->getOption('all')) {
94 94
             $output->writeln([
95
-                'Imported missing photos: ' . $updatedNoPhotoCount,
96
-                'Not found photos: ' . $notFoundCount,
97
-                'Replaced photos: ' . $updatedExistingPhotoCount,
95
+                'Imported missing photos: '.$updatedNoPhotoCount,
96
+                'Not found photos: '.$notFoundCount,
97
+                'Replaced photos: '.$updatedExistingPhotoCount,
98 98
             ]);
99 99
         }
100 100
         else {
101 101
             $output->writeln([
102
-                'Missing photos in promo : ' . $noPhotoCount,
103
-                'Imported missing photos: ' . $updatedNoPhotoCount,
104
-                'Not found photos: ' . $notFoundCount,
105
-                'Remaining missing photos: ' . ($noPhotoCount - $updatedNoPhotoCount),
102
+                'Missing photos in promo : '.$noPhotoCount,
103
+                'Imported missing photos: '.$updatedNoPhotoCount,
104
+                'Not found photos: '.$notFoundCount,
105
+                'Remaining missing photos: '.($noPhotoCount - $updatedNoPhotoCount),
106 106
             ]);
107 107
         }
108 108
     }
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
     private function isSimilar(User $user, array $member)
112 112
     {
113 113
         $percent = 0;
114
-        similar_text($user->getFirstName() . ' ' . $user->getLastName(), $member['name'], $percent);
114
+        similar_text($user->getFirstName().' '.$user->getLastName(), $member['name'], $percent);
115 115
         return $percent;
116 116
     }
117 117
 }
Please login to merge, or discard this patch.