@@ -16,7 +16,7 @@ |
||
16 | 16 | */ |
17 | 17 | public function handle($request, Closure $next) |
18 | 18 | { |
19 | - if(session()->has('wiki_callback')){ |
|
19 | + if (session()->has('wiki_callback')) { |
|
20 | 20 | session()->keep(['wiki_callback', 'wiki_token']); |
21 | 21 | } |
22 | 22 | return $next($request); |
@@ -27,12 +27,12 @@ |
||
27 | 27 | $w = $img->width(); |
28 | 28 | |
29 | 29 | $img = Image::cache(function($image) use($pathPicture, $dim, $w, $h){ |
30 | - if($w <= $h) { |
|
31 | - $image->make($pathPicture)->widen($dim, function ($constraint) { |
|
30 | + if ($w <= $h) { |
|
31 | + $image->make($pathPicture)->widen($dim, function($constraint) { |
|
32 | 32 | $constraint->upsize(); |
33 | 33 | }); |
34 | - }else{ |
|
35 | - $image->make($pathPicture)->heighten($dim, function ($constraint) { |
|
34 | + } else { |
|
35 | + $image->make($pathPicture)->heighten($dim, function($constraint) { |
|
36 | 36 | $constraint->upsize(); |
37 | 37 | }); |
38 | 38 | } |
@@ -12,15 +12,15 @@ |
||
12 | 12 | { |
13 | 13 | public function user(string $provider): SocialiteUser |
14 | 14 | { |
15 | - if($provider === 'twitter'){ |
|
15 | + if ($provider === 'twitter') { |
|
16 | 16 | $user = Socialite::driver($provider)->user(); |
17 | - }else { |
|
17 | + } else { |
|
18 | 18 | $user = Socialite::driver($provider)->stateless()->user(); |
19 | 19 | } |
20 | 20 | |
21 | 21 | $email = $user->getEmail(); |
22 | 22 | $firstname = $user->getNickname() !== null ? $user->getNickname() : $user->getName(); |
23 | - if(isset($user->user['given_name'])){ |
|
23 | + if (isset($user->user['given_name'])) { |
|
24 | 24 | $firstname = $user->user['given_name']; |
25 | 25 | } |
26 | 26 | $lastname = isset($user->user['family_name']) ? $user->user['family_name'] : $user->getName(); |
@@ -14,11 +14,11 @@ discard block |
||
14 | 14 | |
15 | 15 | class ContextRepositorySql implements ContextRepository |
16 | 16 | { |
17 | - public function getByUser(string $userId):?Context |
|
17 | + public function getByUser(string $userId): ?Context |
|
18 | 18 | { |
19 | 19 | $user = User::where('uuid', $userId)->first(); |
20 | 20 | $context = DB::table('contexts')->where('id', $user->context_id)->first(); |
21 | - if($context == null){ |
|
21 | + if ($context == null) { |
|
22 | 22 | return null; |
23 | 23 | } |
24 | 24 | return new Context($context->uuid, $context->postal_code, $user->characteristics()->pluck('uuid')->toArray()); |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | $user = User::where('uuid', $userId)->first(); |
31 | 31 | |
32 | 32 | $farmings = $contextData->get('farmings'); |
33 | - foreach($farmings as $farming){ |
|
34 | - $characteristic = CharacteristicsModel::where('uuid', (string)$farming)->first(); |
|
33 | + foreach ($farmings as $farming) { |
|
34 | + $characteristic = CharacteristicsModel::where('uuid', (string) $farming)->first(); |
|
35 | 35 | $user->characteristics()->save($characteristic); |
36 | 36 | } |
37 | 37 | |
@@ -44,14 +44,14 @@ discard block |
||
44 | 44 | public function getByUserDto(string $userId): ?ContextDto |
45 | 45 | { |
46 | 46 | $user = User::where('uuid', $userId)->first(); |
47 | - if($user == null){ |
|
47 | + if ($user == null) { |
|
48 | 48 | return null; |
49 | 49 | } |
50 | 50 | $context = ContextModel::find($user->context_id); |
51 | - if($context == null){ |
|
51 | + if ($context == null) { |
|
52 | 52 | return null; |
53 | 53 | } |
54 | - $characteristics = $user->characteristics()->get()->transform(function(CharacteristicsModel $item){ |
|
54 | + $characteristics = $user->characteristics()->get()->transform(function(CharacteristicsModel $item) { |
|
55 | 55 | return $item->toDto(); |
56 | 56 | }); |
57 | 57 | return new ContextDto($user->firstname, $user->lastname, $context->postal_code, $characteristics->toArray()); |
@@ -33,7 +33,7 @@ |
||
33 | 33 | public function toDto() |
34 | 34 | { |
35 | 35 | $icon = null; |
36 | - if(isset($this->icon)){ |
|
36 | + if (isset($this->icon)) { |
|
37 | 37 | $icon = route('api.icon.serve', ['id' => $this->uuid]); |
38 | 38 | } |
39 | 39 | return new CharacteristicDto( |
@@ -25,7 +25,7 @@ |
||
25 | 25 | */ |
26 | 26 | public function add(array $cs) |
27 | 27 | { |
28 | - foreach ($cs as $c){ |
|
28 | + foreach ($cs as $c) { |
|
29 | 29 | $cModel = new CharacteristicsModel(); |
30 | 30 | $cModel->fill($c); |
31 | 31 | $cModel->save(); |
@@ -16,7 +16,7 @@ |
||
16 | 16 | $this->contextRepository = $contextRepository; |
17 | 17 | } |
18 | 18 | |
19 | - public function execute(string $userId):?ContextDto |
|
19 | + public function execute(string $userId): ?ContextDto |
|
20 | 20 | { |
21 | 21 | return $this->contextRepository->getByUserDto($userId); |
22 | 22 | } |
@@ -18,17 +18,17 @@ |
||
18 | 18 | $h = $img->height(); |
19 | 19 | $w = $img->width(); |
20 | 20 | |
21 | - if($dim == null){ |
|
21 | + if ($dim == null) { |
|
22 | 22 | return $img->response(); |
23 | 23 | } |
24 | 24 | |
25 | 25 | $img = Image::cache(function($image) use($pathPicture, $dim, $w, $h){ |
26 | - if($w <= $h) { |
|
27 | - $image->make($pathPicture)->widen($dim, function ($constraint) { |
|
26 | + if ($w <= $h) { |
|
27 | + $image->make($pathPicture)->widen($dim, function($constraint) { |
|
28 | 28 | $constraint->upsize(); |
29 | 29 | }); |
30 | - }else{ |
|
31 | - $image->make($pathPicture)->heighten($dim, function ($constraint) { |
|
30 | + } else { |
|
31 | + $image->make($pathPicture)->heighten($dim, function($constraint) { |
|
32 | 32 | $constraint->upsize(); |
33 | 33 | }); |
34 | 34 | } |
@@ -22,7 +22,7 @@ |
||
22 | 22 | $this->postalCode = $postalCode; |
23 | 23 | $this->department = (new PostalCode($postalCode))->department(); |
24 | 24 | $this->characteristics = $characteristics; |
25 | - foreach($this->characteristics as $characteristic){ |
|
25 | + foreach ($this->characteristics as $characteristic) { |
|
26 | 26 | $this->characteristicsByType[$characteristic->type()][] = $characteristic; |
27 | 27 | } |
28 | 28 | } |