Completed
Push — master ( 483f95...829c8a )
by Julien
08:25
created
src/EntityRepository.php 3 patches
Doc Comments   -2 removed lines patch added patch discarded remove patch
@@ -278,7 +278,6 @@  discard block
 block discarded – undo
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
 block discarded – undo
301 300
     /**
302 301
      * saveToCache
303 302
      *
304
-     * @param array $data
305 303
      * @access private
306 304
      * @return object
307 305
      */
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,6 @@
 block discarded – undo
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
 {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -264,7 +264,7 @@
 block discarded – undo
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
                 }
Please login to merge, or discard this patch.
Tests/Units/EntityRepository.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -125,7 +125,6 @@
 block discarded – undo
125 125
     /**
126 126
      * testFindWithCache
127 127
      *
128
-     * @param mixed $method
129 128
      * @access public
130 129
      * @return void
131 130
      */
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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')
Please login to merge, or discard this patch.
src/Model/Serializer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -195,7 +195,7 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
Tests/Units/Model/Serializer.php 2 patches
Doc Comments   +10 added lines, -6 removed lines patch added patch discarded remove patch
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
      * createNewCart
671 671
      *
672 672
      * @access private
673
-     * @return AbstractModel
673
+     * @return \Mapado\RestClientSdk\Tests\Model\Cart
674 674
      */
675 675
     private function createNewCart()
676 676
     {
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
      * createCart
690 690
      *
691 691
      * @access private
692
-     * @return void
692
+     * @return \Mapado\RestClientSdk\Tests\Model\Cart
693 693
      */
694 694
     private function createCart()
695 695
     {
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
      * createKnownCartItem
704 704
      *
705 705
      * @access private
706
-     * @return AbstractModel
706
+     * @return \Mapado\RestClientSdk\Tests\Model\CartItem
707 707
      */
708 708
     private function createKnownCartItem()
709 709
     {
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
      * createNewCartItem
725 725
      *
726 726
      * @access private
727
-     * @return AbstractModel
727
+     * @return \Mapado\RestClientSdk\Tests\Model\CartItem
728 728
      */
729 729
     private function createNewCartItem($addKnownedProduct = true)
730 730
     {
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
      * createNewProduct
748 748
      *
749 749
      * @access private
750
-     * @return AbstractModel
750
+     * @return \Mapado\RestClientSdk\Tests\Model\Product
751 751
      */
752 752
     private function createNewProduct()
753 753
     {
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
      * createKnownedProduct
765 765
      *
766 766
      * @access private
767
-     * @return AbstractModel
767
+     * @return \Mapado\RestClientSdk\Tests\Model\Product
768 768
      */
769 769
     private function createKnownedProduct()
770 770
     {
@@ -787,6 +787,7 @@  discard block
 block discarded – undo
787 787
      * createNewInstance
788 788
      *
789 789
      * @access private
790
+     * @param Mapping $mapping
790 791
      * @return void
791 792
      */
792 793
     private function createNewInstance($mapping = null)
@@ -815,6 +816,9 @@  discard block
 block discarded – undo
815 816
         $this->testedInstance->setSdk($sdk);
816 817
     }
817 818
 
819
+    /**
820
+     * @param string $modelName
821
+     */
818 822
     private function getCartRepositoryMock($sdk, $restClient, $modelName)
819 823
     {
820 824
         $repository = new \mock\Mapado\RestClientSdk\EntityRepository(
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
                 ->array($data = $this->testedInstance->serialize(
76 76
                     $cart,
77 77
                     'Mapado\RestClientSdk\Tests\Model\Cart',
78
-                    [ 'serializeRelations' => ['cart_items'] ]
78
+                    ['serializeRelations' => ['cart_items']]
79 79
                 ))
80 80
                     ->isIdenticalTo([
81 81
                         '@id' => '/v1/carts/8',
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
                 ->array($data = $this->testedInstance->serialize(
104 104
                     $cart,
105 105
                     'Mapado\RestClientSdk\Tests\Model\Cart',
106
-                    [ 'serializeRelations' => ['cart_items'] ]
106
+                    ['serializeRelations' => ['cart_items']]
107 107
                 ))
108 108
                     ->isIdenticalTo([
109 109
                         '@id' => '/v1/carts/8',
@@ -245,8 +245,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
275 275
                 ->array($data = $this->testedInstance->serialize(
276 276
                     $cart,
277 277
                     'Mapado\RestClientSdk\Tests\Model\Cart',
278
-                    [ 'serializeRelations' => ['cart_items'] ]
278
+                    ['serializeRelations' => ['cart_items']]
279 279
                 ))
280 280
                     ->isIdenticalTo([
281 281
                         '@id' => '/v1/carts/8',
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
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')
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
                 ->array($data = $this->testedInstance->serialize(
514 514
                     $cart,
515 515
                     'Mapado\RestClientSdk\Tests\Model\Cart',
516
-                    [ 'serializeRelations' => ['cart_items'] ]
516
+                    ['serializeRelations' => ['cart_items']]
517 517
                 ))
518 518
                     ->isIdenticalTo([
519 519
                         'weirdId' => '/v1/carts/8',
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
                 ->array($data = $this->testedInstance->serialize(
542 542
                     $cart,
543 543
                     'Mapado\RestClientSdk\Tests\Model\Cart',
544
-                    [ 'serializeRelations' => ['cart_items'] ]
544
+                    ['serializeRelations' => ['cart_items']]
545 545
                 ))
546 546
                     ->isIdenticalTo([
547 547
                         'weirdId' => '/v1/carts/8',
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
 
804 804
         $cartRepositoryMock = $this->getCartRepositoryMock($sdk, $restClient, 'Mapado\RestClientSdk\Tests\Model\Cart');
805 805
 
806
-        $this->calling($sdk)->getRepository = function ($modelName) use ($cartRepositoryMock) {
806
+        $this->calling($sdk)->getRepository = function($modelName) use ($cartRepositoryMock) {
807 807
             switch ($modelName) {
808 808
                 case 'Mapado\RestClientSdk\Tests\Model\Cart':
809 809
                     return $cartRepositoryMock;
@@ -825,7 +825,7 @@  discard block
 block discarded – undo
825 825
 
826 826
         $_this = $this;
827 827
 
828
-        $this->calling($repository)->find = function ($id) use ($_this) {
828
+        $this->calling($repository)->find = function($id) use ($_this) {
829 829
             return $_this->createCart();
830 830
         };
831 831
 
Please login to merge, or discard this patch.