@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $updatedNoPhotoCount = 0; |
48 | 48 | $updatedExistingPhotoCount = 0; |
49 | 49 | $similarityThreshold = $input->getOption("similarity-threshold"); |
50 | - $output->writeln('Importing facebook photos for users (> ' . $similarityThreshold . ' similarity score) :'); |
|
50 | + $output->writeln('Importing facebook photos for users (> '.$similarityThreshold.' similarity score) :'); |
|
51 | 51 | foreach ($users as $user) { |
52 | 52 | $noPhoto = $user->imageUrl() === 'uploads/others/default-user.png'; |
53 | 53 | if (!$noPhoto) { |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | } |
66 | 66 | } |
67 | 67 | if ($bestPercent > $similarityThreshold) { |
68 | - $userFullName = $user->getFirstName() . ' ' . $user->getLastName(); |
|
68 | + $userFullName = $user->getFirstName().' '.$user->getLastName(); |
|
69 | 69 | $pictureInfo = $noPhoto ? '[Picture MISSING]' : '[Picture exists]'; |
70 | - $output->writeln($userFullName . ' <- ' . $bestMatch['name'] . ' (' . $bestPercent . '% similar) ' . $pictureInfo); |
|
70 | + $output->writeln($userFullName.' <- '.$bestMatch['name'].' ('.$bestPercent.'% similar) '.$pictureInfo); |
|
71 | 71 | $updateConfirmation = $input->getOption('interactive') ? $questionHelper->ask($input, $output, $question) : true; |
72 | 72 | if ($updateConfirmation) { |
73 | 73 | if (!$noPhoto) { |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | $updatedNoPhotoCount++; |
77 | 77 | } |
78 | 78 | if (!$isPreview) { |
79 | - $url = '/' . $bestMatch['id'] . '/picture?width=9999&redirect=false'; |
|
80 | - $dataImage = json_decode($curlService->curl($this->FACEBOOK_API_URL . $url), true); |
|
79 | + $url = '/'.$bestMatch['id'].'/picture?width=9999&redirect=false'; |
|
80 | + $dataImage = json_decode($curlService->curl($this->FACEBOOK_API_URL.$url), true); |
|
81 | 81 | $image = $imageService->upload($dataImage['data']['url'], true); |
82 | 82 | $user->setImage($image); |
83 | 83 | } |
@@ -91,20 +91,20 @@ discard block |
||
91 | 91 | $output->writeln([ |
92 | 92 | 'End of list', |
93 | 93 | '', |
94 | - 'Students in promo ' . $input->getArgument('promo') . ' : ' . count($users) |
|
94 | + 'Students in promo '.$input->getArgument('promo').' : '.count($users) |
|
95 | 95 | ]); |
96 | 96 | if ($input->getOption('all')) { |
97 | 97 | $output->writeln([ |
98 | - 'Imported missing photos: ' . $updatedNoPhotoCount, |
|
99 | - 'Not found photos: ' . $notFoundCount, |
|
100 | - 'Replaced photos: ' . $updatedExistingPhotoCount, |
|
98 | + 'Imported missing photos: '.$updatedNoPhotoCount, |
|
99 | + 'Not found photos: '.$notFoundCount, |
|
100 | + 'Replaced photos: '.$updatedExistingPhotoCount, |
|
101 | 101 | ]); |
102 | 102 | } else { |
103 | 103 | $output->writeln([ |
104 | - 'Missing photos in promo : ' . $noPhotoCount, |
|
105 | - 'Imported missing photos: ' . $updatedNoPhotoCount, |
|
106 | - 'Not found photos: ' . $notFoundCount, |
|
107 | - 'Remaining missing photos: ' . ($noPhotoCount - $updatedNoPhotoCount), |
|
104 | + 'Missing photos in promo : '.$noPhotoCount, |
|
105 | + 'Imported missing photos: '.$updatedNoPhotoCount, |
|
106 | + 'Not found photos: '.$notFoundCount, |
|
107 | + 'Remaining missing photos: '.($noPhotoCount - $updatedNoPhotoCount), |
|
108 | 108 | ]); |
109 | 109 | } |
110 | 110 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $score += $this->compareStr($firstName, $firstNameFb); |
123 | 123 | // Le match sur le nom de famille est un facteur bien plus important |
124 | 124 | // que celui pour le nom |
125 | - $score += 3 * $this->compareStr($lastName, $lastNameFb); //Parameter may be adapted |
|
125 | + $score += 3*$this->compareStr($lastName, $lastNameFb); //Parameter may be adapted |
|
126 | 126 | return $score; |
127 | 127 | } |
128 | 128 | |
@@ -153,11 +153,11 @@ discard block |
||
153 | 153 | $score += 10; |
154 | 154 | } |
155 | 155 | if ($lastIndex > -1) { |
156 | - $score += 5 * exp(-($currentIndex - $lastIndex) / 2); |
|
156 | + $score += 5*exp(-($currentIndex - $lastIndex)/2); |
|
157 | 157 | } |
158 | 158 | $lastIndex = $currentIndex; |
159 | 159 | $matchingRow += 1; |
160 | - $score += exp($matchingRow / 2); |
|
160 | + $score += exp($matchingRow/2); |
|
161 | 161 | $currentIndex += 1; |
162 | 162 | } |
163 | 163 | } |