Completed
Push — master ( 953783...055045 )
by Dominik
02:02
created
src/RepositoryInterface.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -40,6 +40,7 @@  discard block
 block discarded – undo
40 40
      * @param ModelInterface $model
41 41
      *
42 42
      * @throws AlreadyKnownException
43
+     * @return void
43 44
      */
44 45
     public function insert(ModelInterface $model);
45 46
 
@@ -47,6 +48,7 @@  discard block
 block discarded – undo
47 48
      * @param ModelInterface $model
48 49
      *
49 50
      * @throws UnknownException
51
+     * @return void
50 52
      */
51 53
     public function update(ModelInterface $model);
52 54
 
@@ -54,6 +56,7 @@  discard block
 block discarded – undo
54 56
      * @param ModelInterface $model
55 57
      *
56 58
      * @throws UnknownException
59
+     * @return void
57 60
      */
58 61
     public function delete(ModelInterface $model);
59 62
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Chubbyphp\Model;
6 6
 
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
      *
28 28
      * @return ModelInterface[]array
29 29
      */
30
-    public function findBy(array $criteria = []): array;
30
+    public function findBy(array $criteria = [ ]): array;
31 31
 
32 32
     /**
33 33
      * @param array $criteria
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      *
37 37
      * @throws NotUniqueException
38 38
      */
39
-    public function findOneBy(array $criteria = []);
39
+    public function findOneBy(array $criteria = [ ]);
40 40
 
41 41
     /**
42 42
      * @param ModelInterface $model
Please login to merge, or discard this patch.
src/ModelInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Chubbyphp\Model;
6 6
 
Please login to merge, or discard this patch.
src/Exception/UnknownException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Chubbyphp\Model;
6 6
 
Please login to merge, or discard this patch.
src/Exception/AlreadyKnownException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Chubbyphp\Model;
6 6
 
Please login to merge, or discard this patch.
src/Exception/NotUniqueException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Chubbyphp\Model;
6 6
 
Please login to merge, or discard this patch.
src/AbstractDoctrineRepository.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Chubbyphp\Model;
6 6
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
         /** @var ModelInterface $modelClass */
41 41
         $modelClass = $this->getModelClass();
42 42
 
43
-        $this->logger->info('model: find model {model} with id {id}', ['model' => $modelClass, 'id' => $id]);
43
+        $this->logger->info('model: find model {model} with id {id}', [ 'model' => $modelClass, 'id' => $id ]);
44 44
 
45 45
         $qb = $this->connection->createQueryBuilder();
46 46
         $qb->select('*')->from($this->getTable())->where($qb->expr()->eq('id', ':id'))->setParameter('id', $id);
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         if (false === $row) {
50 50
             $this->logger->warning(
51 51
                 'model: model {model} with id {id} not found',
52
-                ['model' => $modelClass, 'id' => $id]
52
+                [ 'model' => $modelClass, 'id' => $id ]
53 53
             );
54 54
 
55 55
             return null;
@@ -63,14 +63,14 @@  discard block
 block discarded – undo
63 63
      *
64 64
      * @return null|ModelInterface
65 65
      */
66
-    public function findOneBy(array $criteria = [])
66
+    public function findOneBy(array $criteria = [ ])
67 67
     {
68 68
         /** @var ModelInterface $modelClass */
69 69
         $modelClass = $this->getModelClass();
70 70
 
71 71
         $this->logger->info(
72 72
             'model: find model {model} with criteria {criteria}',
73
-            ['model' => $modelClass, 'criteria' => $criteria]
73
+            [ 'model' => $modelClass, 'criteria' => $criteria ]
74 74
         );
75 75
 
76 76
         $qb = $this->getFindByQueryBuilder($criteria)->setMaxResults(1);
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         if (false === $row) {
80 80
             $this->logger->warning(
81 81
                 'model: model {model} with criteria {criteria} not found',
82
-                ['model' => $modelClass, 'criteria' => $criteria]
82
+                [ 'model' => $modelClass, 'criteria' => $criteria ]
83 83
             );
84 84
 
85 85
             return null;
@@ -93,25 +93,25 @@  discard block
 block discarded – undo
93 93
      *
94 94
      * @return ModelInterface[]|array
95 95
      */
96
-    public function findBy(array $criteria = []): array
96
+    public function findBy(array $criteria = [ ]): array
97 97
     {
98 98
         /** @var ModelInterface $modelClass */
99 99
         $modelClass = $this->getModelClass();
100 100
 
101 101
         $this->logger->info(
102 102
             'model: find model {model} with criteria {criteria}',
103
-            ['model' => $modelClass, 'criteria' => $criteria]
103
+            [ 'model' => $modelClass, 'criteria' => $criteria ]
104 104
         );
105 105
 
106 106
         $rows = $this->getFindByQueryBuilder($criteria)->execute()->fetchAll(\PDO::FETCH_ASSOC);
107 107
 
108
-        if ([] === $rows) {
109
-            return [];
108
+        if ([ ] === $rows) {
109
+            return [ ];
110 110
         }
111 111
 
112
-        $models = [];
112
+        $models = [ ];
113 113
         foreach ($rows as $row) {
114
-            $models[] = $modelClass::fromRow($row);
114
+            $models[ ] = $modelClass::fromRow($row);
115 115
         }
116 116
 
117 117
         return $models;
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
      *
123 123
      * @return QueryBuilder
124 124
      */
125
-    private function getFindByQueryBuilder(array $criteria = []): QueryBuilder
125
+    private function getFindByQueryBuilder(array $criteria = [ ]): QueryBuilder
126 126
     {
127 127
         $qb = $this->connection->createQueryBuilder();
128 128
         $qb->select('*')->from($this->getTable());
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
     {
143 143
         $this->logger->info(
144 144
             'model: insert model {model} with id {id}',
145
-            ['model' => get_class($model), 'id' => $model->getId()]
145
+            [ 'model' => get_class($model), 'id' => $model->getId() ]
146 146
         );
147 147
 
148 148
         $this->connection->insert($this->getTable(), $model->toRow());
@@ -155,10 +155,10 @@  discard block
 block discarded – undo
155 155
     {
156 156
         $this->logger->info(
157 157
             'model: update model {model} with id {id}',
158
-            ['model' => get_class($model), 'id' => $model->getId()]
158
+            [ 'model' => get_class($model), 'id' => $model->getId() ]
159 159
         );
160 160
 
161
-        $this->connection->update($this->getTable(), $model->toRow(), ['id' => $model->getId()]);
161
+        $this->connection->update($this->getTable(), $model->toRow(), [ 'id' => $model->getId() ]);
162 162
     }
163 163
 
164 164
     /**
@@ -168,10 +168,10 @@  discard block
 block discarded – undo
168 168
     {
169 169
         $this->logger->info(
170 170
             'model: delete model {model} with id {id}',
171
-            ['model' => get_class($model), 'id' => $model->getId()]
171
+            [ 'model' => get_class($model), 'id' => $model->getId() ]
172 172
         );
173 173
 
174
-        $this->connection->delete($this->getTable(), ['id' => $model->getId()]);
174
+        $this->connection->delete($this->getTable(), [ 'id' => $model->getId() ]);
175 175
     }
176 176
 
177 177
     /**
Please login to merge, or discard this patch.
src/Cache/NullModelCache.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Chubbyphp\Model;
6 6
 
Please login to merge, or discard this patch.
src/Cache/ModelCache.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Chubbyphp\Model\Cache;
6 6
 
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
     /**
12 12
      * @var ModelInterface[]|array
13 13
      */
14
-    private $cache = [];
14
+    private $cache = [ ];
15 15
 
16 16
     /**
17 17
      * @param ModelInterface $model
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
      */
21 21
     public function set(ModelInterface $model): ModelCacheInterface
22 22
     {
23
-        $this->cache[$model->getId()] = $model;
23
+        $this->cache[ $model->getId() ] = $model;
24 24
 
25 25
         return $this;
26 26
     }
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
             throw ModelNotFoundException::fromId($id);
49 49
         }
50 50
 
51
-        return $this->cache[$id];
51
+        return $this->cache[ $id ];
52 52
     }
53 53
 
54 54
     /**
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      */
59 59
     public function remove(string $id): ModelCacheInterface
60 60
     {
61
-        unset($this->cache[$id]);
61
+        unset($this->cache[ $id ]);
62 62
 
63 63
         return $this;
64 64
     }
Please login to merge, or discard this patch.
src/Cache/ModelCacheInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Chubbyphp\Model;
6 6
 
Please login to merge, or discard this patch.