Passed
Push — develop ( 7073d3...4a945c )
by nguereza
02:26
created
src/Entity.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@
 block discarded – undo
110 110
         foreach ($rawColumns as $name => $value) {
111 111
             if ($this->mapper()->hasRelation($name)) {
112 112
                 $relation = $this->mapper()->getRelated($name);
113
-                if($relation instanceof self){
113
+                if ($relation instanceof self) {
114 114
                     $data[$name] = $relation->jsonSerialize();
115 115
                 } else {
116 116
                     $data[$name] = $relation;
Please login to merge, or discard this patch.
Braces   +7 added lines, -13 removed lines patch added patch discarded remove patch
@@ -58,8 +58,7 @@  discard block
 block discarded – undo
58 58
  * @package Platine\Orm
59 59
  * @template TEntity as Entity
60 60
  */
61
-abstract class Entity implements JsonSerializable
62
-{
61
+abstract class Entity implements JsonSerializable {
63 62
     /**
64 63
      * The instance of data mapper
65 64
      * @var DataMapper<TEntity> |null
@@ -103,14 +102,13 @@  discard block
 block discarded – undo
103 102
      * Convert entity to JSON array
104 103
      * @return array<string, mixed>
105 104
      */
106
-    public function jsonSerialize()
107
-    {
105
+    public function jsonSerialize() {
108 106
         $rawColumns = $this->mapper()->getRawColumns();
109 107
         $data = [];
110 108
         foreach ($rawColumns as $name => $value) {
111 109
             if ($this->mapper()->hasRelation($name)) {
112 110
                 $relation = $this->mapper()->getRelated($name);
113
-                if($relation instanceof self){
111
+                if($relation instanceof self) {
114 112
                     $data[$name] = $relation->jsonSerialize();
115 113
                 } else {
116 114
                     $data[$name] = $relation;
@@ -130,8 +128,7 @@  discard block
 block discarded – undo
130 128
      * @param string $name
131 129
      * @return mixed
132 130
      */
133
-    public function __get(string $name)
134
-    {
131
+    public function __get(string $name) {
135 132
         if ($this->mapper()->hasRelation($name)) {
136 133
             return $this->mapper()->getRelated($name);
137 134
         }
@@ -152,8 +149,7 @@  discard block
 block discarded – undo
152 149
      * @param mixed $value
153 150
      * @return void
154 151
      */
155
-    public function __set(string $name, $value)
156
-    {
152
+    public function __set(string $name, $value) {
157 153
         if ($this->mapper()->hasRelation($name)) {
158 154
             if (is_array($value)) {
159 155
                 foreach ($value as $entity) {
@@ -172,8 +168,7 @@  discard block
 block discarded – undo
172 168
      * @param string $name
173 169
      * @return bool
174 170
      */
175
-    public function __isset(string $name)
176
-    {
171
+    public function __isset(string $name) {
177 172
         return $this->mapper()->hasRelation($name)
178 173
                 || $this->mapper()->hasColumn($name);
179 174
     }
@@ -183,8 +178,7 @@  discard block
 block discarded – undo
183 178
      * @param string $name
184 179
      * @return bool
185 180
      */
186
-    public function __unset(string $name)
187
-    {
181
+    public function __unset(string $name) {
188 182
         $this->mapper()->clearColumn($name, true);
189 183
     }
190 184
 
Please login to merge, or discard this patch.