@@ -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; |
@@ -9,8 +9,8 @@ |
||
| 9 | 9 | |
| 10 | 10 | interface ContextRepository |
| 11 | 11 | { |
| 12 | - public function getByUser(string $userId):?Context; |
|
| 12 | + public function getByUser(string $userId): ?Context; |
|
| 13 | 13 | public function add(Context $context, string $userId); |
| 14 | 14 | public function update(Context $context, string $userId); |
| 15 | - public function getByUserDto(string $userId):?ContextDto; |
|
| 15 | + public function getByUserDto(string $userId): ?ContextDto; |
|
| 16 | 16 | } |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | $content = json_decode($response->getBody()->getContents(), true); |
| 24 | 24 | |
| 25 | 25 | $features = $content['features']; |
| 26 | - if(isset($features) && !empty($features)){ |
|
| 26 | + if (isset($features) && !empty($features)) { |
|
| 27 | 27 | $feature = $features[0]; |
| 28 | 28 | $coordinates = $feature['geometry']['coordinates']; |
| 29 | 29 | $departmentNumber = explode(',', $feature['properties']['context'])[0]; |
@@ -126,7 +126,7 @@ |
||
| 126 | 126 | * @param string|null $characteristicIdCroppingSystem |
| 127 | 127 | * @return Paginator |
| 128 | 128 | * |
| 129 | - */ |
|
| 129 | + */ |
|
| 130 | 130 | public function getFollowersPage(int $pageId, string $type = 'follow', ?string $departmentNumber = null, ?string $characteristicId = null, ?string $characteristicIdCroppingSystem = null): Paginator |
| 131 | 131 | { |
| 132 | 132 | return InteractionModel::query() |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | ->where('page_id', $interaction->pageId()) |
| 27 | 27 | ->first(); |
| 28 | 28 | |
| 29 | - if($interactionModel === null) { |
|
| 29 | + if ($interactionModel === null) { |
|
| 30 | 30 | $interactionModel = new InteractionModel(); |
| 31 | 31 | $interactionModel->{$canInteract->key()} = $user->id ?? $canInteract->identifier(); |
| 32 | 32 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | public function getByInteractUser(CanInteract $canInteract, int $pageId): ?Interaction |
| 40 | 40 | { |
| 41 | - if($canInteract->key() == 'user_id') { |
|
| 41 | + if ($canInteract->key() == 'user_id') { |
|
| 42 | 42 | $user = User::query()->where('uuid', $canInteract->identifier())->first(); |
| 43 | 43 | } |
| 44 | 44 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | ->where('page_id', $pageId) |
| 48 | 48 | ->first(); |
| 49 | 49 | |
| 50 | - if(!isset($interactionModel)){ |
|
| 50 | + if (!isset($interactionModel)) { |
|
| 51 | 51 | return null; |
| 52 | 52 | } |
| 53 | 53 | |
@@ -83,9 +83,9 @@ discard block |
||
| 83 | 83 | ->orderBy('updated_at', 'desc') |
| 84 | 84 | ->get(); |
| 85 | 85 | |
| 86 | - foreach($interactionsModel as $interaction) { |
|
| 86 | + foreach ($interactionsModel as $interaction) { |
|
| 87 | 87 | $page = PageModel::query()->where('page_id', $interaction->page_id)->first(); |
| 88 | - if(!isset($page)){ |
|
| 88 | + if (!isset($page)) { |
|
| 89 | 89 | continue; |
| 90 | 90 | } |
| 91 | 91 | $applause = InteractionModel::query()->where('page_id', $interaction->page_id)->where('applause', true)->count(); |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | ->where('user_id', $user->id) |
| 109 | 109 | ->where('done', true) |
| 110 | 110 | ->get(); |
| 111 | - foreach ($records as $record){ |
|
| 111 | + foreach ($records as $record) { |
|
| 112 | 112 | $practises[] = new PractiseVo( |
| 113 | 113 | $record->page_id, |
| 114 | 114 | $record->page->title ?? '', |
@@ -132,18 +132,18 @@ discard block |
||
| 132 | 132 | { |
| 133 | 133 | return InteractionModel::query() |
| 134 | 134 | ->with('user.context') |
| 135 | - ->where(function ($query) use ($type){ |
|
| 136 | - $query->when($type === 'follow', function ($query) { |
|
| 135 | + ->where(function($query) use ($type){ |
|
| 136 | + $query->when($type === 'follow', function($query) { |
|
| 137 | 137 | $query->where('follow', true); |
| 138 | 138 | $query->orWhere('done', true); |
| 139 | 139 | }) |
| 140 | - ->when($type === 'do', function ($query) { |
|
| 140 | + ->when($type === 'do', function($query) { |
|
| 141 | 141 | $query->where('done', true); |
| 142 | 142 | }); |
| 143 | 143 | }) |
| 144 | - ->when($characteristicId !== null, function ($query) use($characteristicId) { |
|
| 144 | + ->when($characteristicId !== null, function($query) use($characteristicId) { |
|
| 145 | 145 | $characteristic = CharacteristicsModel::query()->where('uuid', $characteristicId)->first(); |
| 146 | - if(!isset($characteristic)){ |
|
| 146 | + if (!isset($characteristic)) { |
|
| 147 | 147 | return; |
| 148 | 148 | } |
| 149 | 149 | $query->whereRaw( |
@@ -151,9 +151,9 @@ discard block |
||
| 151 | 151 | $characteristic->id |
| 152 | 152 | ); |
| 153 | 153 | }) |
| 154 | - ->when($characteristicIdCroppingSystem !== null, function ($query) use($characteristicIdCroppingSystem) { |
|
| 154 | + ->when($characteristicIdCroppingSystem !== null, function($query) use($characteristicIdCroppingSystem) { |
|
| 155 | 155 | $characteristic = CharacteristicsModel::query()->where('uuid', $characteristicIdCroppingSystem)->first(); |
| 156 | - if(!isset($characteristic)){ |
|
| 156 | + if (!isset($characteristic)) { |
|
| 157 | 157 | return; |
| 158 | 158 | } |
| 159 | 159 | $query->whereRaw( |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | $characteristic->id |
| 162 | 162 | ); |
| 163 | 163 | }) |
| 164 | - ->when($departmentNumber !== null, function ($query) use($departmentNumber) { |
|
| 164 | + ->when($departmentNumber !== null, function($query) use($departmentNumber) { |
|
| 165 | 165 | $query |
| 166 | 166 | ->join('users', 'users.id', 'interactions.user_id') |
| 167 | 167 | ->join('contexts', 'users.context_id', 'contexts.id') |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | ->whereNotNull('interactions.user_id') |
| 172 | 172 | ->orderBy('interactions.updated_at', 'desc') |
| 173 | 173 | ->paginate() |
| 174 | - ->through(function ($item){ |
|
| 174 | + ->through(function($item) { |
|
| 175 | 175 | return new FollowerDto($item->user->toDto(), $item->user->context->toDto(), $item->toDto()); |
| 176 | 176 | }) |
| 177 | 177 | ; |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | class ContextRepositorySql implements ContextRepository |
| 14 | 14 | { |
| 15 | - public function getByUser(string $userId):?Context |
|
| 15 | + public function getByUser(string $userId): ?Context |
|
| 16 | 16 | { |
| 17 | 17 | $user = User::where('uuid', $userId)->first(); |
| 18 | 18 | return $user->context !== null ? $user->context->toDomain() : null; |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | public function getByUserDto(string $userId): ?ContextDto |
| 36 | 36 | { |
| 37 | 37 | $user = User::where('uuid', $userId)->first(); |
| 38 | - if($user === null){ |
|
| 38 | + if ($user === null) { |
|
| 39 | 39 | return null; |
| 40 | 40 | } |
| 41 | 41 | return $user->context !== null ? $user->context->toDto($user->uuid) : null; |
@@ -44,12 +44,12 @@ discard block |
||
| 44 | 44 | public function update(Context $context, string $userId) |
| 45 | 45 | { |
| 46 | 46 | $user = User::where('uuid', $userId)->first(); |
| 47 | - if($user === null){ |
|
| 47 | + if ($user === null) { |
|
| 48 | 48 | return null; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | $contextModel = $user->context; |
| 52 | - if($contextModel === null){ |
|
| 52 | + if ($contextModel === null) { |
|
| 53 | 53 | return null; |
| 54 | 54 | } |
| 55 | 55 | $contextData = collect($context->toArray()); |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | $this->department = $departmentNumber; |
| 41 | 41 | $this->fullname = $this->fullname(); |
| 42 | 42 | $characteristicsByType = []; |
| 43 | - foreach($characteristics as $characteristic){ |
|
| 43 | + foreach ($characteristics as $characteristic) { |
|
| 44 | 44 | $characteristicsByType[$characteristic->type()][] = $characteristic; |
| 45 | 45 | } |
| 46 | 46 | |
@@ -26,12 +26,12 @@ |
||
| 26 | 26 | |
| 27 | 27 | public function toDto():ContextDto |
| 28 | 28 | { |
| 29 | - $characteristics = $this->user->characteristics()->get()->transform(function(CharacteristicsModel $item){ |
|
| 29 | + $characteristics = $this->user->characteristics()->get()->transform(function(CharacteristicsModel $item) { |
|
| 30 | 30 | return $item->toDto(); |
| 31 | 31 | }); |
| 32 | 32 | $characteristicDepartment = CharacteristicsModel::query()->where('code', $this->department_number)->first(); |
| 33 | 33 | |
| 34 | - if(isset($characteristicDepartment)){ |
|
| 34 | + if (isset($characteristicDepartment)) { |
|
| 35 | 35 | $characteristics->push($characteristicDepartment->toDto()); |
| 36 | 36 | } |
| 37 | 37 | |
@@ -31,12 +31,12 @@ discard block |
||
| 31 | 31 | return $list->toArray(); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - public function getByPageId(int $pageId):?Characteristic |
|
| 34 | + public function getByPageId(int $pageId): ?Characteristic |
|
| 35 | 35 | { |
| 36 | 36 | $c = CharacteristicsModel::query() |
| 37 | 37 | ->where('page_id', $pageId) |
| 38 | 38 | ->first(); |
| 39 | - if(!isset($c)){ |
|
| 39 | + if (!isset($c)) { |
|
| 40 | 40 | return null; |
| 41 | 41 | } |
| 42 | 42 | return $c->toDomain(); |
@@ -62,14 +62,14 @@ discard block |
||
| 62 | 62 | public function getBy(array $conditions): ?Characteristic |
| 63 | 63 | { |
| 64 | 64 | $characteristicModel = CharacteristicsModel::query() |
| 65 | - ->when(isset($conditions['type']), function ($query) use($conditions){ |
|
| 65 | + ->when(isset($conditions['type']), function($query) use($conditions){ |
|
| 66 | 66 | $query->where('type', $conditions['type']); |
| 67 | 67 | }) |
| 68 | - ->when(isset($conditions['title']), function ($query) use($conditions){ |
|
| 68 | + ->when(isset($conditions['title']), function($query) use($conditions){ |
|
| 69 | 69 | $query->where('code', $conditions['title']); |
| 70 | 70 | }) |
| 71 | 71 | ->first(); |
| 72 | - if(!isset($characteristicModel)){ |
|
| 72 | + if (!isset($characteristicModel)) { |
|
| 73 | 73 | return null; |
| 74 | 74 | } |
| 75 | 75 | return $characteristicModel->toDomain(); |