Completed
Pull Request — master (#9)
by Samuel
03:39
created
src/Repository.php 2 patches
Unused Use Statements   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,15 +2,15 @@
 block discarded – undo
2 2
 
3 3
 namespace SimpleMapper;
4 4
 
5
+use Exception;
5 6
 use Nette\Database\Context;
6 7
 use Nette\Database\DriverException;
7 8
 use Nette\Database\Table\ActiveRow as NetteDatabaseActiveRow;
8 9
 use Nette\Database\Table\Selection as NetteDatabaseSelection;
10
+use PDOException;
9 11
 use SimpleMapper\Behaviour\Behaviour;
10 12
 use SimpleMapper\Structure\Structure;
11 13
 use Traversable;
12
-use Exception;
13
-use PDOException;
14 14
 
15 15
 /**
16 16
  * Base repository class
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
      * @param string $class
88 88
      * @return Behaviour|null
89 89
      */
90
-    public function getBehaviour($class): ?Behaviour
90
+    public function getBehaviour($class): ? Behaviour
91 91
     {
92 92
         return $this->behaviours[$class] ?? null;
93 93
     }
@@ -125,14 +125,14 @@  discard block
 block discarded – undo
125 125
             $scopeName = lcfirst(substr($name, 5));
126 126
             $scope = $this->structure->getScope(static::$tableName, $scopeName);
127 127
             if (!$scope) {
128
-                trigger_error('Scope ' . $scopeName . ' is not defined for table ' . static::$tableName, E_USER_ERROR);
128
+                trigger_error('Scope '.$scopeName.' is not defined for table '.static::$tableName, E_USER_ERROR);
129 129
             }
130 130
 
131
-            $scopeNameToCall = 'scope' . ucfirst($scope->getName());
131
+            $scopeNameToCall = 'scope'.ucfirst($scope->getName());
132 132
             return call_user_func_array([$this->findAll(), $scopeNameToCall], $arguments);
133 133
         }
134 134
 
135
-        trigger_error('Call to undefined method ' . get_class($this) . '::' . $name . '()', E_USER_ERROR);
135
+        trigger_error('Call to undefined method '.get_class($this).'::'.$name.'()', E_USER_ERROR);
136 136
     }
137 137
 
138 138
     /********************************************************************\
@@ -186,9 +186,9 @@  discard block
 block discarded – undo
186 186
      * @return ActiveRow|null
187 187
      * @throws Exception
188 188
      */
189
-    public function insert(array $data): ?ActiveRow
189
+    public function insert(array $data): ? ActiveRow
190 190
     {
191
-        $result = $this->transaction(function () use ($data) {
191
+        $result = $this->transaction(function() use ($data) {
192 192
             foreach ($this->behaviours as $behaviour) {
193 193
                 $data = $behaviour->beforeInsert($data);
194 194
             }
@@ -216,9 +216,9 @@  discard block
 block discarded – undo
216 216
      * @param array $data
217 217
      * @return ActiveRow|null
218 218
      */
219
-    public function update(ActiveRow $record, array $data): ?ActiveRow
219
+    public function update(ActiveRow $record, array $data): ? ActiveRow
220 220
     {
221
-        $result = $this->transaction(function () use ($record, $data) {
221
+        $result = $this->transaction(function() use ($record, $data) {
222 222
             $oldRecord = clone $record;
223 223
 
224 224
             foreach ($this->behaviours as $behaviour) {
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
      */
245 245
     public function delete(ActiveRow $record): bool
246 246
     {
247
-        $result = $this->transaction(function () use ($record): bool {
247
+        $result = $this->transaction(function() use ($record): bool {
248 248
             $oldRecord = clone $record;
249 249
 
250 250
             foreach ($this->behaviours as $behaviour) {
Please login to merge, or discard this patch.
src/Structure/CustomStructure.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     {
44 44
         foreach ($scopes as $scope) {
45 45
             if (!($scope instanceof Scope)) {
46
-                throw new SimpleMapperException('Scopes can be only of class ' . Scope::class);
46
+                throw new SimpleMapperException('Scopes can be only of class '.Scope::class);
47 47
             }
48 48
 
49 49
             $this->data[$table]['scopes'][$scope->getName()] = $scope;
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
      * @param string $scope
93 93
      * @return Scope|null
94 94
      */
95
-    public function getScope(string $table, string $scope): ?Scope
95
+    public function getScope(string $table, string $scope): ? Scope
96 96
     {
97 97
         return isset($this->data[$table]['scopes'][$scope])
98 98
             ? $this->data[$table]['scopes'][$scope]
Please login to merge, or discard this patch.
src/Structure/Structure.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,5 +39,5 @@
 block discarded – undo
39 39
      * @param string $scope
40 40
      * @return Scope|null
41 41
      */
42
-    public function getScope(string $table, string $scope): ?Scope;
42
+    public function getScope(string $table, string $scope): ? Scope;
43 43
 }
Please login to merge, or discard this patch.
src/Selection.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,12 +61,12 @@
 block discarded – undo
61 61
             $scopeName = lcfirst(substr($name, 5));
62 62
             $scope = $this->structure->getScope($this->selection->getName(), $scopeName);
63 63
             if (!$scope) {
64
-                trigger_error('Scope ' . $scopeName . ' is not defined for table ' . $this->selection->getName(), E_USER_ERROR);
64
+                trigger_error('Scope '.$scopeName.' is not defined for table '.$this->selection->getName(), E_USER_ERROR);
65 65
             }
66 66
             return $this->where(call_user_func_array($scope->getCallback(), $arguments));
67 67
         }
68 68
 
69
-        trigger_error('Call to undefined method ' . get_class($this) . '::' . $name . '()', E_USER_ERROR);
69
+        trigger_error('Call to undefined method '.get_class($this).'::'.$name.'()', E_USER_ERROR);
70 70
     }
71 71
 
72 72
     /**********************************************************************\
Please login to merge, or discard this patch.