@@ -26,7 +26,7 @@ |
||
26 | 26 | /** |
27 | 27 | * @param MethodCollection $methodCollection |
28 | 28 | * |
29 | - * @return array |
|
29 | + * @return string |
|
30 | 30 | */ |
31 | 31 | public function extract(MethodCollection $methodCollection) |
32 | 32 | { |
@@ -2,9 +2,7 @@ |
||
2 | 2 | |
3 | 3 | namespace Tonic\Component\ApiLayer\JsonRpcExtensions\Documentation; |
4 | 4 | |
5 | -use Doctrine\Common\Annotations\PhpParser; |
|
6 | 5 | use phpDocumentor\Reflection\DocBlock; |
7 | -use phpDocumentor\Reflection\DocBlock\Tag\ReturnTag; |
|
8 | 6 | use Tonic\Component\ApiLayer\JsonRpc\Method\MethodCollection; |
9 | 7 | use Tonic\Component\Reflection\TypeResolver; |
10 | 8 |
@@ -53,6 +53,9 @@ discard block |
||
53 | 53 | return $type . ($isCollection ? '[]' : ''); |
54 | 54 | } |
55 | 55 | |
56 | + /** |
|
57 | + * @param string $type |
|
58 | + */ |
|
56 | 59 | private function isTypeObject($type) |
57 | 60 | { |
58 | 61 | switch (strtolower($type)) { |
@@ -77,6 +80,9 @@ discard block |
||
77 | 80 | } |
78 | 81 | } |
79 | 82 | |
83 | + /** |
|
84 | + * @param string $type |
|
85 | + */ |
|
80 | 86 | private function resolveClassName($type, \ReflectionClass $usingClass) |
81 | 87 | { |
82 | 88 | if (strpos($type, '\\') === 0 && class_exists($type)) { |
@@ -90,7 +90,7 @@ |
||
90 | 90 | $aliases = $this->phpParser->parseClass($usingClass); |
91 | 91 | $alias = strtolower($type); |
92 | 92 | |
93 | - if (! isset($aliases[$alias])) { |
|
93 | + if (!isset($aliases[$alias])) { |
|
94 | 94 | return $usingClass->getNamespaceName() . '\\' . $type; |
95 | 95 | } |
96 | 96 |
@@ -70,7 +70,7 @@ |
||
70 | 70 | $attributeValue = $this->propertyAccessor->getValue($requestObject, $attributeAnnotation->valueAt); |
71 | 71 | |
72 | 72 | $userId = $this->userProvider->getUserId(); |
73 | - if ((! is_array($attributeValue)) && (! $this->guard->isGranted($userId, $attributeName, $attributeValue))) { |
|
73 | + if ((!is_array($attributeValue)) && (!$this->guard->isGranted($userId, $attributeName, $attributeValue))) { |
|
74 | 74 | throw new AccessDeniedException(); |
75 | 75 | } |
76 | 76 |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | throw new ParseException(sprintf('Invalid JSON syntax: "%s"', json_last_error_msg())); |
18 | 18 | } |
19 | 19 | |
20 | - if (! is_array($data)) { |
|
20 | + if (!is_array($data)) { |
|
21 | 21 | throw new InvalidRequestException('Request is not valid JSON'); |
22 | 22 | } |
23 | 23 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | throw new InvalidRequestException(sprintf('Request attributes are missed: %s', join(', ', $difference))); |
40 | 40 | } |
41 | 41 | |
42 | - if (! is_array($data['params'])) { |
|
42 | + if (!is_array($data['params'])) { |
|
43 | 43 | throw new InvalidRequestException('Parameters should have an object structure'); |
44 | 44 | } |
45 | 45 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | */ |
36 | 36 | public function add($service) |
37 | 37 | { |
38 | - if (! is_object($service)) { |
|
38 | + if (!is_object($service)) { |
|
39 | 39 | throw new \InvalidArgumentException('Supports only objects'); |
40 | 40 | } |
41 | 41 |
@@ -51,7 +51,7 @@ |
||
51 | 51 | */ |
52 | 52 | public function get($methodName) |
53 | 53 | { |
54 | - if (! $this->has($methodName)) { |
|
54 | + if (!$this->has($methodName)) { |
|
55 | 55 | return null; |
56 | 56 | } |
57 | 57 |
@@ -69,7 +69,7 @@ |
||
69 | 69 | public function dispatch($methodName, array $arguments = []) |
70 | 70 | { |
71 | 71 | $methodCollection = $this->getMethodCollection(); |
72 | - if (! $methodCollection->has($methodName)) { |
|
72 | + if (!$methodCollection->has($methodName)) { |
|
73 | 73 | throw new MethodNotFoundException(sprintf('Method "%s" is not found', $methodName)); |
74 | 74 | } |
75 | 75 |
@@ -48,7 +48,7 @@ |
||
48 | 48 | |
49 | 49 | $docBlock = new DocBlock($reflectionProperty->getDocComment()); |
50 | 50 | $tags = $docBlock->getTagsByName('var'); |
51 | - if (count($tags) == 0 ) { |
|
51 | + if (count($tags) == 0) { |
|
52 | 52 | return null; |
53 | 53 | } |
54 | 54 |
@@ -16,7 +16,7 @@ |
||
16 | 16 | { |
17 | 17 | $this->has('sampleService.sampleMethod')->shouldBe(false); |
18 | 18 | |
19 | - $this->add('sampleService.sampleMethod', function () {}); |
|
19 | + $this->add('sampleService.sampleMethod', function() {}); |
|
20 | 20 | |
21 | 21 | $this->get('sampleService.sampleMethod')->shouldBeAnInstanceOf(\Closure::class); |
22 | 22 | } |