Passed
Push — master ( 888032...f262ea )
by Bertrand
10:35
created
app/Src/UseCases/Infra/Sql/InteractionPageRepositorySql.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         ;
Please login to merge, or discard this patch.
app/Src/UseCases/Infra/Sql/Model/ContextModel.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,12 +26,12 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
app/Src/UseCases/Infra/Sql/CharacteristicsRepositorySql.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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();
Please login to merge, or discard this patch.
app/Src/UseCases/Domain/Ports/CharacteristicsRepository.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,6 +11,6 @@
 block discarded – undo
11 11
     public function getByType(string $type, bool $isMain):array;
12 12
     public function getAllByType(string $type):array;
13 13
     public function save(Characteristic $c);
14
-    public function getBy(array $conditions):?Characteristic;
15
-    public function getByPageId(int $pageId):?Characteristic;
14
+    public function getBy(array $conditions): ?Characteristic;
15
+    public function getByPageId(int $pageId): ?Characteristic;
16 16
 }
Please login to merge, or discard this patch.
app/Src/UseCases/Domain/Context/UseCases/AddCharacteristicsToContext.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,9 +36,9 @@
 block discarded – undo
36 36
         $pages = $this->pageRepository->getByIds($pagesIds);
37 37
 
38 38
         $characteristics = [];
39
-        foreach ($pages as $page){
39
+        foreach ($pages as $page) {
40 40
             $characteristic = $this->characteristicsRepository->getByPageId($page->pageId());
41
-            if(!isset($characteristic)){
41
+            if (!isset($characteristic)) {
42 42
                 $characteristic = $page->createCharacteristicAssociated();
43 43
             }
44 44
             $characteristics[] = $characteristic->id();
Please login to merge, or discard this patch.
app/Src/UseCases/Domain/Context/Queries/GetInteractionsByPageAndUser.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
         $this->authGateway = $authGateway;
26 26
     }
27 27
 
28
-    public function execute(int $pageId):?Interaction
28
+    public function execute(int $pageId): ?Interaction
29 29
     {
30 30
         $canInteractUser = $this->getInteractUser();
31 31
         return $this->interactionRepository->getByInteractUser($canInteractUser, $pageId);
Please login to merge, or discard this patch.
app/Src/UseCases/Domain/Context/Queries/GetContextByUser.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
         $this->contextRepository = $contextRepository;
17 17
     }
18 18
 
19
-    public function execute(string $userId):?ContextDto
19
+    public function execute(string $userId): ?ContextDto
20 20
     {
21 21
         return $this->contextRepository->getByUserDto($userId);
22 22
     }
Please login to merge, or discard this patch.
app/Src/UseCases/Domain/Shared/Model/Dto.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@
 block discarded – undo
13 13
 
14 14
     private function serialize(array $properties)
15 15
     {
16
-        foreach ($properties as $key => $property){
17
-            if(is_object($property)){
16
+        foreach ($properties as $key => $property) {
17
+            if (is_object($property)) {
18 18
                 $params[$this->camelToSnake($key)] = $this->serialize(get_object_vars($property));
19
-            }else {
19
+            } else {
20 20
                 $params[$this->camelToSnake($key)] = $property;
21 21
             }
22 22
         }
Please login to merge, or discard this patch.
app/Http/Controllers/Profile/ProfileController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
         $allCharacteristics = app(GetAllCharacteristics::class)->get();
35 35
         try {
36 36
             $context = $contextQueryByUser->execute(Auth::user()->uuid)->toArray();
37
-        }catch (\Throwable $e){
37
+        } catch (\Throwable $e) {
38 38
             Log::emergency($e->getMessage().' '.$e->getLine().' '.$e->getFile().' '.$e->getTraceAsString());
39 39
             return redirect()->route('wizard.profile');
40 40
         }
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         $roles = app(GetUserRole::class)->get()->toArray();
44 44
         $practises = app(GetUserPractises::class)->get(Auth::user()->uuid);
45 45
         $interactions = app(GetInteractionsByUser::class)->get(Auth::user()->uuid);
46
-        $usersCharacteristics =  array_merge($context['productions'], $context['characteristics'], $context['characteristics_departement']);
46
+        $usersCharacteristics = array_merge($context['productions'], $context['characteristics'], $context['characteristics_departement']);
47 47
         $uuidsUserCharacteristics = array_column($usersCharacteristics, 'uuid');
48 48
         $role = last($user['roles']);
49 49
         $routeComment = route('profile.comments.show');
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
         $roles = app(GetUserRole::class)->get()->toArray();
73 73
         $practises = app(GetUserPractises::class)->get($userId);
74 74
         $interactions = app(GetInteractionsByUser::class)->get($userId);
75
-        $usersCharacteristics =  array_merge($context['productions'], $context['characteristics']);
75
+        $usersCharacteristics = array_merge($context['productions'], $context['characteristics']);
76 76
         $uuidsUserCharacteristics = array_column($usersCharacteristics, 'uuid');
77 77
         $role = last($user['roles']);
78 78
 
Please login to merge, or discard this patch.