| @@ -14,7 +14,7 @@ | ||
| 14 | 14 | */ | 
| 15 | 15 | protected function redirectTo($request) | 
| 16 | 16 |      { | 
| 17 | -        if (! $request->expectsJson()) { | |
| 17 | +        if (!$request->expectsJson()) { | |
| 18 | 18 |              return route('login'); | 
| 19 | 19 | } | 
| 20 | 20 | } | 
| @@ -11,10 +11,10 @@ discard block | ||
| 11 | 11 |  { | 
| 12 | 12 | private $organizations = []; | 
| 13 | 13 | |
| 14 | - public function get(string $id):? Organization | |
| 14 | + public function get(string $id): ? Organization | |
| 15 | 15 |      { | 
| 16 | -        foreach ($this->organizations as $organization){ | |
| 17 | -            if($organization->id() === $id){ | |
| 16 | +        foreach ($this->organizations as $organization) { | |
| 17 | +            if ($organization->id() === $id) { | |
| 18 | 18 | return $organization; | 
| 19 | 19 | } | 
| 20 | 20 | } | 
| @@ -38,8 +38,8 @@ discard block | ||
| 38 | 38 | |
| 39 | 39 | public function update(Organization $o) | 
| 40 | 40 |      { | 
| 41 | -        foreach ($this->organizations as $key => $organization){ | |
| 42 | -            if($organization->id() === $o->id()){ | |
| 41 | +        foreach ($this->organizations as $key => $organization) { | |
| 42 | +            if ($organization->id() === $o->id()) { | |
| 43 | 43 | $this->organizations[$key] = $organization; | 
| 44 | 44 | } | 
| 45 | 45 | } | 
| @@ -12,7 +12,7 @@ | ||
| 12 | 12 | public function current(): ?User | 
| 13 | 13 |      { | 
| 14 | 14 | $userModel = Auth::user(); | 
| 15 | -        if(!isset($userModel)){ | |
| 15 | +        if (!isset($userModel)) { | |
| 16 | 16 | return null; | 
| 17 | 17 | } | 
| 18 | 18 | return new User($userModel->uuid, $userModel->email, $userModel->firstname, $userModel->lastname, $userModel->organization_id); | 
| @@ -8,6 +8,6 @@ | ||
| 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 | 13 | } | 
| @@ -17,7 +17,7 @@ discard block | ||
| 17 | 17 | ->select() | 
| 18 | 18 |              ->where('uuid', $id) | 
| 19 | 19 | ->first(); | 
| 20 | -        if(!isset($record)){ | |
| 20 | +        if (!isset($record)) { | |
| 21 | 21 | return null; | 
| 22 | 22 | } | 
| 23 | 23 | $address = new Address($record->city, $record->address1, $record->address2, $record->postal_code); | 
| @@ -42,11 +42,11 @@ discard block | ||
| 42 | 42 | ->offset(($page-1)*$perPage) | 
| 43 | 43 | ->limit($perPage) | 
| 44 | 44 | ->get(); | 
| 45 | -        if(empty($records)){ | |
| 45 | +        if (empty($records)) { | |
| 46 | 46 | return []; | 
| 47 | 47 | } | 
| 48 | 48 | $organizations = []; | 
| 49 | -        foreach($records as $record){ | |
| 49 | +        foreach ($records as $record) { | |
| 50 | 50 | $address = new Address($record->city, $record->address1, $record->address2, $record->postal_code); | 
| 51 | 51 | $organizations[] = new Organization($record->uuid, $record->name, $record->path_picture, $address); | 
| 52 | 52 | } | 
| @@ -33,10 +33,10 @@ discard block | ||
| 33 | 33 | |
| 34 | 34 | public function create(string $ext = 'jpg') | 
| 35 | 35 |      { | 
| 36 | -        if($this->pathPicture !== "") { | |
| 36 | +        if ($this->pathPicture !== "") { | |
| 37 | 37 | $picture = new Picture($this->pathPicture); | 
| 38 | -            $picture->resize('app/public/organizations/' . $this->id . '.' . $ext); | |
| 39 | - $this->pathPicture = 'app/public/organizations/' . $this->id . '.' . $ext; | |
| 38 | +            $picture->resize('app/public/organizations/'.$this->id.'.'.$ext); | |
| 39 | + $this->pathPicture = 'app/public/organizations/'.$this->id.'.'.$ext; | |
| 40 | 40 | } | 
| 41 | 41 | |
| 42 | 42 | app(OrganizationRepository::class)->add($this); | 
| @@ -46,11 +46,11 @@ discard block | ||
| 46 | 46 |      { | 
| 47 | 47 | $this->name = $name; | 
| 48 | 48 | $this->address = $address; | 
| 49 | -        if($picture['path'] !== "") { | |
| 49 | +        if ($picture['path'] !== "") { | |
| 50 | 50 | $logo = new Picture($picture['path']); | 
| 51 | 51 | $ext = $picture['ext']; | 
| 52 | -            $logo->resize('app/public/organizations/' . $this->id . '.' . $ext); | |
| 53 | - $this->pathPicture = 'app/public/organizations/' . $this->id . '.' . $ext; | |
| 52 | +            $logo->resize('app/public/organizations/'.$this->id.'.'.$ext); | |
| 53 | + $this->pathPicture = 'app/public/organizations/'.$this->id.'.'.$ext; | |
| 54 | 54 | } | 
| 55 | 55 | app(OrganizationRepository::class)->update($this); | 
| 56 | 56 | } | 
| @@ -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; | 
| @@ -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 | } |