Completed
Pull Request — master (#14)
by Pavel
04:42
created
Proxy/ApiCollection.php 2 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -188,6 +188,9 @@  discard block
 block discarded – undo
188 188
         return $this->snapshot;
189 189
     }
190 190
 
191
+    /**
192
+     * @param boolean $state
193
+     */
191 194
     public function setInitialized($state)
192 195
     {
193 196
         $this->initialized = (bool)$state;
@@ -452,7 +455,7 @@  discard block
 block discarded – undo
452 455
      * Internal note: Tried to implement Serializable first but that did not work well
453 456
      *                with circular references. This solution seems simpler and works well.
454 457
      *
455
-     * @return array
458
+     * @return string[]
456 459
      */
457 460
     public function __sleep()
458 461
     {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
         return array_udiff_assoc(
205 205
             $this->snapshot,
206 206
             $this->collection->toArray(),
207
-            function ($a, $b) {
207
+            function($a, $b) {
208 208
                 return $a === $b ? 0 : 1;
209 209
             }
210 210
         );
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
         return array_udiff_assoc(
222 222
             $this->collection->toArray(),
223 223
             $this->snapshot,
224
-            function ($a, $b) {
224
+            function($a, $b) {
225 225
                 return $a === $b ? 0 : 1;
226 226
             }
227 227
         );
Please login to merge, or discard this patch.
Tests/AbstractEntityManagerTest.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
     private $clients = [];
29 29
 
30 30
     /**
31
-     * @return mixed
31
+     * @return ClientRegistryInterface
32 32
      */
33 33
     public function getRegistry()
34 34
     {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -101,14 +101,14 @@
 block discarded – undo
101 101
         $configuration->setRegistry($this->registry);
102 102
         $configuration->setTypeRegistry(new BaseTypeRegistry(new TypeRegistry()));
103 103
         $configuration->setResolver(new ConstructorFactoryResolver());
104
-        $configuration->setProxyDir(CACHE_DIR.'/doctrine/proxy/');
104
+        $configuration->setProxyDir(CACHE_DIR . '/doctrine/proxy/');
105 105
         $configuration->setProxyNamespace('Bankiru\Api\Doctrine\Test\Proxy');
106 106
         $driver = new MappingDriverChain();
107 107
         $driver->addDriver(
108 108
             new YmlMetadataDriver(
109 109
                 new SymfonyFileLocator(
110 110
                     [
111
-                        __DIR__.'/../Test/Resources/config/api/' => 'Bankiru\Api\Doctrine\Test\Entity',
111
+                        __DIR__ . '/../Test/Resources/config/api/' => 'Bankiru\Api\Doctrine\Test\Entity',
112 112
                     ],
113 113
                     '.api.yml',
114 114
                     DIRECTORY_SEPARATOR
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,6 @@
 block discarded – undo
13 13
 use Bankiru\Api\Doctrine\EntityManager;
14 14
 use Bankiru\Api\Doctrine\EntityMetadataFactory;
15 15
 use Bankiru\Api\Doctrine\Mapping\Driver\YmlMetadataDriver;
16
-use Bankiru\Api\Doctrine\Test\TestApiFactory;
17 16
 use Bankiru\Api\Doctrine\Type\BaseTypeRegistry;
18 17
 use Bankiru\Api\Doctrine\Type\TypeRegistry;
19 18
 use Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain;
Please login to merge, or discard this patch.
Cache/KeyStrategyInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,5 +24,5 @@
 block discarded – undo
24 24
      *
25 25
      * @return string
26 26
      */
27
-    public function getEntityKey(ApiMetadata $metadata,array $identifier);
27
+    public function getEntityKey(ApiMetadata $metadata, array $identifier);
28 28
 }
Please login to merge, or discard this patch.
Rpc/SearchArgumentsTransformer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
                 /** @var EntityMetadata $target */
45 45
                 $target = $this->manager->getClassMetadata($mapping['target']);
46 46
 
47
-                $converter = function ($value) use ($target) {
47
+                $converter = function($value) use ($target) {
48 48
                     if (!is_object($value)) {
49 49
                         return $value;
50 50
                     }
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
                     $values = $converter($values);
71 71
                 }
72 72
             } else {
73
-                $caster = function ($value) use ($field) {
73
+                $caster = function($value) use ($field) {
74 74
                     $type = $this->manager
75 75
                         ->getConfiguration()
76 76
                         ->getTypeRegistry()->get($this->metadata->getTypeOfField($field));
Please login to merge, or discard this patch.
Tests/EntityFactoryTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
                     'payload' => 'test-payload',
22 22
                 ]
23 23
             ),
24
-            function (RpcRequestInterface $request) {
24
+            function(RpcRequestInterface $request) {
25 25
                 self::assertEquals('test-entity/find', $request->getMethod());
26 26
                 self::assertEquals(['id' => 1], $request->getParameters());
27 27
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
                     'sub-payload' => 'sub-payload',
51 51
                 ]
52 52
             ),
53
-            function (RpcRequestInterface $request) {
53
+            function(RpcRequestInterface $request) {
54 54
                 self::assertEquals('test-entity/find', $request->getMethod());
55 55
                 self::assertEquals(['id' => 2], $request->getParameters());
56 56
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
                     'payload'    => 'test-payload',
80 80
                 ]
81 81
             ),
82
-            function (RpcRequestInterface $request) {
82
+            function(RpcRequestInterface $request) {
83 83
                 self::assertEquals('composite-key-entity/find', $request->getMethod());
84 84
                 self::assertEquals(['first_key' => 2, 'second_key' => 'test'], $request->getParameters());
85 85
 
Please login to merge, or discard this patch.
Tests/EntityCacheTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
                     'payload' => 'test-payload',
24 24
                 ]
25 25
             ),
26
-            function (RpcRequestInterface $request) {
26
+            function(RpcRequestInterface $request) {
27 27
                 self::assertEquals('custom-entity/find', $request->getMethod());
28 28
                 self::assertEquals(['id' => 1], $request->getParameters());
29 29
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         $cache = $this->prophesize(CacheItemPoolInterface::class);
99 99
         $that  = $this;
100 100
         $cache->getItem(Argument::type('string'))->will(
101
-            function ($args) use (&$items, $that) {
101
+            function($args) use (&$items, $that) {
102 102
                 $key = $args[0];
103 103
                 if (!array_key_exists($key, $items)) {
104 104
                     $item = $that->prophesize(CacheItemInterface::class);
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
                     $item->isHit()->willReturn(false);
107 107
                     $item->get()->willReturn(null);
108 108
                     $item->set(Argument::any())->will(
109
-                        function ($args) use ($item) {
109
+                        function($args) use ($item) {
110 110
                             $item->get()->willReturn($args[0]);
111 111
 
112 112
                             return $item;
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
             }
124 124
         );
125 125
         $cache->save(Argument::type(CacheItemInterface::class))->will(
126
-            function ($args) use (&$items) {
126
+            function($args) use (&$items) {
127 127
                 $item = $args[0];
128 128
                 $items[$item->getKey()]->isHit()->willReturn(true);
129 129
             }
Please login to merge, or discard this patch.
Tests/CollectionLoadingTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
                     ],
37 37
                 ]
38 38
             ),
39
-            function (RpcRequestInterface $request) {
39
+            function(RpcRequestInterface $request) {
40 40
                 self::assertEquals('test-entity/search', $request->getMethod());
41 41
                 self::assertEquals(
42 42
                     [
Please login to merge, or discard this patch.
Mapping/Driver/YmlMetadataDriver.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,8 +61,7 @@
 block discarded – undo
61 61
             if (array_key_exists('entityPath', $element['client'])) {
62 62
                 $pathSeparator  =
63 63
                     array_key_exists('entityPathSeparator', $element['client']) ?
64
-                        $element['client']['entityPathSeparator'] :
65
-                        EntityMethodProvider::DEFAULT_PATH_SEPARATOR;
64
+                        $element['client']['entityPathSeparator'] : EntityMethodProvider::DEFAULT_PATH_SEPARATOR;
66 65
                 $methodProvider =
67 66
                     new EntityMethodProvider($element['client']['entityPath'], $pathSeparator, $methodProvider);
68 67
             }
Please login to merge, or discard this patch.
Tests/IndirectFieldsTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
                     ],
37 37
                 ]
38 38
             ),
39
-            function (RpcRequestInterface $request) {
39
+            function(RpcRequestInterface $request) {
40 40
                 self::assertEquals('test-entity/search', $request->getMethod());
41 41
                 self::assertEquals(
42 42
                     [
Please login to merge, or discard this patch.