Passed
Pull Request — master (#78)
by guillaume
07:12
created
app/Src/UseCases/Infra/Sql/ContextRepositorySql.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 
14 14
 class ContextRepositorySql implements ContextRepository
15 15
 {
16
-    public function getByUser(string $userId):?Context
16
+    public function getByUser(string $userId): ?Context
17 17
     {
18 18
         $user = User::where('uuid', $userId)->first();
19 19
         return $user->context !== null ? $user->context->toDomain() : null;
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
         $user = User::where('uuid', $userId)->first();
26 26
 
27 27
         $farmings = $contextData->get('farmings');
28
-        foreach($farmings as $farming){
29
-            $characteristic = CharacteristicsModel::where('uuid', (string)$farming)->first();
28
+        foreach ($farmings as $farming) {
29
+            $characteristic = CharacteristicsModel::where('uuid', (string) $farming)->first();
30 30
             $user->characteristics()->save($characteristic);
31 31
         }
32 32
 
@@ -39,20 +39,20 @@  discard block
 block discarded – undo
39 39
     public function getByUserDto(string $userId): ?ContextDto
40 40
     {
41 41
         $user = User::where('uuid', $userId)->first();
42
-        if($user == null){
42
+        if ($user == null) {
43 43
             return null;
44 44
         }
45 45
         $context = ContextModel::find($user->context_id);
46
-        if($context == null){
46
+        if ($context == null) {
47 47
             return null;
48 48
         }
49
-        $characteristics = $user->characteristics()->get()->transform(function(CharacteristicsModel $item){
49
+        $characteristics = $user->characteristics()->get()->transform(function(CharacteristicsModel $item) {
50 50
             return $item->toDto();
51 51
         });
52 52
 
53 53
         $numberDepartment = $context->department_number;
54 54
         $characteristicDepartment = CharacteristicsModel::query()->where('code', $numberDepartment)->first();
55
-        if(isset($characteristicDepartment)){
55
+        if (isset($characteristicDepartment)) {
56 56
             $characteristics->push($characteristicDepartment->toDto());
57 57
         }
58 58
 
@@ -73,12 +73,12 @@  discard block
 block discarded – undo
73 73
     public function update(Context $context, string $userId)
74 74
     {
75 75
         $user = User::where('uuid', $userId)->first();
76
-        if($user === null){
76
+        if ($user === null) {
77 77
             return null;
78 78
         }
79 79
 
80 80
         $contextModel = ContextModel::where('uuid', $context->id())->first();
81
-        if($contextModel === null){
81
+        if ($contextModel === null) {
82 82
             return null;
83 83
         }
84 84
         $contextData = collect($context->toArray());
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
 
87 87
         $farmings = $contextData->get('farmings');
88 88
         $characteristics = [];
89
-        foreach($farmings as $farming){
90
-            $characteristicModel = CharacteristicsModel::where('uuid', (string)$farming)->first();
91
-            if(isset($characteristicModel)) {
89
+        foreach ($farmings as $farming) {
90
+            $characteristicModel = CharacteristicsModel::where('uuid', (string) $farming)->first();
91
+            if (isset($characteristicModel)) {
92 92
                 $characteristics[] = $characteristicModel->id;
93 93
             }
94 94
         }
Please login to merge, or discard this patch.