@@ -278,7 +278,6 @@ discard block |
||
278 | 278 | /** |
279 | 279 | * fetchFromCache |
280 | 280 | * |
281 | - * @param array $data |
|
282 | 281 | * @access private |
283 | 282 | * @return object |
284 | 283 | */ |
@@ -301,7 +300,6 @@ discard block |
||
301 | 300 | /** |
302 | 301 | * saveToCache |
303 | 302 | * |
304 | - * @param array $data |
|
305 | 303 | * @access private |
306 | 304 | * @return object |
307 | 305 | */ |
@@ -2,7 +2,6 @@ |
||
2 | 2 | namespace Mapado\RestClientSdk; |
3 | 3 | |
4 | 4 | use Mapado\RestClientSdk\Exception\SdkException; |
5 | -use Symfony\Component\Cache\CacheItem; |
|
6 | 5 | |
7 | 6 | class EntityRepository |
8 | 7 | { |
@@ -264,7 +264,7 @@ |
||
264 | 264 | $sdk = $this->sdk; |
265 | 265 | |
266 | 266 | return array_map( |
267 | - function ($item) use ($sdk) { |
|
267 | + function($item) use ($sdk) { |
|
268 | 268 | if (is_object($item) && method_exists($item, 'getId')) { |
269 | 269 | return $item->getId(); |
270 | 270 | } |
@@ -125,7 +125,6 @@ |
||
125 | 125 | /** |
126 | 126 | * testFindWithCache |
127 | 127 | * |
128 | - * @param mixed $method |
|
129 | 128 | * @access public |
130 | 129 | * @return void |
131 | 130 | */ |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $this->calling($this->mockedRestClient)->get = []; |
115 | 115 | |
116 | 116 | $this |
117 | - ->if($this->repository->find('1', [ 'foo' => 'bar', 'bar' => 'baz' ])) |
|
117 | + ->if($this->repository->find('1', ['foo' => 'bar', 'bar' => 'baz'])) |
|
118 | 118 | ->then |
119 | 119 | ->mock($this->mockedRestClient) |
120 | 120 | ->call('get') |
@@ -177,8 +177,8 @@ discard block |
||
177 | 177 | ->given($this->resetMock($this->mockedRestClient)) |
178 | 178 | ->and($this->mockedSdk->getCacheItemPool()->clear()) |
179 | 179 | |
180 | - ->if($this->repository->findBy([ 'foo' => 'bar', 'bar' => 'baz' ])) |
|
181 | - ->and($this->repository->findBy([ 'foo' => 'bar', 'bar' => 'baz' ])) |
|
180 | + ->if($this->repository->findBy(['foo' => 'bar', 'bar' => 'baz'])) |
|
181 | + ->and($this->repository->findBy(['foo' => 'bar', 'bar' => 'baz'])) |
|
182 | 182 | ->if($this->repository->find(1)) |
183 | 183 | ->then |
184 | 184 | ->mock($this->mockedRestClient) |
@@ -203,8 +203,8 @@ discard block |
||
203 | 203 | // find one by |
204 | 204 | ->given($this->resetMock($this->mockedRestClient)) |
205 | 205 | |
206 | - ->if($this->repository->findOneBy([ 'foo' => 'baz', 'bar' => 'bar' ])) |
|
207 | - ->and($this->repository->findOneBy([ 'foo' => 'baz', 'bar' => 'bar' ])) |
|
206 | + ->if($this->repository->findOneBy(['foo' => 'baz', 'bar' => 'bar'])) |
|
207 | + ->and($this->repository->findOneBy(['foo' => 'baz', 'bar' => 'bar'])) |
|
208 | 208 | ->then |
209 | 209 | ->mock($this->mockedRestClient) |
210 | 210 | ->call('get') |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | |
223 | 223 | // find one by with data already in cache |
224 | 224 | ->given($this->resetMock($this->mockedRestClient)) |
225 | - ->if($this->repository->findOneBy([ 'foo' => 'bar', 'bar' => 'baz' ])) |
|
225 | + ->if($this->repository->findOneBy(['foo' => 'bar', 'bar' => 'baz'])) |
|
226 | 226 | ->then |
227 | 227 | ->mock($this->mockedRestClient) |
228 | 228 | ->call('get') |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | * createNewCart |
579 | 579 | * |
580 | 580 | * @access private |
581 | - * @return AbstractModel |
|
581 | + * @return \Mapado\RestClientSdk\Tests\Model\Cart |
|
582 | 582 | */ |
583 | 583 | private function createNewCart() |
584 | 584 | { |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | * createCart |
598 | 598 | * |
599 | 599 | * @access private |
600 | - * @return void |
|
600 | + * @return \Mapado\RestClientSdk\Tests\Model\Cart |
|
601 | 601 | */ |
602 | 602 | private function createCart() |
603 | 603 | { |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | * createKnownCartItem |
612 | 612 | * |
613 | 613 | * @access private |
614 | - * @return AbstractModel |
|
614 | + * @return \Mapado\RestClientSdk\Tests\Model\CartItem |
|
615 | 615 | */ |
616 | 616 | private function createKnownCartItem() |
617 | 617 | { |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | * createNewCartItem |
633 | 633 | * |
634 | 634 | * @access private |
635 | - * @return AbstractModel |
|
635 | + * @return \Mapado\RestClientSdk\Tests\Model\CartItem |
|
636 | 636 | */ |
637 | 637 | private function createNewCartItem($addKnownedProduct = true) |
638 | 638 | { |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | * createNewProduct |
656 | 656 | * |
657 | 657 | * @access private |
658 | - * @return AbstractModel |
|
658 | + * @return \Mapado\RestClientSdk\Tests\Model\Product |
|
659 | 659 | */ |
660 | 660 | private function createNewProduct() |
661 | 661 | { |
@@ -672,7 +672,7 @@ discard block |
||
672 | 672 | * createKnownedProduct |
673 | 673 | * |
674 | 674 | * @access private |
675 | - * @return AbstractModel |
|
675 | + * @return \Mapado\RestClientSdk\Tests\Model\Product |
|
676 | 676 | */ |
677 | 677 | private function createKnownedProduct() |
678 | 678 | { |
@@ -721,6 +721,9 @@ discard block |
||
721 | 721 | $this->testedInstance->setSdk($sdk); |
722 | 722 | } |
723 | 723 | |
724 | + /** |
|
725 | + * @param string $modelName |
|
726 | + */ |
|
724 | 727 | private function getCartRepositoryMock($sdk, $restClient, $modelName) |
725 | 728 | { |
726 | 729 | $repository = new \mock\Mapado\RestClientSdk\EntityRepository( |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | ->array($data = $this->testedInstance->serialize( |
76 | 76 | $cart, |
77 | 77 | 'Mapado\RestClientSdk\Tests\Model\Cart', |
78 | - [ 'serializeRelations' => ['cartItemList'] ] |
|
78 | + ['serializeRelations' => ['cartItemList']] |
|
79 | 79 | )) |
80 | 80 | ->isIdenticalTo([ |
81 | 81 | '@id' => '/v1/carts/8', |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | ->array($data = $this->testedInstance->serialize( |
104 | 104 | $cart, |
105 | 105 | 'Mapado\RestClientSdk\Tests\Model\Cart', |
106 | - [ 'serializeRelations' => ['cartItemList'] ] |
|
106 | + ['serializeRelations' => ['cartItemList']] |
|
107 | 107 | )) |
108 | 108 | ->isIdenticalTo([ |
109 | 109 | '@id' => '/v1/carts/8', |
@@ -245,8 +245,8 @@ discard block |
||
245 | 245 | 'who' => 'John', |
246 | 246 | ], |
247 | 247 | 'cartItemDetailList' => [ |
248 | - [ 'name' => 'Bill' ], |
|
249 | - [ 'name' => 'Bill', ], |
|
248 | + ['name' => 'Bill'], |
|
249 | + ['name' => 'Bill', ], |
|
250 | 250 | ], |
251 | 251 | ], |
252 | 252 | ], |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | ->array($data = $this->testedInstance->serialize( |
276 | 276 | $cart, |
277 | 277 | 'Mapado\RestClientSdk\Tests\Model\Cart', |
278 | - [ 'serializeRelations' => ['cartItemList'] ] |
|
278 | + ['serializeRelations' => ['cartItemList']] |
|
279 | 279 | )) |
280 | 280 | ->isIdenticalTo([ |
281 | 281 | '@id' => '/v1/carts/8', |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | ->then |
339 | 339 | ->object($cartItemDetail->getCartItem()) |
340 | 340 | ->isInstanceOf('Mapado\RestClientSdk\Tests\Model\CartItem') |
341 | - ->exception(function () use ($testedInstance, $cartItemDetail) { |
|
341 | + ->exception(function() use ($testedInstance, $cartItemDetail) { |
|
342 | 342 | $testedInstance->serialize($cartItemDetail, 'Mapado\RestClientSdk\Tests\Model\CartItemDetail'); |
343 | 343 | }) |
344 | 344 | ->isInstanceOf('Mapado\RestClientSdk\Exception\SdkException') |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | |
710 | 710 | $cartRepositoryMock = $this->getCartRepositoryMock($sdk, $restClient, 'Mapado\RestClientSdk\Tests\Model\Cart'); |
711 | 711 | |
712 | - $this->calling($sdk)->getRepository = function ($modelName) use ($cartRepositoryMock) { |
|
712 | + $this->calling($sdk)->getRepository = function($modelName) use ($cartRepositoryMock) { |
|
713 | 713 | switch ($modelName) { |
714 | 714 | case 'Mapado\RestClientSdk\Tests\Model\Cart': |
715 | 715 | return $cartRepositoryMock; |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | |
732 | 732 | $_this = $this; |
733 | 733 | |
734 | - $this->calling($repository)->find = function ($id) use ($_this) { |
|
734 | + $this->calling($repository)->find = function($id) use ($_this) { |
|
735 | 735 | return $_this->createCart(); |
736 | 736 | }; |
737 | 737 |
@@ -195,7 +195,7 @@ |
||
195 | 195 | $item, |
196 | 196 | $relation->getTargetEntity(), |
197 | 197 | $level + 1, |
198 | - [ 'serializeRelation' => $serializeRelation ] |
|
198 | + ['serializeRelation' => $serializeRelation] |
|
199 | 199 | ); |
200 | 200 | } else { |
201 | 201 | $newData[$key] = $item; |