@@ -17,10 +17,10 @@ |
||
17 | 17 | |
18 | 18 | public function execute(string $type, string $search):array |
19 | 19 | { |
20 | - if($type === 'farming') { |
|
20 | + if ($type === 'farming') { |
|
21 | 21 | $type = 'culture'; |
22 | 22 | } |
23 | - if($type === 'croppingSystem') { |
|
23 | + if ($type === 'croppingSystem') { |
|
24 | 24 | $type = 'label'; |
25 | 25 | } |
26 | 26 | return $this->pageRepository->search($type, $search); |
@@ -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(); |
@@ -29,7 +29,7 @@ |
||
29 | 29 | public function execute(string $id, string $type, string $title) |
30 | 30 | { |
31 | 31 | $characteristic = $this->characteristicRepository->getBy(['title' => $title, 'type' => $type]); |
32 | - if(!isset($characteristic)){ |
|
32 | + if (!isset($characteristic)) { |
|
33 | 33 | $characteristic = new Characteristic($id, $type, $title, false); |
34 | 34 | $characteristic->create(); |
35 | 35 | } |
@@ -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 | } |
@@ -45,12 +45,12 @@ |
||
45 | 45 | return $this->visible; |
46 | 46 | } |
47 | 47 | |
48 | - public function icon():? string |
|
48 | + public function icon(): ? string |
|
49 | 49 | { |
50 | 50 | return $this->icon; |
51 | 51 | } |
52 | 52 | |
53 | - public function pageId():? int |
|
53 | + public function pageId(): ? int |
|
54 | 54 | { |
55 | 55 | return $this->pageId; |
56 | 56 | } |
@@ -19,7 +19,7 @@ |
||
19 | 19 | { |
20 | 20 | $practisesToReturn = []; |
21 | 21 | $practises = $this->interactionsRepository->getDoneByUser($userId); |
22 | - foreach ($practises as $practise){ |
|
22 | + foreach ($practises as $practise) { |
|
23 | 23 | $year = $practise->doneAt() !== null ? $practise->doneAt()->format('Y') : 'Non datée'; |
24 | 24 | $practisesToReturn[$year][] = $practise->toArray(); |
25 | 25 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | { |
25 | 25 | $httpClient = new Client(); |
26 | 26 | |
27 | - PageModel::query()->where('dry', true)->chunkById(50, function ($items, $count) use($httpClient){ |
|
27 | + PageModel::query()->where('dry', true)->chunkById(50, function($items, $count) use($httpClient){ |
|
28 | 28 | $this->info(($count*50).' Pages'); |
29 | 29 | $pages = $items->pluck('page_id')->toArray(); |
30 | 30 | $pagesApiUri = config('wiki.api_uri').$this->queryPages.implode('|', $pages); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $content = json_decode($response->getBody()->getContents(), true); |
33 | 33 | $wikiPages = $content['query']['pages']; |
34 | 34 | |
35 | - foreach($wikiPages as $page){ |
|
35 | + foreach ($wikiPages as $page) { |
|
36 | 36 | $pageModel = PageModel::query()->where('page_id', $page['pageid'])->first(); |
37 | 37 | |
38 | 38 | if (!isset($page['title'])) |
@@ -61,14 +61,14 @@ discard block |
||
61 | 61 | return $this->firstname.' '.$this->lastname; |
62 | 62 | } |
63 | 63 | |
64 | - public function organizationId():?string |
|
64 | + public function organizationId(): ?string |
|
65 | 65 | { |
66 | 66 | return $this->organizationId; |
67 | 67 | } |
68 | 68 | |
69 | 69 | public function provider(string $provider, string $providerId):bool |
70 | 70 | { |
71 | - if(isset($this->providers[$provider]) && $this->providers[$provider] == $providerId){ |
|
71 | + if (isset($this->providers[$provider]) && $this->providers[$provider] == $providerId) { |
|
72 | 72 | return true; |
73 | 73 | } |
74 | 74 | return false; |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | |
88 | 88 | public function create(string $passwordHashed = null, Picture $picture = null) |
89 | 89 | { |
90 | - if(isset($picture)) { |
|
91 | - $picture->resize('app/public/users/' . $this->id); |
|
90 | + if (isset($picture)) { |
|
91 | + $picture->resize('app/public/users/'.$this->id); |
|
92 | 92 | $this->pathPicture = $picture->relativePath(); |
93 | 93 | } |
94 | 94 | app(UserRepository::class)->add($this, $passwordHashed); |
@@ -130,20 +130,20 @@ discard block |
||
130 | 130 | $this->email = $email; |
131 | 131 | $this->firstname = $firstname; |
132 | 132 | $this->lastname = $lastname; |
133 | - if($pathPicture !== "") { |
|
133 | + if ($pathPicture !== "") { |
|
134 | 134 | $picture = new Picture($pathPicture); |
135 | - $picture->resize('app/public/users/' . $this->id . '.' . $ext); |
|
136 | - $this->pathPicture = 'app/public/users/' . $this->id . '.' . $ext; |
|
135 | + $picture->resize('app/public/users/'.$this->id.'.'.$ext); |
|
136 | + $this->pathPicture = 'app/public/users/'.$this->id.'.'.$ext; |
|
137 | 137 | } |
138 | 138 | app(UserRepository::class)->update($this); |
139 | 139 | } |
140 | 140 | |
141 | 141 | public function updateAvatar(string $pathPicture, string $ext = 'jpg') |
142 | 142 | { |
143 | - if($pathPicture !== "") { |
|
143 | + if ($pathPicture !== "") { |
|
144 | 144 | $picture = new Picture($pathPicture); |
145 | - $picture->resize('app/public/users/' . $this->id . '.' . $ext); |
|
146 | - $this->pathPicture = 'app/public/users/' . $this->id . '.' . $ext; |
|
145 | + $picture->resize('app/public/users/'.$this->id.'.'.$ext); |
|
146 | + $this->pathPicture = 'app/public/users/'.$this->id.'.'.$ext; |
|
147 | 147 | } |
148 | 148 | app(UserRepository::class)->update($this); |
149 | 149 | return $this->pathPicture; |