@@ -8,7 +8,7 @@ |
||
8 | 8 | |
9 | 9 | interface AuthGateway |
10 | 10 | { |
11 | - public function current():? User; |
|
11 | + public function current(): ? User; |
|
12 | 12 | public function log(User $u); |
13 | - public function wikiSessionId():?string; |
|
13 | + public function wikiSessionId(): ?string; |
|
14 | 14 | } |
@@ -19,7 +19,7 @@ |
||
19 | 19 | public function execute(int $pageId) |
20 | 20 | { |
21 | 21 | $page = $this->pageRepository->get($pageId); |
22 | - if($page === null){ |
|
22 | + if ($page === null) { |
|
23 | 23 | $page = new Page($pageId, true); |
24 | 24 | $this->pageRepository->save($page); |
25 | 25 | return; |
@@ -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 | } |
@@ -13,8 +13,9 @@ discard block |
||
13 | 13 | $pathPicture = storage_path('app/public/characteristics/'.$uuid.'.png'); |
14 | 14 | |
15 | 15 | // Sometimes there's no picture for the characteristic. Return an empty pixel. |
16 | - if (!file_exists($pathPicture)) |
|
17 | - $pathPicture = app_path('../public/images/empty-pixel.gif'); |
|
16 | + if (!file_exists($pathPicture)) { |
|
17 | + $pathPicture = app_path('../public/images/empty-pixel.gif'); |
|
18 | + } |
|
18 | 19 | |
19 | 20 | $img = Image::make($pathPicture); |
20 | 21 | $h = $img->height(); |
@@ -29,7 +30,7 @@ discard block |
||
29 | 30 | $image->make($pathPicture)->widen($dim, function ($constraint) { |
30 | 31 | $constraint->upsize(); |
31 | 32 | }); |
32 | - }else{ |
|
33 | + } else{ |
|
33 | 34 | $image->make($pathPicture)->heighten($dim, function ($constraint) { |
34 | 35 | $constraint->upsize(); |
35 | 36 | }); |
@@ -33,8 +33,8 @@ |
||
33 | 33 | |
34 | 34 | public function update(array $interactions, array $doneValue = []) |
35 | 35 | { |
36 | - foreach ($interactions as $interaction){ |
|
37 | - switch ($interaction){ |
|
36 | + foreach ($interactions as $interaction) { |
|
37 | + switch ($interaction) { |
|
38 | 38 | case 'follow': |
39 | 39 | $this->follow = true; |
40 | 40 | break; |
@@ -11,7 +11,7 @@ |
||
11 | 11 | public function execute(string $uuid) |
12 | 12 | { |
13 | 13 | $user = User::query()->where('uuid', $uuid)->first(); |
14 | - if(!isset($user)){ |
|
14 | + if (!isset($user)) { |
|
15 | 15 | return null; |
16 | 16 | } |
17 | 17 | $pathPicture = $user->path_picture; |
@@ -87,11 +87,11 @@ |
||
87 | 87 | $content = $response->getBody()->getContents(); |
88 | 88 | $path = 'public/characteristics/' . $uuid . '.png'; |
89 | 89 | Storage::put('public/characteristics/' . $uuid . '.png', $content); |
90 | - }catch (ClientException $e){ |
|
90 | + } catch (ClientException $e){ |
|
91 | 91 | $this->info('No icon for department : '.$number); |
92 | 92 | $path = ''; |
93 | 93 | } |
94 | - }else{ |
|
94 | + } else{ |
|
95 | 95 | $this->info('No icon for department : '.$number); |
96 | 96 | $path = ''; |
97 | 97 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | private function handleDepartments($departments) |
57 | 57 | { |
58 | - foreach($departments as $department){ |
|
58 | + foreach ($departments as $department) { |
|
59 | 59 | $key = key($department); |
60 | 60 | $department = last($department)['printouts']; |
61 | 61 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $iconUrlApi = str_replace(':file:', last($department['A une icone'])['fulltext'], $this->queryPictures); |
66 | 66 | |
67 | 67 | $characteristicModel = CharacteristicsModel::query()->where('code', $number)->first(); |
68 | - if(!isset($characteristicModel)){ |
|
68 | + if (!isset($characteristicModel)) { |
|
69 | 69 | $characteristicModel = new CharacteristicsModel(); |
70 | 70 | } |
71 | 71 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $response = $this->httpClient->get(config('wiki.api_uri').$iconUrlApi); |
86 | 86 | $content = json_decode($response->getBody()->getContents(), true); |
87 | 87 | $picturesInfo = $content['query']['pages']; |
88 | - foreach($picturesInfo as $picture) { |
|
88 | + foreach ($picturesInfo as $picture) { |
|
89 | 89 | if (isset($picture['imageinfo']) && isset(last($picture['imageinfo'])['url'])) { |
90 | 90 | $characteristicModel->page_id = $picture['pageid']; |
91 | 91 | try { |
@@ -96,13 +96,13 @@ discard block |
||
96 | 96 | |
97 | 97 | $response = $this->httpClient->get($imageURL); |
98 | 98 | $content = $response->getBody()->getContents(); |
99 | - $path = 'public/characteristics/' . $uuid . '.png'; |
|
100 | - Storage::put('public/characteristics/' . $uuid . '.png', $content); |
|
101 | - }catch (ClientException $e){ |
|
99 | + $path = 'public/characteristics/'.$uuid.'.png'; |
|
100 | + Storage::put('public/characteristics/'.$uuid.'.png', $content); |
|
101 | + } catch (ClientException $e) { |
|
102 | 102 | $this->info('No icon for department : '.$number); |
103 | 103 | $path = ''; |
104 | 104 | } |
105 | - }else{ |
|
105 | + } else { |
|
106 | 106 | $this->info('No icon for department : '.$number); |
107 | 107 | $path = ''; |
108 | 108 | } |
@@ -8,7 +8,7 @@ |
||
8 | 8 | |
9 | 9 | interface PageRepository |
10 | 10 | { |
11 | - public function get(string $pageId):?Page; |
|
11 | + public function get(string $pageId): ?Page; |
|
12 | 12 | public function getByIds(array $pagesId):array; |
13 | 13 | public function save(Page $page); |
14 | 14 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | public function get(string $pageId): ?Page |
15 | 15 | { |
16 | 16 | $pageModel = PageModel::where('page_id', $pageId)->first(); |
17 | - if(!isset($pageModel)){ |
|
17 | + if (!isset($pageModel)) { |
|
18 | 18 | return null; |
19 | 19 | } |
20 | 20 | return new Page($pageModel->page_id, $pageModel->dry); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | public function save(Page $page) |
35 | 35 | { |
36 | 36 | $pageModel = PageModel::where('page_id', $page->pageId())->first(); |
37 | - if(!isset($pageModel)){ |
|
37 | + if (!isset($pageModel)) { |
|
38 | 38 | $pageModel = new PageModel(); |
39 | 39 | } |
40 | 40 | $pageModel->page_id = $page->pageId(); |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | public function search(string $type, string $search):array |
46 | 46 | { |
47 | 47 | $pageModel = PageModel::query() |
48 | - ->where('title','LIKE', '%'.$search.'%') |
|
48 | + ->where('title', 'LIKE', '%'.$search.'%') |
|
49 | 49 | ->where('type', $type) |
50 | 50 | ->get(); |
51 | 51 | |
52 | - if(!isset($pageModel)){ |
|
52 | + if (!isset($pageModel)) { |
|
53 | 53 | return []; |
54 | 54 | } |
55 | 55 | return $pageModel->toArray(); |
@@ -31,7 +31,7 @@ |
||
31 | 31 | |
32 | 32 | public function create(string $icon = null) |
33 | 33 | { |
34 | - if(isset($icon)){ |
|
34 | + if (isset($icon)) { |
|
35 | 35 | copy(storage_path('app/'.$icon), storage_path('app/public/characteristics/'.$this->id.'.png')); |
36 | 36 | $this->icon = 'public/characteristics/'.$this->id.'.png'; |
37 | 37 | } |