@@ -77,9 +77,9 @@ |
||
| 77 | 77 | */ |
| 78 | 78 | public function serializeList(Entry ...$entries) : array |
| 79 | 79 | { |
| 80 | - $result = []; |
|
| 80 | + $result = [ ]; |
|
| 81 | 81 | foreach ($entries as $entry) { |
| 82 | - $result[] = $this->serialize($entry); |
|
| 82 | + $result[ ] = $this->serialize($entry); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | return $result; |
@@ -35,10 +35,10 @@ discard block |
||
| 35 | 35 | $entryManager = $container->get('entryManager'); |
| 36 | 36 | $this->assertSame(0, $entryManager->countAll()); |
| 37 | 37 | |
| 38 | - $entryManager->create(['name' => 'foo', 'slug' => 'foo']); |
|
| 38 | + $entryManager->create([ 'name' => 'foo', 'slug' => 'foo' ]); |
|
| 39 | 39 | $this->assertSame(1, $entryManager->countAll()); |
| 40 | 40 | |
| 41 | - $entryManager->create(['name' => 'bar', 'slug' => 'bar']); |
|
| 41 | + $entryManager->create([ 'name' => 'bar', 'slug' => 'bar' ]); |
|
| 42 | 42 | $this->assertSame(2, $entryManager->countAll()); |
| 43 | 43 | } |
| 44 | 44 | |
@@ -60,26 +60,26 @@ discard block |
||
| 60 | 60 | $this->assertSame(0, $entryManager->countAll()); |
| 61 | 61 | |
| 62 | 62 | $entries = $entryManager->getList(null, null); |
| 63 | - $this->assertSame([], $entries); |
|
| 63 | + $this->assertSame([ ], $entries); |
|
| 64 | 64 | |
| 65 | - $foo = $entryManager->create(['name' => 'foo', 'slug' => 'foo']); |
|
| 65 | + $foo = $entryManager->create([ 'name' => 'foo', 'slug' => 'foo' ]); |
|
| 66 | 66 | $entries = $entryManager->getList(null, null); |
| 67 | 67 | $this->assertCount(1, $entries); |
| 68 | - $this->assertSame($foo->getId()->toString(), (string) $entries[0]->getId()); |
|
| 68 | + $this->assertSame($foo->getId()->toString(), (string) $entries[ 0 ]->getId()); |
|
| 69 | 69 | |
| 70 | - $bar = $entryManager->create(['name' => 'bar', 'slug' => 'bar']); |
|
| 70 | + $bar = $entryManager->create([ 'name' => 'bar', 'slug' => 'bar' ]); |
|
| 71 | 71 | $entries = $entryManager->getList(null, null); |
| 72 | 72 | $this->assertCount(2, $entries); |
| 73 | - $this->assertSame($bar->getId()->toString(), (string) $entries[0]->getId()); |
|
| 74 | - $this->assertSame($foo->getId()->toString(), (string) $entries[1]->getId()); |
|
| 73 | + $this->assertSame($bar->getId()->toString(), (string) $entries[ 0 ]->getId()); |
|
| 74 | + $this->assertSame($foo->getId()->toString(), (string) $entries[ 1 ]->getId()); |
|
| 75 | 75 | |
| 76 | 76 | $entries = $entryManager->getList(1, null); |
| 77 | 77 | $this->assertCount(1, $entries); |
| 78 | - $this->assertSame($bar->getId()->toString(), (string) $entries[0]->getId()); |
|
| 78 | + $this->assertSame($bar->getId()->toString(), (string) $entries[ 0 ]->getId()); |
|
| 79 | 79 | |
| 80 | 80 | $entries = $entryManager->getList(null, 1); |
| 81 | 81 | $this->assertCount(1, $entries); |
| 82 | - $this->assertSame($foo->getId()->toString(), (string) $entries[0]->getId()); |
|
| 82 | + $this->assertSame($foo->getId()->toString(), (string) $entries[ 0 ]->getId()); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /** |
@@ -99,8 +99,8 @@ discard block |
||
| 99 | 99 | // the database MUST be empty... |
| 100 | 100 | $this->assertSame(0, $entryManager->countAll()); |
| 101 | 101 | |
| 102 | - $foo = $entryManager->create(['name' => 'foo', 'slug' => 'foo']); |
|
| 103 | - $bar = $entryManager->create(['name' => 'bar', 'slug' => 'bar']); |
|
| 102 | + $foo = $entryManager->create([ 'name' => 'foo', 'slug' => 'foo' ]); |
|
| 103 | + $bar = $entryManager->create([ 'name' => 'bar', 'slug' => 'bar' ]); |
|
| 104 | 104 | |
| 105 | 105 | $found = $entryManager->findById($foo->getId()->toString()); |
| 106 | 106 | $this->assertSame($foo->getId()->toString(), (string) $found->getId()); |
@@ -129,12 +129,12 @@ discard block |
||
| 129 | 129 | // the database MUST be empty... |
| 130 | 130 | $this->assertSame(0, $entryManager->countAll()); |
| 131 | 131 | |
| 132 | - $foo = $entryManager->create(['name' => 'foo', 'slug' => 'foo']); |
|
| 132 | + $foo = $entryManager->create([ 'name' => 'foo', 'slug' => 'foo' ]); |
|
| 133 | 133 | $found = $entryManager->findById($foo->getId()->toString()); |
| 134 | 134 | $this->assertSame('foo', $found->getName()); |
| 135 | 135 | $this->assertSame('foo', $found->getSlug()); |
| 136 | 136 | |
| 137 | - $bar = $entryManager->create(['name' => 'bar', 'slug' => 'bar']); |
|
| 137 | + $bar = $entryManager->create([ 'name' => 'bar', 'slug' => 'bar' ]); |
|
| 138 | 138 | $found = $entryManager->findById($bar->getId()->toString()); |
| 139 | 139 | $this->assertSame('bar', $found->getName()); |
| 140 | 140 | $this->assertSame('bar', $found->getSlug()); |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | $this->assertSame(0, $entryManager->countAll()); |
| 159 | 159 | |
| 160 | 160 | $this->expectException(InvalidEntityException::class); |
| 161 | - $entryManager->create(['name' => '', 'slug' => 'foo']); |
|
| 161 | + $entryManager->create([ 'name' => '', 'slug' => 'foo' ]); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | /** |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | $this->assertSame(0, $entryManager->countAll()); |
| 180 | 180 | |
| 181 | 181 | $this->expectException(InvalidEntityException::class); |
| 182 | - $entryManager->create(['name' => 'foo', 'slug' => '']); |
|
| 182 | + $entryManager->create([ 'name' => 'foo', 'slug' => '' ]); |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | /** |
@@ -199,10 +199,10 @@ discard block |
||
| 199 | 199 | // the database MUST be empty... |
| 200 | 200 | $this->assertSame(0, $entryManager->countAll()); |
| 201 | 201 | |
| 202 | - $entryManager->create(['name' => 'foo', 'slug' => 'foo']); |
|
| 202 | + $entryManager->create([ 'name' => 'foo', 'slug' => 'foo' ]); |
|
| 203 | 203 | |
| 204 | 204 | $this->expectException(InvalidEntityException::class); |
| 205 | - $entryManager->create(['name' => 'bar', 'slug' => 'foo']); |
|
| 205 | + $entryManager->create([ 'name' => 'bar', 'slug' => 'foo' ]); |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | /** |
@@ -222,8 +222,8 @@ discard block |
||
| 222 | 222 | // the database MUST be empty... |
| 223 | 223 | $this->assertSame(0, $entryManager->countAll()); |
| 224 | 224 | |
| 225 | - $foo = $entryManager->create(['name' => 'foo', 'slug' => 'foo']); |
|
| 226 | - $entryManager->update($foo, ['name' => 'bar', 'slug' => 'bar']); |
|
| 225 | + $foo = $entryManager->create([ 'name' => 'foo', 'slug' => 'foo' ]); |
|
| 226 | + $entryManager->update($foo, [ 'name' => 'bar', 'slug' => 'bar' ]); |
|
| 227 | 227 | $found = $entryManager->findById($foo->getId()->toString()); |
| 228 | 228 | |
| 229 | 229 | $this->assertSame('bar', $found->getName()); |
@@ -247,10 +247,10 @@ discard block |
||
| 247 | 247 | // the database MUST be empty... |
| 248 | 248 | $this->assertSame(0, $entryManager->countAll()); |
| 249 | 249 | |
| 250 | - $foo = $entryManager->create(['name' => 'foo', 'slug' => 'foo']); |
|
| 250 | + $foo = $entryManager->create([ 'name' => 'foo', 'slug' => 'foo' ]); |
|
| 251 | 251 | |
| 252 | 252 | $this->expectException(InvalidEntityException::class); |
| 253 | - $entryManager->update($foo, ['name' => '', 'slug' => 'bar']); |
|
| 253 | + $entryManager->update($foo, [ 'name' => '', 'slug' => 'bar' ]); |
|
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | /** |
@@ -270,10 +270,10 @@ discard block |
||
| 270 | 270 | // the database MUST be empty... |
| 271 | 271 | $this->assertSame(0, $entryManager->countAll()); |
| 272 | 272 | |
| 273 | - $foo = $entryManager->create(['name' => 'foo', 'slug' => 'foo']); |
|
| 273 | + $foo = $entryManager->create([ 'name' => 'foo', 'slug' => 'foo' ]); |
|
| 274 | 274 | |
| 275 | 275 | $this->expectException(InvalidEntityException::class); |
| 276 | - $entryManager->update($foo, ['name' => 'bar', 'slug' => '']); |
|
| 276 | + $entryManager->update($foo, [ 'name' => 'bar', 'slug' => '' ]); |
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | /** |
@@ -293,11 +293,11 @@ discard block |
||
| 293 | 293 | // the database MUST be empty... |
| 294 | 294 | $this->assertSame(0, $entryManager->countAll()); |
| 295 | 295 | |
| 296 | - $foo = $entryManager->create(['name' => 'foo', 'slug' => 'foo']); |
|
| 297 | - $bar = $entryManager->create(['name' => 'bar', 'slug' => 'bar']); |
|
| 296 | + $foo = $entryManager->create([ 'name' => 'foo', 'slug' => 'foo' ]); |
|
| 297 | + $bar = $entryManager->create([ 'name' => 'bar', 'slug' => 'bar' ]); |
|
| 298 | 298 | |
| 299 | 299 | $this->expectException(InvalidEntityException::class); |
| 300 | - $entryManager->update($foo, ['name' => 'baz', 'slug' => 'bar']); |
|
| 300 | + $entryManager->update($foo, [ 'name' => 'baz', 'slug' => 'bar' ]); |
|
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | /** |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | // the database MUST be empty... |
| 318 | 318 | $this->assertSame(0, $entryManager->countAll()); |
| 319 | 319 | |
| 320 | - $foo = $entryManager->create(['name' => 'foo', 'slug' => 'foo']); |
|
| 320 | + $foo = $entryManager->create([ 'name' => 'foo', 'slug' => 'foo' ]); |
|
| 321 | 321 | $entryManager->delete($foo); |
| 322 | 322 | |
| 323 | 323 | $this->expectException(EntityNotFoundException::class); |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | $entryManager = $container->get('entryManager'); |
| 45 | 45 | $this->assertSame(0, $entryManager->countAll()); |
| 46 | 46 | |
| 47 | - $entry = $entryManager->create(['name' => 'foo', 'slug' => 'foo']); |
|
| 47 | + $entry = $entryManager->create([ 'name' => 'foo', 'slug' => 'foo' ]); |
|
| 48 | 48 | |
| 49 | 49 | $request = (new ServerRequestFactory) |
| 50 | 50 | ->createServerRequest('PATCH', '/api/v1/entry/' . $entry->getId()->toString()) |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | $entryManager = $container->get('entryManager'); |
| 117 | 117 | $this->assertSame(0, $entryManager->countAll()); |
| 118 | 118 | |
| 119 | - $entry = $entryManager->create(['name' => 'foo', 'slug' => 'foo']); |
|
| 119 | + $entry = $entryManager->create([ 'name' => 'foo', 'slug' => 'foo' ]); |
|
| 120 | 120 | |
| 121 | 121 | $request = (new ServerRequestFactory) |
| 122 | 122 | ->createServerRequest('PATCH', '/api/v1/entry/' . $entry->getId()->toString()) |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | $entryManager = $container->get('entryManager'); |
| 151 | 151 | $this->assertSame(0, $entryManager->countAll()); |
| 152 | 152 | |
| 153 | - $entry = $entryManager->create(['name' => 'foo', 'slug' => 'foo']); |
|
| 153 | + $entry = $entryManager->create([ 'name' => 'foo', 'slug' => 'foo' ]); |
|
| 154 | 154 | |
| 155 | 155 | $request = (new ServerRequestFactory) |
| 156 | 156 | ->createServerRequest('PATCH', '/api/v1/entry/' . $entry->getId()->toString()) |
@@ -184,8 +184,8 @@ discard block |
||
| 184 | 184 | $entryManager = $container->get('entryManager'); |
| 185 | 185 | $this->assertSame(0, $entryManager->countAll()); |
| 186 | 186 | |
| 187 | - $entry = $entryManager->create(['name' => 'foo', 'slug' => 'foo']); |
|
| 188 | - $entryManager->create(['name' => 'bar', 'slug' => 'bar']); |
|
| 187 | + $entry = $entryManager->create([ 'name' => 'foo', 'slug' => 'foo' ]); |
|
| 188 | + $entryManager->create([ 'name' => 'bar', 'slug' => 'bar' ]); |
|
| 189 | 189 | |
| 190 | 190 | $request = (new ServerRequestFactory) |
| 191 | 191 | ->createServerRequest('PATCH', '/api/v1/entry/' . $entry->getId()->toString()) |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | ->createServerRequest('PATCH', '/api/v1/entry/e3f4f8bd-d455-4e67-86d5-ab6c9683bdd7') |
| 217 | 217 | ->withAttribute('entryId', 'e3f4f8bd-d455-4e67-86d5-ab6c9683bdd7') |
| 218 | 218 | ->withHeader('Content-Type', 'application/json') |
| 219 | - ->withParsedBody([null]); |
|
| 219 | + ->withParsedBody([ null ]); |
|
| 220 | 220 | |
| 221 | 221 | $this->expectException(BadRequestException::class); |
| 222 | 222 | |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | $entryManager = $container->get('entryManager'); |
| 43 | 43 | $this->assertSame(0, $entryManager->countAll()); |
| 44 | 44 | |
| 45 | - $entryManager->create(['name' => 'foo', 'slug' => 'foo']); |
|
| 46 | - $entryManager->create(['name' => 'bar', 'slug' => 'bar']); |
|
| 45 | + $entryManager->create([ 'name' => 'foo', 'slug' => 'foo' ]); |
|
| 46 | + $entryManager->create([ 'name' => 'bar', 'slug' => 'bar' ]); |
|
| 47 | 47 | |
| 48 | 48 | $request = (new ServerRequestFactory) |
| 49 | 49 | ->createServerRequest('GET', '/api/v1/entry'); |
@@ -116,11 +116,11 @@ discard block |
||
| 116 | 116 | public function invalidLimitProvider() : array |
| 117 | 117 | { |
| 118 | 118 | return [ |
| 119 | - [null], |
|
| 120 | - [[]], |
|
| 121 | - ['-1'], |
|
| 122 | - ['0'], |
|
| 123 | - ['foo'], |
|
| 119 | + [ null ], |
|
| 120 | + [ [ ] ], |
|
| 121 | + [ '-1' ], |
|
| 122 | + [ '0' ], |
|
| 123 | + [ 'foo' ], |
|
| 124 | 124 | ]; |
| 125 | 125 | } |
| 126 | 126 | |
@@ -156,10 +156,10 @@ discard block |
||
| 156 | 156 | public function invalidOffsetProvider() : array |
| 157 | 157 | { |
| 158 | 158 | return [ |
| 159 | - [null], |
|
| 160 | - [[]], |
|
| 161 | - ['-1'], |
|
| 162 | - ['foo'], |
|
| 159 | + [ null ], |
|
| 160 | + [ [ ] ], |
|
| 161 | + [ '-1' ], |
|
| 162 | + [ 'foo' ], |
|
| 163 | 163 | ]; |
| 164 | 164 | } |
| 165 | 165 | } |
@@ -59,8 +59,8 @@ discard block |
||
| 59 | 59 | $this->assertSame(1, $entryManager->countAll()); |
| 60 | 60 | |
| 61 | 61 | $entries = $entryManager->getList(null, null); |
| 62 | - $this->assertSame('foo', $entries[0]->getName()); |
|
| 63 | - $this->assertSame('bar', $entries[0]->getSlug()); |
|
| 62 | + $this->assertSame('foo', $entries[ 0 ]->getName()); |
|
| 63 | + $this->assertSame('bar', $entries[ 0 ]->getSlug()); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | $this->assertSame(0, $entryManager->countAll()); |
| 143 | 143 | |
| 144 | 144 | // reserving the `foo` slug... |
| 145 | - $entryManager->create(['name' => 'foo', 'slug' => 'foo']); |
|
| 145 | + $entryManager->create([ 'name' => 'foo', 'slug' => 'foo' ]); |
|
| 146 | 146 | |
| 147 | 147 | $request = (new ServerRequestFactory) |
| 148 | 148 | ->createServerRequest('POST', '/api/v1/entry') |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | $request = (new ServerRequestFactory) |
| 172 | 172 | ->createServerRequest('POST', '/api/v1/entry') |
| 173 | 173 | ->withHeader('Content-Type', 'application/json') |
| 174 | - ->withParsedBody([null]); |
|
| 174 | + ->withParsedBody([ null ]); |
|
| 175 | 175 | |
| 176 | 176 | $this->expectException(BadRequestException::class); |
| 177 | 177 | |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | $entryManager = $container->get('entryManager'); |
| 41 | 41 | $this->assertSame(0, $entryManager->countAll()); |
| 42 | 42 | |
| 43 | - $entry = $entryManager->create(['name' => 'foo', 'slug' => 'foo']); |
|
| 43 | + $entry = $entryManager->create([ 'name' => 'foo', 'slug' => 'foo' ]); |
|
| 44 | 44 | $this->assertSame(1, $entryManager->countAll()); |
| 45 | 45 | |
| 46 | 46 | $request = (new ServerRequestFactory) |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | $entryManager = $container->get('entryManager'); |
| 43 | 43 | $this->assertSame(0, $entryManager->countAll()); |
| 44 | 44 | |
| 45 | - $entry = $entryManager->create(['name' => 'foo', 'slug' => 'foo']); |
|
| 45 | + $entry = $entryManager->create([ 'name' => 'foo', 'slug' => 'foo' ]); |
|
| 46 | 46 | |
| 47 | 47 | $request = (new ServerRequestFactory) |
| 48 | 48 | ->createServerRequest('GET', '/api/v1/entry/' . $entry->getId()->toString()) |
@@ -83,12 +83,12 @@ |
||
| 83 | 83 | $limit = 10; |
| 84 | 84 | $offset = 0; |
| 85 | 85 | |
| 86 | - if (isset($q['limit'])) { |
|
| 87 | - $limit = (int) $q['limit']; |
|
| 86 | + if (isset($q[ 'limit' ])) { |
|
| 87 | + $limit = (int) $q[ 'limit' ]; |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - if (isset($q['offset'])) { |
|
| 91 | - $offset = (int) $q['offset']; |
|
| 90 | + if (isset($q[ 'offset' ])) { |
|
| 91 | + $offset = (int) $q[ 'offset' ]; |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | $entries = $this->container->get('entryManager')->getList($limit, $offset); |
@@ -84,6 +84,6 @@ |
||
| 84 | 84 | { |
| 85 | 85 | $entry = $this->container->get('entryManager')->create($request->getParsedBody()); |
| 86 | 86 | |
| 87 | - return $this->ok($this->container->get('entrySerializer')->serialize($entry), [], 201); |
|
| 87 | + return $this->ok($this->container->get('entrySerializer')->serialize($entry), [ ], 201); |
|
| 88 | 88 | } |
| 89 | 89 | } |