Passed
Pull Request — master (#78)
by guillaume
07:23
created
app/Src/UseCases/Domain/Context/Dto/ContextDto.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
         $this->postalCode = $postalCode;
39 39
         $this->department = $departmentNumber;
40 40
         $this->characteristics = $characteristics;
41
-        foreach($this->characteristics as $characteristic){
41
+        foreach ($this->characteristics as $characteristic) {
42 42
             $this->characteristicsByType[$characteristic->type()][] = $characteristic;
43 43
         }
44 44
         $this->description = $description;
Please login to merge, or discard this patch.
app/Src/UseCases/Infra/Sql/CharacteristicsRepositorySql.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -30,12 +30,12 @@  discard block
 block discarded – undo
30 30
         return $list->toArray();
31 31
     }
32 32
 
33
-    public function getByPageId(int $pageId):?Characteristic
33
+    public function getByPageId(int $pageId): ?Characteristic
34 34
     {
35 35
         $c = CharacteristicsModel::query()
36 36
             ->where('page_id', $pageId)
37 37
             ->first();
38
-        if(!isset($c)){
38
+        if (!isset($c)) {
39 39
             return null;
40 40
         }
41 41
         return $c->toDomain();
@@ -61,14 +61,14 @@  discard block
 block discarded – undo
61 61
     public function getBy(array $conditions): ?Characteristic
62 62
     {
63 63
         $characteristicModel = CharacteristicsModel::query()
64
-            ->when(isset($conditions['type']), function ($query) use($conditions){
64
+            ->when(isset($conditions['type']), function($query) use($conditions){
65 65
                 $query->where('type', $conditions['type']);
66 66
             })
67
-            ->when(isset($conditions['title']), function ($query) use($conditions){
67
+            ->when(isset($conditions['title']), function($query) use($conditions){
68 68
                 $query->where('code', $conditions['title']);
69 69
             })
70 70
             ->first();
71
-        if(!isset($characteristicModel)){
71
+        if (!isset($characteristicModel)) {
72 72
             return null;
73 73
         }
74 74
         return $characteristicModel->toDomain();
@@ -78,13 +78,13 @@  discard block
 block discarded – undo
78 78
     {
79 79
         $characteristicModel = CharacteristicsModel::query()
80 80
             ->where('type', $type)
81
-            ->where('pretty_page_label','LIKE', '%'.$search.'%')
81
+            ->where('pretty_page_label', 'LIKE', '%'.$search.'%')
82 82
             ->get();
83 83
 
84
-        if(!isset($characteristicModel)){
84
+        if (!isset($characteristicModel)) {
85 85
             return [];
86 86
         }
87
-        foreach ($characteristicModel as $characteristic){
87
+        foreach ($characteristicModel as $characteristic) {
88 88
             $characteristics[] = $characteristic->toArray();
89 89
         }
90 90
         return $characteristics ?? [];
Please login to merge, or discard this patch.
app/Src/UseCases/Infra/Sql/ContextRepositorySql.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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());
Please login to merge, or discard this patch.
app/User.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     public function adminlte_image()
38 38
     {
39 39
         $urlPicture = $this->path_picture != "" ? asset('storage/'.str_replace('app/public/', '', $this->path_picture)) : null;
40
-        if(!isset($urlPicture) || $urlPicture === ""){
40
+        if (!isset($urlPicture) || $urlPicture === "") {
41 41
             $urlPicture = url('').'/'.config('adminlte.logo_img');
42 42
         }
43 43
         return $urlPicture;
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     public function adminlte_desc()
47 47
     {
48 48
         $desc = $this->firstname.' '.$this->lastname;
49
-        if($this->organization_id !== null){
49
+        if ($this->organization_id !== null) {
50 50
             $organization = app(OrganizationRepository::class)->get($this->organization_id);
51 51
             $desc .= ' - organisme : '.$organization->name();
52 52
         }
@@ -85,9 +85,9 @@  discard block
 block discarded – undo
85 85
 
86 86
     public function addCharacteristics(array $characteristics)
87 87
     {
88
-        foreach($characteristics as $characteristicUuid){
89
-            $characteristic = CharacteristicsModel::where('uuid', (string)$characteristicUuid)->first();
90
-            if(isset($characteristic)) {
88
+        foreach ($characteristics as $characteristicUuid) {
89
+            $characteristic = CharacteristicsModel::where('uuid', (string) $characteristicUuid)->first();
90
+            if (isset($characteristic)) {
91 91
                 $this->characteristics()->save($characteristic);
92 92
             }
93 93
         }
@@ -96,9 +96,9 @@  discard block
 block discarded – undo
96 96
     public function syncCharacteristics(array $characteristics)
97 97
     {
98 98
         $characteristicsToSync = [];
99
-        foreach($characteristics as $characteristicUuid){
100
-            $characteristicModel = CharacteristicsModel::where('uuid', (string)$characteristicUuid)->first();
101
-            if(isset($characteristicModel)) {
99
+        foreach ($characteristics as $characteristicUuid) {
100
+            $characteristicModel = CharacteristicsModel::where('uuid', (string) $characteristicUuid)->first();
101
+            if (isset($characteristicModel)) {
102 102
                 $characteristicsToSync[] = $characteristicModel->id;
103 103
             }
104 104
         }
Please login to merge, or discard this patch.