| @@ -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 = url('').'/'.config('adminlte.logo_img'); | 
| 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 | } | 
| @@ -17,7 +17,7 @@ discard block | ||
| 17 | 17 | public function getByEmail(string $email): ?User | 
| 18 | 18 |      { | 
| 19 | 19 |          $record = \App\User::where('email', $email)->first(); | 
| 20 | -        if(!isset($record)){ | |
| 20 | +        if (!isset($record)) { | |
| 21 | 21 | return null; | 
| 22 | 22 | } | 
| 23 | 23 |          $roles = $record->roles()->pluck('name')->toArray(); | 
| @@ -27,7 +27,7 @@ discard block | ||
| 27 | 27 | public function getById(string $id): ?User | 
| 28 | 28 |      { | 
| 29 | 29 |          $record = \App\User::where('uuid', $id)->first(); | 
| 30 | -        if(!isset($record)){ | |
| 30 | +        if (!isset($record)) { | |
| 31 | 31 | return null; | 
| 32 | 32 | } | 
| 33 | 33 |          $roles = $record->roles()->pluck('name')->toArray(); | 
| @@ -83,13 +83,13 @@ discard block | ||
| 83 | 83 | ->offset(($page-1)*$perPage) | 
| 84 | 84 | ->limit($perPage) | 
| 85 | 85 | ->get(); | 
| 86 | -        if(empty($records)){ | |
| 86 | +        if (empty($records)) { | |
| 87 | 87 | return []; | 
| 88 | 88 | } | 
| 89 | 89 | |
| 90 | 90 | $users = []; | 
| 91 | -        foreach($records as $record){ | |
| 92 | -            if($record->uuid === null){ | |
| 91 | +        foreach ($records as $record) { | |
| 92 | +            if ($record->uuid === null) { | |
| 93 | 93 | $identity = new Identity(Uuid::uuid4(), $record->iemail, $record->ifirstname, $record->ilastname, null); | 
| 94 | 94 | $state = new State($organizationId, null, false, []); | 
| 95 | 95 | $users[] = new UserDto($identity, $state); | 
| @@ -115,11 +115,11 @@ discard block | ||
| 115 | 115 | public function getAdminOfOrganization(string $organizationId): array | 
| 116 | 116 |      { | 
| 117 | 117 |          $records = \App\User::role(['admin'])->where('organization_id', $organizationId)->get(); | 
| 118 | -        if(empty($records)){ | |
| 118 | +        if (empty($records)) { | |
| 119 | 119 | return []; | 
| 120 | 120 | } | 
| 121 | 121 | $users = []; | 
| 122 | -        foreach($records as $record){ | |
| 122 | +        foreach ($records as $record) { | |
| 123 | 123 |              $roles = \App\User::find($record->id)->roles()->pluck('name')->toArray(); | 
| 124 | 124 | $users[] = new User($record->uuid, $record->email, $record->firstname, $record->lastname, $record->organization_id, $record->path_picture, $roles); | 
| 125 | 125 | } | 
| @@ -129,7 +129,7 @@ discard block | ||
| 129 | 129 | public function getByProvider(string $provider, string $providerId): ?User | 
| 130 | 130 |      { | 
| 131 | 131 |          $record = \App\User::where('providers->'.$provider, $providerId)->first(); | 
| 132 | -        if(!isset($record)){ | |
| 132 | +        if (!isset($record)) { | |
| 133 | 133 | return null; | 
| 134 | 134 | } | 
| 135 | 135 |          $roles = $record->roles()->pluck('name')->toArray(); | 
| @@ -139,7 +139,7 @@ discard block | ||
| 139 | 139 | public function getStats(string $userId): Stats | 
| 140 | 140 |      { | 
| 141 | 141 |          $record = \App\User::where('uuid', $userId)->first(); | 
| 142 | -        if(isset($record) && $record->wiki_stats !== null){ | |
| 142 | +        if (isset($record) && $record->wiki_stats !== null) { | |
| 143 | 143 | return new Stats($record->wiki_stats); | 
| 144 | 144 | } | 
| 145 | 145 | return new Stats([]); | 
| @@ -20,7 +20,7 @@ | ||
| 20 | 20 | |
| 21 | 21 | public function __construct(array $data) | 
| 22 | 22 |      { | 
| 23 | -        foreach ($this->fields as $field){ | |
| 23 | +        foreach ($this->fields as $field) { | |
| 24 | 24 | $this->stats[$field] = $this->dataOrZero($field, $data); | 
| 25 | 25 | } | 
| 26 | 26 | } | 
| @@ -28,11 +28,11 @@ discard block | ||
| 28 | 28 | |
| 29 | 29 |          $this->dbWiki->table('user') | 
| 30 | 30 |              ->orderBy('user.user_id', 'desc') | 
| 31 | -            ->chunk(200, function ($records){ | |
| 31 | +            ->chunk(200, function($records) { | |
| 32 | 32 |                  foreach ($records as $record) { | 
| 33 | 33 | |
| 34 | 34 | $user = $this->userRepository->getByEmail($record->user_email); | 
| 35 | -                    if(!isset($user)){ | |
| 35 | +                    if (!isset($user)) { | |
| 36 | 36 | continue; | 
| 37 | 37 | } | 
| 38 | 38 | |
| @@ -42,7 +42,7 @@ discard block | ||
| 42 | 42 | $editsOnWiki = $this->getEditsOnWikiNumber($record->user_id); | 
| 43 | 43 | |
| 44 | 44 | |
| 45 | - $numberContributions = $questions + $answers + $votes + $editsOnWiki; | |
| 45 | + $numberContributions = $questions+$answers+$votes+$editsOnWiki; | |
| 46 | 46 | $fields = [ | 
| 47 | 47 | 'number_contributions' => $numberContributions, | 
| 48 | 48 | 'number_questions' => $questions, | 
| @@ -18,7 +18,7 @@ | ||
| 18 | 18 | */ | 
| 19 | 19 | public function handle($request, Closure $next, $guard = null) | 
| 20 | 20 |      { | 
| 21 | -        if($request->has('wiki_callback') && Auth::user() !== null){ | |
| 21 | +        if ($request->has('wiki_callback') && Auth::user() !== null) { | |
| 22 | 22 | return $this->redirectToWiki($request); | 
| 23 | 23 | } | 
| 24 | 24 | |
| @@ -17,7 +17,7 @@ | ||
| 17 | 17 | public function showEditProfile(GetUser $getUser, GetOrganization $getOrganization, GetUserStats $getUserStats) | 
| 18 | 18 |      { | 
| 19 | 19 | $user = $getUser->get(Auth::user()->uuid); | 
| 20 | -        if($user->organizationId() !== null) { | |
| 20 | +        if ($user->organizationId() !== null) { | |
| 21 | 21 | $organization = $getOrganization->get($user->organizationId()); | 
| 22 | 22 | } | 
| 23 | 23 | $stats = $getUserStats->get(Auth::user()->uuid); | 
| @@ -52,11 +52,11 @@ discard block | ||
| 52 | 52 | |
| 53 | 53 | public function listOrganizations(Request $request, ListOrganizations $listOrganizations) | 
| 54 | 54 |      { | 
| 55 | -        $page = $request->input('start')/10 + 1; | |
| 55 | +        $page = $request->input('start')/10+1; | |
| 56 | 56 | $organizations = $listOrganizations->list($page, 10); | 
| 57 | 57 | $total = isset($organizations['total']) ? $organizations['total'] : 0; | 
| 58 | 58 | $list = []; | 
| 59 | -        foreach ($organizations['list'] as $organization){ | |
| 59 | +        foreach ($organizations['list'] as $organization) { | |
| 60 | 60 | $org = $organization->toArray(); | 
| 61 | 61 | $list[] = [ | 
| 62 | 62 | $org['name'], | 
| @@ -70,7 +70,7 @@ discard block | ||
| 70 | 70 | return format($total, $list); | 
| 71 | 71 | } | 
| 72 | 72 | |
| 73 | - public function prepareInvitation(Request $request, PrepareInvitationUsersInOrganization $prepareInvitationUsersInOrganization) | |
| 73 | + public function prepareInvitation(Request $request, PrepareInvitationUsersInOrganization $prepareInvitationUsersInOrganization) | |
| 74 | 74 |      { | 
| 75 | 75 |          $users = $request->input('users'); | 
| 76 | 76 | $users = explode(PHP_EOL, $users); | 
| @@ -97,7 +97,7 @@ discard block | ||
| 97 | 97 | public function acceptInvite(Request $request, RespondInvitationToAnOrganization $respondInvitationToAnOrganization) | 
| 98 | 98 |      { | 
| 99 | 99 |          $action = $respondInvitationToAnOrganization->respond($token = $request->input('token')); | 
| 100 | -        switch($action['action']){ | |
| 100 | +        switch ($action['action']) { | |
| 101 | 101 | case 'register': | 
| 102 | 102 | return $this->redirectToRegisterPage($request, $action); | 
| 103 | 103 | case 'accept_or_decline': | 
| @@ -26,12 +26,12 @@ discard block | ||
| 26 | 26 | |
| 27 | 27 | public function listUsers(string $organizationId, Request $request, ListUsers $listUsers) | 
| 28 | 28 |      { | 
| 29 | -        $page = $request->input('start')/10 + 1; | |
| 29 | +        $page = $request->input('start')/10+1; | |
| 30 | 30 | |
| 31 | 31 | $users = $listUsers->list($organizationId, $page, 10); | 
| 32 | 32 | $total = init($users['total'], 0); | 
| 33 | 33 | $list = []; | 
| 34 | -        foreach ($users['list'] as $user){ | |
| 34 | +        foreach ($users['list'] as $user) { | |
| 35 | 35 | $user = $user->toArray(); | 
| 36 | 36 | $list[] = [ | 
| 37 | 37 | '', | 
| @@ -51,7 +51,7 @@ discard block | ||
| 51 | 51 | public function editShowForm(string $userId, GetUser $getUser, GetOrganization $getOrganization, GetUserStats $getUserStats) | 
| 52 | 52 |      { | 
| 53 | 53 | $user = $getUser->get($userId); | 
| 54 | -        if($user->organizationId() !== null) { | |
| 54 | +        if ($user->organizationId() !== null) { | |
| 55 | 55 | $organization = $getOrganization->get($user->organizationId()); | 
| 56 | 56 | } | 
| 57 | 57 | $stats = $getUserStats->get($userId); | 
| @@ -88,11 +88,11 @@ discard block | ||
| 88 | 88 | public function delete(string $userId, Request $request, DeleteUser $deleteUser) | 
| 89 | 89 |      { | 
| 90 | 90 | $redirect = 'back'; | 
| 91 | -        if($userId === Auth::id()){ | |
| 91 | +        if ($userId === Auth::id()) { | |
| 92 | 92 | $redirect = 'login'; | 
| 93 | 93 | } | 
| 94 | 94 | $deleteUser->delete($userId); | 
| 95 | -        if($redirect === 'login') { | |
| 95 | +        if ($redirect === 'login') { | |
| 96 | 96 |              return redirect()->route('login'); | 
| 97 | 97 | } | 
| 98 | 98 |          $request->session()->flash('notif_msg', __('users.message.user.deleted')); | 
| @@ -36,31 +36,31 @@ | ||
| 36 | 36 |      { | 
| 37 | 37 | $this->registerHelpers(); | 
| 38 | 38 | |
| 39 | -        if(config('app.env') === 'testing'){ | |
| 39 | +        if (config('app.env') === 'testing') { | |
| 40 | 40 | $this->tuBinding(); | 
| 41 | 41 | } | 
| 42 | -        if(config('app.env') === 'testing-ti'){ | |
| 42 | +        if (config('app.env') === 'testing-ti') { | |
| 43 | 43 | $this->tiBinding(); | 
| 44 | 44 | } | 
| 45 | -        if(config('app.env') === 'local' || config('app.env') === 'production'){ | |
| 45 | +        if (config('app.env') === 'local' || config('app.env') === 'production') { | |
| 46 | 46 | $this->prodBinding(); | 
| 47 | 47 | } | 
| 48 | 48 | } | 
| 49 | 49 | |
| 50 | 50 | public function boot() | 
| 51 | 51 |      { | 
| 52 | -        if(config('app.env') !== 'testing' && config('app.env') !== 'testing-ti') { | |
| 52 | +        if (config('app.env') !== 'testing' && config('app.env') !== 'testing-ti') { | |
| 53 | 53 | Schema::defaultStringLength(191); | 
| 54 | 54 | } | 
| 55 | 55 | |
| 56 | -        if(config('app.env') === 'local' || config('app.env') === 'production'){ | |
| 56 | +        if (config('app.env') === 'local' || config('app.env') === 'production') { | |
| 57 | 57 |              URL::forceScheme('https'); | 
| 58 | 58 | } | 
| 59 | 59 | } | 
| 60 | 60 | |
| 61 | 61 | private function registerHelpers(): void | 
| 62 | 62 |      { | 
| 63 | -        foreach (glob(app_path() . '/Src/Utils/Helpers/*.php') as $filename) { | |
| 63 | +        foreach (glob(app_path().'/Src/Utils/Helpers/*.php') as $filename) { | |
| 64 | 64 | require_once($filename); | 
| 65 | 65 | } | 
| 66 | 66 | } |