Passed
Pull Request — master (#20)
by Peter
05:49
created
src/BuilderTrait.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
         $tempColumns = isset($this->query->columns)
19 19
             ? array_merge($columns, $this->query->columns)
20 20
             : $columns;
21
-        foreach($tempColumns as $column) {
21
+        foreach ($tempColumns as $column) {
22 22
             $segments = explode('.', $column);
23 23
             if ($segments[0] == $this->model->getTable()) {
24 24
                 $this->query->addSelect($this->model->getVersionTable().'.*');
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
         $values[$this->model->getLatestVersionColumn()] = 1;
46 46
 
47 47
         // insert main table record
48
-        if (! $id = $this->query->insertGetId($values)) {
48
+        if (!$id = $this->query->insertGetId($values)) {
49 49
             return false;
50 50
         }
51 51
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         $versionValues[$this->model->getVersionColumn()] = 1;
76 76
 
77 77
         // insert main table record
78
-        if (! $id = $this->query->insertGetId($values, $sequence)) {
78
+        if (!$id = $this->query->insertGetId($values, $sequence)) {
79 79
             return false;
80 80
         }
81 81
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 
85 85
         // insert version table record
86 86
         $db = $this->model->getConnection();
87
-        if (! $db->table($this->model->getVersionTable())->insert($versionValues)) {
87
+        if (!$db->table($this->model->getVersionTable())->insert($versionValues)) {
88 88
             return false;
89 89
         }
90 90
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         $affectedRecords = $this->getAffectedRecords();
114 114
 
115 115
         // update main table records
116
-        if (! $this->query->increment($this->model->getLatestVersionColumn(), 1, $values)) {
116
+        if (!$this->query->increment($this->model->getLatestVersionColumn(), 1, $values)) {
117 117
             return false;
118 118
         }
119 119
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
         $db = $this->model->getConnection();
122 122
         foreach ($affectedRecords as $record) {
123 123
             // get versioned values from record
124
-            foreach($this->model->getVersionedAttributeNames() as $key) {
124
+            foreach ($this->model->getVersionedAttributeNames() as $key) {
125 125
                 $recordVersionValues[$key] = (isset($versionValues[$key])) ? $versionValues[$key] : $record->{$key};
126 126
             }
127 127
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
             $recordVersionValues[$this->model->getVersionColumn()] = $record->{$this->model->getLatestVersionColumn()}+1;
134 134
 
135 135
             // insert new version
136
-            if(! $db->table($this->model->getVersionTable())->insert($recordVersionValues)) {
136
+            if (!$db->table($this->model->getVersionTable())->insert($recordVersionValues)) {
137 137
                 return false;
138 138
             }
139 139
         }
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
         }, $affectedRecords);
173 173
 
174 174
         // delete main table records
175
-        if (! $this->query->delete()) {
175
+        if (!$this->query->delete()) {
176 176
             return false;
177 177
         }
178 178
 
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
         );
220 220
 
221 221
         foreach ($values as $key => $value) {
222
-            if (! $this->isVersionedKey($key, $versionedKeys)) {
222
+            if (!$this->isVersionedKey($key, $versionedKeys)) {
223 223
                 $array[$key] = $value;
224 224
             }
225 225
         }
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
      */
258 258
     protected function isVersionedKey($key, array $versionedKeys)
259 259
     {
260
-        $segments = explode(".",$key);
260
+        $segments = explode(".", $key);
261 261
 
262 262
         if (count($segments) > 2) {
263 263
             throw new Exception("Key '".$key."' has too many fractions.");
Please login to merge, or discard this patch.
src/Versionable.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      */
48 48
     public function getVersionedAttributeNames()
49 49
     {
50
-        return (! empty($this->versioned)) ? $this->versioned : [];
50
+        return (!empty($this->versioned)) ? $this->versioned : [];
51 51
     }
52 52
 
53 53
     /**
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      */
58 58
     public function getVersionKeyName()
59 59
     {
60
-        return 'ref_' . $this->getKeyName();
60
+        return 'ref_'.$this->getKeyName();
61 61
     }
62 62
 
63 63
     /**
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
      */
68 68
     public function getVersionTable()
69 69
     {
70
-        return $this->getTable() . '_version';
70
+        return $this->getTable().'_version';
71 71
     }
72 72
 
73 73
     /**
Please login to merge, or discard this patch.