@@ -48,6 +48,9 @@ |
||
| 48 | 48 | ; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | + /** |
|
| 52 | + * @param string $prefix |
|
| 53 | + */ |
|
| 51 | 54 | private function buildMethods(ResponseInterface $response, $prefix): array |
| 52 | 55 | { |
| 53 | 56 | $this->crawler->addHtmlContent($response->getBody()->getContents()); |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | /* |
| 6 | 6 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | { |
| 42 | 42 | return $this->client |
| 43 | 43 | ->sendAsyncRequest($this->messageFactory->createRequest('GET', $url)) |
| 44 | - ->then(function (ResponseInterface $response) use ($prefix) { |
|
| 44 | + ->then(function(ResponseInterface $response) use ($prefix) { |
|
| 45 | 45 | return $this->buildMethods($response, $prefix); |
| 46 | 46 | }) |
| 47 | 47 | ->wait() |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | private function buildMethods(ResponseInterface $response, $prefix): array |
| 52 | 52 | { |
| 53 | 53 | $this->crawler->addHtmlContent($response->getBody()->getContents()); |
| 54 | - $links = $this->crawler->filter('li a[href^="' . $prefix . '"]')->each(function (Crawler $node) { |
|
| 54 | + $links = $this->crawler->filter('li a[href^="' . $prefix . '"]')->each(function(Crawler $node) { |
|
| 55 | 55 | return $node->attr('href'); |
| 56 | 56 | }); |
| 57 | 57 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | if ($argumentsRootNode->getNode(0)->nodeName === 'ul') { |
| 90 | 90 | $names = []; |
| 91 | 91 | |
| 92 | - return $argumentsRootNode->filter('li')->each(function (Crawler $argument) use (&$names) { |
|
| 92 | + return $argumentsRootNode->filter('li')->each(function(Crawler $argument) use (&$names) { |
|
| 93 | 93 | $description = $argument->filter('code')->first()->getNode(0)->nextSibling->textContent; |
| 94 | 94 | $name = CaseFormatter::dashToCamel($argument->filter('code')->first()->text()); |
| 95 | 95 | if (!isset($names[$name])) { |
@@ -49,16 +49,25 @@ |
||
| 49 | 49 | return $this->getApi($method)->primary; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | + /** |
|
| 53 | + * @param \ReflectionMethod $method |
|
| 54 | + */ |
|
| 52 | 55 | public function isApi($method): bool |
| 53 | 56 | { |
| 54 | 57 | return (bool) $this->getApi($method); |
| 55 | 58 | } |
| 56 | 59 | |
| 60 | + /** |
|
| 61 | + * @param \ReflectionMethod $method |
|
| 62 | + */ |
|
| 57 | 63 | public function getDescription($method): string |
| 58 | 64 | { |
| 59 | 65 | return $this->docBlockFactory->create($this->getMethod($method))->getSummary(); |
| 60 | 66 | } |
| 61 | 67 | |
| 68 | + /** |
|
| 69 | + * @param \ReflectionMethod $method |
|
| 70 | + */ |
|
| 62 | 71 | public function getName($method): string |
| 63 | 72 | { |
| 64 | 73 | $reflection = $this->getMethod($method); |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | /* |
| 6 | 6 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | /* |
| 6 | 6 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | |
| 122 | 122 | private function createCode(Api\Api $api, $name, \ReflectionMethod $method): \Closure |
| 123 | 123 | { |
| 124 | - return function (InputInterface $input, OutputInterface $output) use ($name, $method, $api) { |
|
| 124 | + return function(InputInterface $input, OutputInterface $output) use ($name, $method, $api) { |
|
| 125 | 125 | $fn = $method->getClosure($api); |
| 126 | 126 | |
| 127 | 127 | $options = $this->caseTransformArray($input->getOptions()); |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | |
| 151 | 151 | private function caseTransformArray(array $values): array |
| 152 | 152 | { |
| 153 | - return array_combine(array_map(function ($name) { |
|
| 153 | + return array_combine(array_map(function($name) { |
|
| 154 | 154 | return CaseFormatter::dashToCamel($name); |
| 155 | 155 | }, array_keys($values)), array_values($values)); |
| 156 | 156 | } |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | /* |
| 6 | 6 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | $this->registerHttp($pimple); |
| 57 | 57 | |
| 58 | - $pimple[CommandBuilder::class] = function (Container $pimple) { |
|
| 58 | + $pimple[CommandBuilder::class] = function(Container $pimple) { |
|
| 59 | 59 | return new CommandBuilder([ |
| 60 | 60 | new Api\Basics(), |
| 61 | 61 | new Api\Bitswap(), |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | ], $pimple); |
| 80 | 80 | }; |
| 81 | 81 | |
| 82 | - $pimple[Application::class] = function (Container $pimple) { |
|
| 82 | + $pimple[Application::class] = function(Container $pimple) { |
|
| 83 | 83 | $app = new Application('ipfs', '@git-version@'); |
| 84 | 84 | $app->addCommands($pimple[CommandBuilder::class]->generateCommands()); |
| 85 | 85 | $app->add(new ApiBuildCommand($pimple)); |
@@ -87,14 +87,14 @@ discard block |
||
| 87 | 87 | return $app; |
| 88 | 88 | }; |
| 89 | 89 | |
| 90 | - $pimple[AnnotationReader::class] = function () { |
|
| 90 | + $pimple[AnnotationReader::class] = function() { |
|
| 91 | 91 | return new AnnotationReader( |
| 92 | 92 | new \Doctrine\Common\Annotations\AnnotationReader(), |
| 93 | 93 | DocBlockFactory::createInstance() |
| 94 | 94 | ); |
| 95 | 95 | }; |
| 96 | 96 | |
| 97 | - $pimple[Api\ApiBuilder::class] = function (Container $pimple) { |
|
| 97 | + $pimple[Api\ApiBuilder::class] = function(Container $pimple) { |
|
| 98 | 98 | $parser = new Api\ApiParser($pimple[HttpAsyncClient::class], $pimple[MessageFactory::class], new Crawler()); |
| 99 | 99 | $generator = new Api\ApiGenerator(new BuilderFactory()); |
| 100 | 100 | |
@@ -104,32 +104,32 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | public function registerHttp(Container $pimple) |
| 106 | 106 | { |
| 107 | - $pimple[HttpAsyncClient::class] = function () { |
|
| 107 | + $pimple[HttpAsyncClient::class] = function() { |
|
| 108 | 108 | return new PluginClient( |
| 109 | 109 | HttpAsyncClientDiscovery::find(), |
| 110 | 110 | [] |
| 111 | 111 | ); |
| 112 | 112 | }; |
| 113 | 113 | |
| 114 | - $pimple[MessageFactory::class] = function () { |
|
| 114 | + $pimple[MessageFactory::class] = function() { |
|
| 115 | 115 | return MessageFactoryDiscovery::find(); |
| 116 | 116 | }; |
| 117 | 117 | |
| 118 | - $pimple[UriFactory::class] = function () { |
|
| 118 | + $pimple[UriFactory::class] = function() { |
|
| 119 | 119 | return UriFactoryDiscovery::find(); |
| 120 | 120 | }; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | public function registerApi(Container $pimple) |
| 124 | 124 | { |
| 125 | - $pimple[Basics::class] = function (Container $pimple) { |
|
| 125 | + $pimple[Basics::class] = function(Container $pimple) { |
|
| 126 | 126 | return new Basics(); |
| 127 | 127 | }; |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | private function registerDriver(Container $pimple) |
| 131 | 131 | { |
| 132 | - $pimple[Http::class] = function (Container $pimple) { |
|
| 132 | + $pimple[Http::class] = function(Container $pimple) { |
|
| 133 | 133 | return new Http( |
| 134 | 134 | $pimple[HttpAsyncClient::class], |
| 135 | 135 | $pimple[MessageFactory::class], |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | ); |
| 140 | 140 | }; |
| 141 | 141 | |
| 142 | - $pimple[Cli::class] = function (Container $pimple) { |
|
| 142 | + $pimple[Cli::class] = function(Container $pimple) { |
|
| 143 | 143 | return new Cli(new ProcessBuilder(), $pimple[AnnotationReader::class], getenv('IPFS_BINARY') ?: 'ipfs'); |
| 144 | 144 | }; |
| 145 | 145 | } |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | /* |
| 6 | 6 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | { |
| 69 | 69 | $request = $this->buildRequest($command, $this->getConfig($command)); |
| 70 | 70 | |
| 71 | - return $this->client->sendAsyncRequest($request)->then(function (ResponseInterface $response) { |
|
| 71 | + return $this->client->sendAsyncRequest($request)->then(function(ResponseInterface $response) { |
|
| 72 | 72 | return $response->getBody()->getContents(); |
| 73 | 73 | })->wait(); |
| 74 | 74 | } |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | /* |
| 6 | 6 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | /* |
| 6 | 6 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | /* |
| 6 | 6 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | /* |
| 6 | 6 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |