Test Setup Failed
Branch user/international-postal-code... (b53ac3)
by Bertrand
08:58
created
app/Src/UseCases/Infra/Sql/ContextRepositorySql.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 
14 14
 class ContextRepositorySql implements ContextRepository
15 15
 {
16
-    public function getByUser(string $userId):?Context
16
+    public function getByUser(string $userId): ?Context
17 17
     {
18 18
         $user = User::where('uuid', $userId)->first();
19 19
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     public function getByUserDto(string $userId): ?ContextDto
38 38
     {
39 39
         $user = User::where('uuid', $userId)->first();
40
-        if($user === null){
40
+        if ($user === null) {
41 41
             return null;
42 42
         }
43 43
         return $user->context !== null ? $user->context->toDto($user->uuid) : null;
@@ -46,12 +46,12 @@  discard block
 block discarded – undo
46 46
     public function update(Context $context, string $userId)
47 47
     {
48 48
         $user = User::where('uuid', $userId)->first();
49
-        if($user === null){
49
+        if ($user === null) {
50 50
             return null;
51 51
         }
52 52
 
53 53
         $contextModel = $user->context;
54
-        if($contextModel === null){
54
+        if ($contextModel === null) {
55 55
             return null;
56 56
         }
57 57
         $contextData = collect($context->toArray());
Please login to merge, or discard this patch.
app/Src/UseCases/Infra/Sql/Model/ContextModel.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 
33 33
     public function toDto():ContextDto
34 34
     {
35
-        $characteristics = $this->user->characteristics()->get()->transform(function(CharacteristicsModel $item){
35
+        $characteristics = $this->user->characteristics()->get()->transform(function(CharacteristicsModel $item) {
36 36
             return $item->toDto();
37 37
         });
38 38
         $characteristicDepartment = CharacteristicsModel::query()
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
         ;
42 42
 
43 43
         if (isset($characteristicDepartment['opt']['number'])) {
44
-            $characteristicDepartment->icon = 'Departement-' . $characteristicDepartment['opt']['number'];
44
+            $characteristicDepartment->icon = 'Departement-'.$characteristicDepartment['opt']['number'];
45 45
         }
46 46
 
47
-        if(isset($characteristicDepartment)){
47
+        if (isset($characteristicDepartment)) {
48 48
             $characteristics->push($characteristicDepartment->toDto());
49 49
         }
50 50
 
Please login to merge, or discard this patch.
app/Src/UseCases/Infra/Sql/Model/CharacteristicsModel.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@
 block discarded – undo
58 58
 
59 59
     public function picturePath():string
60 60
     {
61
-        return storage_path('app/public/characteristics/' . $this->uuid . '.png');
61
+        return storage_path('app/public/characteristics/'.$this->uuid.'.png');
62 62
     }
63 63
 
64 64
     public function toDomain()
Please login to merge, or discard this patch.
app/Src/UseCases/Infra/Sql/ReportingCharacteristicSql.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -15,12 +15,12 @@  discard block
 block discarded – undo
15 15
             ->selectRaw('count(*) AS count, contexts.department_number as department_number')
16 16
             ->join('users', 'users.id', 'interactions.user_id')
17 17
             ->join('contexts', 'users.context_id', 'contexts.id')
18
-            ->where(function ($query) use ($type){
19
-                $query->when($type === 'follow', function ($query) {
18
+            ->where(function($query) use ($type){
19
+                $query->when($type === 'follow', function($query) {
20 20
                     $query->where('follow', true);
21 21
                     $query->orWhere('done', true);
22 22
                 })
23
-                ->when($type === 'do', function ($query) {
23
+                ->when($type === 'do', function($query) {
24 24
                     $query->where('done', true);
25 25
                 });
26 26
             })
@@ -31,13 +31,13 @@  discard block
 block discarded – undo
31 31
             ->get();
32 32
 
33 33
         $interactionsToReturn = [];
34
-        foreach($interactions as $interaction){
34
+        foreach ($interactions as $interaction) {
35 35
             $characteristicsModel = CharacteristicsModel::query()->where('code', $interaction->department_number)->first();
36
-            if(!isset($characteristicsModel)){
36
+            if (!isset($characteristicsModel)) {
37 37
                 continue;
38 38
             }
39 39
             if (isset($characteristicsModel->opt['number'])) {
40
-                $characteristicsModel->icon = 'Departement-' . $characteristicsModel->opt['number'];
40
+                $characteristicsModel->icon = 'Departement-'.$characteristicsModel->opt['number'];
41 41
             }
42 42
             $interaction->departmentData = $characteristicsModel;
43 43
             $interactionsToReturn[] = $interaction->toArray();
@@ -56,12 +56,12 @@  discard block
 block discarded – undo
56 56
             ->join('contexts', 'users.context_id', 'contexts.id')
57 57
             ->join('user_characteristics', 'user_characteristics.user_id', 'users.id')
58 58
             ->join('characteristics', 'characteristics.id', 'user_characteristics.characteristic_id')
59
-            ->where(function ($query) use ($type){
60
-                $query->when($type === 'follow', function ($query) {
59
+            ->where(function($query) use ($type){
60
+                $query->when($type === 'follow', function($query) {
61 61
                     $query->where('follow', true);
62 62
                     $query->orWhere('done', true);
63 63
                 })
64
-                ->when($type === 'do', function ($query) {
64
+                ->when($type === 'do', function($query) {
65 65
                     $query->where('done', true);
66 66
                 });
67 67
             })
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
             ->get();
76 76
 
77 77
         $characteristicsToReturn = [];
78
-        foreach($characteristicsCount as $characteristicCount){
78
+        foreach ($characteristicsCount as $characteristicCount) {
79 79
             $characteristic = CharacteristicsModel::query()->find($characteristicCount->characteristic_id);
80 80
             $characteristic->count = $characteristicCount->count;
81 81
             $c = $characteristic->toArray();
Please login to merge, or discard this patch.
app/Src/UseCases/Infra/Sql/InteractionPageRepositorySql.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -156,7 +156,7 @@
 block discarded – undo
156 156
      * @param string|null $characteristicIdCroppingSystem
157 157
      * @return Paginator
158 158
      *
159
-    */
159
+     */
160 160
     public function getFollowersPage(int $pageId, string $type = 'follow', ?string $departmentNumber = null, ?string $characteristicId = null, ?string $characteristicIdCroppingSystem = null, ?string $wikiCode = null): Paginator
161 161
     {
162 162
         return  InteractionModel::query()
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
     public function getByInteractUser(CanInteract $canInteract, int $pageId, string $wikiCode): ?Interaction
41 41
     {
42
-        if($canInteract->key() == 'user_id') {
42
+        if ($canInteract->key() == 'user_id') {
43 43
             $user = User::query()->where('uuid', $canInteract->identifier())->first();
44 44
         }
45 45
 
@@ -49,16 +49,16 @@  discard block
 block discarded – undo
49 49
             ->where('interactions.wiki', $wikiCode)
50 50
             ->first();
51 51
 
52
-        if(!isset($interactionModel)){
52
+        if (!isset($interactionModel)) {
53 53
             return null;
54 54
         }
55 55
 
56 56
         $value = $interactionModel->value ?? [];
57 57
         return new Interaction(
58 58
             $pageId,
59
-            (bool)$interactionModel->follow,
60
-            (bool)$interactionModel->applause,
61
-            (bool)$interactionModel->done,
59
+            (bool) $interactionModel->follow,
60
+            (bool) $interactionModel->applause,
61
+            (bool) $interactionModel->done,
62 62
             $value,
63 63
             $interactionModel->wiki,
64 64
         );
@@ -111,9 +111,9 @@  discard block
 block discarded – undo
111 111
             ->orderBy('updated_at', 'desc')
112 112
             ->get();
113 113
 
114
-        foreach($interactionsModel as $interaction) {
114
+        foreach ($interactionsModel as $interaction) {
115 115
             $page = PageModel::query()->where('page_id', $interaction->page_id)->first();
116
-            if(!isset($page) || empty($page->title) || empty($page->wiki)){
116
+            if (!isset($page) || empty($page->title) || empty($page->wiki)) {
117 117
                 continue;
118 118
             }
119 119
             $applause = InteractionModel::query()->where('page_id', $interaction->page_id)->where('applause', true)->count();
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
             ->where('user_id', $user->id)
137 137
             ->where('done', true)
138 138
             ->get();
139
-        foreach ($records as $record){
139
+        foreach ($records as $record) {
140 140
             $practises[] = new PractiseVo(
141 141
                 $record->page_id,
142 142
                 $record->page->title ?? '',
@@ -161,18 +161,18 @@  discard block
 block discarded – undo
161 161
     {
162 162
         return  InteractionModel::query()
163 163
             ->with('user.context')
164
-            ->where(function ($query) use ($type){
165
-                $query->when($type === 'follow', function ($query) {
164
+            ->where(function($query) use ($type){
165
+                $query->when($type === 'follow', function($query) {
166 166
                     $query->where('follow', true);
167 167
                     $query->orWhere('done', true);
168 168
                 })
169
-                ->when($type === 'do', function ($query) {
169
+                ->when($type === 'do', function($query) {
170 170
                     $query->where('done', true);
171 171
                 });
172 172
             })
173
-            ->when($characteristicId !== null, function ($query) use($characteristicId) {
173
+            ->when($characteristicId !== null, function($query) use($characteristicId) {
174 174
                 $characteristic = CharacteristicsModel::query()->where('uuid', $characteristicId)->first();
175
-                if(!isset($characteristic)){
175
+                if (!isset($characteristic)) {
176 176
                     return;
177 177
                 }
178 178
                 $query->whereRaw(
@@ -180,9 +180,9 @@  discard block
 block discarded – undo
180 180
                     $characteristic->id
181 181
                 );
182 182
             })
183
-            ->when($characteristicIdCroppingSystem !== null, function ($query) use($characteristicIdCroppingSystem) {
183
+            ->when($characteristicIdCroppingSystem !== null, function($query) use($characteristicIdCroppingSystem) {
184 184
                 $characteristic = CharacteristicsModel::query()->where('uuid', $characteristicIdCroppingSystem)->first();
185
-                if(!isset($characteristic)){
185
+                if (!isset($characteristic)) {
186 186
                     return;
187 187
                 }
188 188
                 $query->whereRaw(
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
                     $characteristic->id
191 191
                 );
192 192
             })
193
-            ->when($departmentNumber !== null, function ($query) use($departmentNumber) {
193
+            ->when($departmentNumber !== null, function($query) use($departmentNumber) {
194 194
                 $query
195 195
                     ->join('users', 'users.id', 'interactions.user_id')
196 196
                     ->join('contexts', 'users.context_id', 'contexts.id')
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
             ->whereNotNull('interactions.user_id')
202 202
             ->orderBy('interactions.updated_at', 'desc')
203 203
             ->paginate()
204
-            ->through(function ($item){
204
+            ->through(function($item) {
205 205
                 $context = null;
206 206
                 if ($item->user->context !== null) {
207 207
                     $context = $item->user->context->toDto();
Please login to merge, or discard this patch.
app/Src/UseCases/Infra/GeoOpenDataSoftService.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     {
51 51
         $dataset = 'geonames-postal-code@public';
52 52
 
53
-        $uri = sprintf($this->baseUri . '/records', urlencode($dataset));
53
+        $uri = sprintf($this->baseUri.'/records', urlencode($dataset));
54 54
 
55 55
         $params = [
56 56
             'where' => sprintf('country_code="%s" AND postal_code="%s"', $country, $postalCode),
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 
61 61
         $result = (new Client())->request(
62 62
             'GET',
63
-            $uri . '?' . http_build_query($params),
63
+            $uri.'?'.http_build_query($params),
64 64
             [
65 65
                 'headers' => [
66 66
                     'Accept' => 'application/json',
Please login to merge, or discard this patch.
app/Src/UseCases/Infra/Gateway/SessionAuthGateway.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
         Auth::login($authenticate, true);
42 42
     }
43 43
 
44
-    public function wikiSessionId():? string
44
+    public function wikiSessionId(): ? string
45 45
     {
46 46
         return Session::get('wiki_session_id');
47 47
     }
Please login to merge, or discard this patch.
app/Src/UseCases/Domain/Auth/LogUserFromSocialNetwork.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
 
42 42
         $user = $this->userRepository->getByProvider($provider, $socialiteUser->providerId());
43 43
 
44
-        if($user === null){
44
+        if ($user === null) {
45 45
             app(RegisterUserFromSocialNetworkService::class)->register($provider, $socialiteUser);
46 46
             $user = $this->userRepository->getByProvider($provider, $socialiteUser->providerId());
47 47
         } else {
Please login to merge, or discard this patch.
app/Src/UseCases/Domain/Users/GetAvatar.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -30,12 +30,12 @@  discard block
 block discarded – undo
30 30
         if (!empty($user))
31 31
             $pathPicture = $this->getPathPicture($user, $noDefault);
32 32
 
33
-        if($pathPicture === null){
33
+        if ($pathPicture === null) {
34 34
             if (empty($firstLetter) && !empty($user))
35 35
                 $firstLetter = $user->fullname;
36 36
 
37 37
             if (!empty($color))
38
-                return Avatar::create($firstLetter)->setBackground('#' . $color)->getImageObject()->response();
38
+                return Avatar::create($firstLetter)->setBackground('#'.$color)->getImageObject()->response();
39 39
             else
40 40
                 return Avatar::create($firstLetter)->getImageObject()->response();
41 41
         }
@@ -45,12 +45,12 @@  discard block
 block discarded – undo
45 45
         $w = $img->width();
46 46
 
47 47
         $img = Image::cache(function($image) use($pathPicture, $dim, $w, $h){
48
-            if($w <= $h) {
49
-                $image->make($pathPicture)->widen($dim, function ($constraint) {
48
+            if ($w <= $h) {
49
+                $image->make($pathPicture)->widen($dim, function($constraint) {
50 50
                     $constraint->upsize();
51 51
                 });
52
-            }else{
53
-                $image->make($pathPicture)->heighten($dim, function ($constraint) {
52
+            } else {
53
+                $image->make($pathPicture)->heighten($dim, function($constraint) {
54 54
                     $constraint->upsize();
55 55
                 });
56 56
             }
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         if (isset($user) && $user->toArray()['path_picture'] !== null && $user->toArray()['path_picture'] !== "") {
67 67
             return storage_path($user->toArray()['path_picture']);
68 68
         }
69
-        if($noDefault === true){
69
+        if ($noDefault === true) {
70 70
             return null;
71 71
         }
72 72
         return public_path(config('neayi.default_avatar'));
Please login to merge, or discard this patch.
Braces   +17 added lines, -13 removed lines patch added patch discarded remove patch
@@ -22,22 +22,26 @@  discard block
 block discarded – undo
22 22
     {
23 23
         $user = $this->userRepository->getById($uuid);
24 24
 
25
-        if ($noDefault === true)
26
-            $pathPicture = null;
27
-        else
28
-            $pathPicture = public_path(config('neayi.default_avatar'));
25
+        if ($noDefault === true) {
26
+                    $pathPicture = null;
27
+        } else {
28
+                    $pathPicture = public_path(config('neayi.default_avatar'));
29
+        }
29 30
 
30
-        if (!empty($user))
31
-            $pathPicture = $this->getPathPicture($user, $noDefault);
31
+        if (!empty($user)) {
32
+                    $pathPicture = $this->getPathPicture($user, $noDefault);
33
+        }
32 34
 
33 35
         if($pathPicture === null){
34
-            if (empty($firstLetter) && !empty($user))
35
-                $firstLetter = $user->fullname;
36
+            if (empty($firstLetter) && !empty($user)) {
37
+                            $firstLetter = $user->fullname;
38
+            }
36 39
 
37
-            if (!empty($color))
38
-                return Avatar::create($firstLetter)->setBackground('#' . $color)->getImageObject()->response();
39
-            else
40
-                return Avatar::create($firstLetter)->getImageObject()->response();
40
+            if (!empty($color)) {
41
+                            return Avatar::create($firstLetter)->setBackground('#' . $color)->getImageObject()->response();
42
+            } else {
43
+                            return Avatar::create($firstLetter)->getImageObject()->response();
44
+            }
41 45
         }
42 46
 
43 47
         $img = Image::make($pathPicture);
@@ -49,7 +53,7 @@  discard block
 block discarded – undo
49 53
                 $image->make($pathPicture)->widen($dim, function ($constraint) {
50 54
                     $constraint->upsize();
51 55
                 });
52
-            }else{
56
+            } else{
53 57
                 $image->make($pathPicture)->heighten($dim, function ($constraint) {
54 58
                     $constraint->upsize();
55 59
                 });
Please login to merge, or discard this patch.