@@ -8,7 +8,7 @@ |
||
| 8 | 8 | |
| 9 | 9 | interface OrganizationRepository |
| 10 | 10 | { |
| 11 | - public function get(string $id):? Organization; |
|
| 11 | + public function get(string $id): ? Organization; |
|
| 12 | 12 | public function add(Organization $o); |
| 13 | 13 | public function update(Organization $o); |
| 14 | 14 | public function search(int $page, int $perPage = 10): array; |
@@ -33,11 +33,11 @@ discard block |
||
| 33 | 33 | $organizationToJoin = $this->organizationRepository->get($organizationId); |
| 34 | 34 | |
| 35 | 35 | $currentUser = $this->authGateway->current(); |
| 36 | - if(isset($currentUser) && $currentUser->email() !== $email){ |
|
| 36 | + if (isset($currentUser) && $currentUser->email() !== $email) { |
|
| 37 | 37 | $action = 'logout'; |
| 38 | 38 | $action .= !isset($user) ? '-register' : '-login'; |
| 39 | 39 | |
| 40 | - if($action == 'logout-login') { |
|
| 40 | + if ($action == 'logout-login') { |
|
| 41 | 41 | return [ |
| 42 | 42 | 'action' => $action, |
| 43 | 43 | 'organization_to_join' => $organizationToJoin, |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | |
| 59 | - if(!isset($user)){ |
|
| 59 | + if (!isset($user)) { |
|
| 60 | 60 | return [ |
| 61 | 61 | 'action' => 'register', |
| 62 | 62 | 'organization_id' => $organizationId, |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | $currentUser = $this->authGateway->current(); |
| 72 | - if(!isset($currentUser)){ |
|
| 72 | + if (!isset($currentUser)) { |
|
| 73 | 73 | return [ |
| 74 | 74 | 'action' => 'login', |
| 75 | 75 | 'organization_to_join' => $organizationToJoin, |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | $organization = null; |
| 80 | - if($user->organizationId() !== null) { |
|
| 80 | + if ($user->organizationId() !== null) { |
|
| 81 | 81 | $organization = $this->organizationRepository->get($user->organizationId()); |
| 82 | 82 | } |
| 83 | 83 | |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | public function get(string $userId):User |
| 21 | 21 | { |
| 22 | 22 | $user = $this->userRepository->getById($userId); |
| 23 | - if(!isset($user)){ |
|
| 23 | + if (!isset($user)) { |
|
| 24 | 24 | throw new UserNotFound(); |
| 25 | 25 | } |
| 26 | 26 | return $user; |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | public function edit(string $userId, string $email, string $firstname, string $lastname, array $picture) |
| 21 | 21 | { |
| 22 | 22 | $user = $this->userRepository->getById($userId); |
| 23 | - if(!isset($user)){ |
|
| 23 | + if (!isset($user)) { |
|
| 24 | 24 | throw new UserNotFound(); |
| 25 | 25 | } |
| 26 | 26 | $this->validateData($userId, $firstname, $lastname, $email, $picture); |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | if (isset($user) && $user->id() !== $userId) { |
| 54 | 54 | $errors['email'] = __('validation.unique', ['attribute' => 'email']); |
| 55 | 55 | } |
| 56 | - $validator->after(function () use ($validator, $errors) { |
|
| 56 | + $validator->after(function() use ($validator, $errors) { |
|
| 57 | 57 | foreach ($errors as $field => $error) { |
| 58 | 58 | $validator->errors()->add($field, $error); |
| 59 | 59 | } |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | public function revoke(string $userId, string $organizationId) |
| 20 | 20 | { |
| 21 | 21 | $user = $this->userRepository->getById($userId); |
| 22 | - if(!$user->belongsTo($organizationId)){ |
|
| 22 | + if (!$user->belongsTo($organizationId)) { |
|
| 23 | 23 | throw new UserGrantAdminException(); |
| 24 | 24 | } |
| 25 | 25 | |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | public function edit(string $organizationId, string $name, array $picture, array $address) |
| 22 | 22 | { |
| 23 | 23 | $organization = $this->organizationRepository->get($organizationId); |
| 24 | - if(!isset($organization)){ |
|
| 24 | + if (!isset($organization)) { |
|
| 25 | 25 | throw new OrganizationNotFound(); |
| 26 | 26 | } |
| 27 | 27 | $this->validateData($name, $picture, $address); |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | public function grant(string $userId, string $organizationId) |
| 20 | 20 | { |
| 21 | 21 | $user = $this->userRepository->getById($userId); |
| 22 | - if(!$user->belongsTo($organizationId)){ |
|
| 22 | + if (!$user->belongsTo($organizationId)) { |
|
| 23 | 23 | throw new UserGrantAdminException(); |
| 24 | 24 | } |
| 25 | 25 | |
@@ -24,12 +24,12 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | public function listUsers(string $organizationId, Request $request, ListUsers $listUsers) |
| 26 | 26 | { |
| 27 | - $page = $request->input('start')/10 + 1; |
|
| 27 | + $page = $request->input('start')/10+1; |
|
| 28 | 28 | |
| 29 | 29 | $users = $listUsers->list($organizationId, $page, 10); |
| 30 | 30 | $total = isset($users['total']) ? $users['total'] : 0; |
| 31 | 31 | $list = []; |
| 32 | - foreach ($users['list'] as $user){ |
|
| 32 | + foreach ($users['list'] as $user) { |
|
| 33 | 33 | $user = $user->toArray(); |
| 34 | 34 | $list[] = [ |
| 35 | 35 | '', |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | public function editShowForm(string $userId, GetUser $getUser, GetOrganization $getOrganization) |
| 55 | 55 | { |
| 56 | 56 | $user = $getUser->get($userId); |
| 57 | - if($user->organizationId() !== null) { |
|
| 57 | + if ($user->organizationId() !== null) { |
|
| 58 | 58 | $organization = $getOrganization->get($user->organizationId()); |
| 59 | 59 | } |
| 60 | 60 | return view('users/edit_form', [ |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | $lastname = $request->input('lastname') !== null ? $request->input('lastname') : ''; |
| 70 | 70 | $email = $request->input('email') !== null ? $request->input('email') : ''; |
| 71 | 71 | $picture = []; |
| 72 | - if($request->has('logo')){ |
|
| 72 | + if ($request->has('logo')) { |
|
| 73 | 73 | $picture['path_picture'] = $request->file('logo')->path(); |
| 74 | 74 | $picture['original_name'] = $request->file('logo')->getClientOriginalName(); |
| 75 | 75 | $picture['mine_type'] = $request->file('logo')->getMimeType(); |
@@ -96,11 +96,11 @@ discard block |
||
| 96 | 96 | public function delete(string $userId, Request $request, DeleteUser $deleteUser) |
| 97 | 97 | { |
| 98 | 98 | $redirect = 'back'; |
| 99 | - if($userId === Auth::id()){ |
|
| 99 | + if ($userId === Auth::id()) { |
|
| 100 | 100 | $redirect = 'login'; |
| 101 | 101 | } |
| 102 | 102 | $deleteUser->delete($userId); |
| 103 | - if($redirect === 'login') { |
|
| 103 | + if ($redirect === 'login') { |
|
| 104 | 104 | return redirect()->route('login'); |
| 105 | 105 | } |
| 106 | 106 | $request->session()->flash('notif_msg', 'L\'utilisateur a été supprimé'); |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | public function adminlte_image() |
| 30 | 30 | { |
| 31 | 31 | $urlPicture = $this->path_picture != "" ? asset('storage/'.str_replace('app/public/', '', $this->path_picture)) : null; |
| 32 | - if(!isset($urlPicture) || $urlPicture === ""){ |
|
| 32 | + if (!isset($urlPicture) || $urlPicture === "") { |
|
| 33 | 33 | $urlPicture = 'http://dev.core.tripleperformance.com:8008/vendor/adminlte/dist/img/AdminLTELogo.png'; |
| 34 | 34 | } |
| 35 | 35 | return $urlPicture; |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | public function adminlte_desc() |
| 39 | 39 | { |
| 40 | 40 | $desc = ucfirst($this->firstname).' '.ucfirst($this->lastname); |
| 41 | - if($this->organization_id !== null){ |
|
| 41 | + if ($this->organization_id !== null) { |
|
| 42 | 42 | $organization = app(OrganizationRepository::class)->get($this->organization_id); |
| 43 | 43 | $desc .= ' - organisme : '.$organization->name(); |
| 44 | 44 | } |