1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
7
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
8
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
9
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
10
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
11
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
12
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
13
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
14
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
15
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
16
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
17
|
|
|
* |
18
|
|
|
* This software consists of voluntary contributions made by many individuals |
19
|
|
|
* and is licensed under the MIT license. For more information, see |
20
|
|
|
* <https://github.com/digitalkaoz/php-ipfs> |
21
|
|
|
*/ |
22
|
|
|
|
23
|
|
|
namespace IPFS\Console; |
24
|
|
|
|
25
|
|
|
use IPFS\Api\ApiBuilder; |
26
|
|
|
use Symfony\Component\Console\Command\Command; |
27
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
28
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
29
|
|
|
|
30
|
|
|
class ApiBuildCommand extends Command |
31
|
|
|
{ |
32
|
|
|
/** |
33
|
|
|
* @var ApiBuilder |
34
|
|
|
*/ |
35
|
|
|
private $builder; |
36
|
|
|
|
37
|
1 |
|
public function __construct(ApiBuilder $builder) |
38
|
|
|
{ |
39
|
1 |
|
parent::__construct(null); |
40
|
1 |
|
$this->builder = $builder; |
41
|
1 |
|
} |
42
|
|
|
|
43
|
1 |
|
protected function configure() |
44
|
|
|
{ |
45
|
|
|
$this |
46
|
1 |
|
->setName('rebuild') |
47
|
1 |
|
->setDescription('rebuild api classes by parsing the official api doc') |
48
|
|
|
; |
49
|
1 |
|
} |
50
|
|
|
|
51
|
|
|
protected function execute(InputInterface $input, OutputInterface $output) |
52
|
|
|
{ |
53
|
|
|
$this->builder->build(); |
54
|
|
|
|
55
|
|
|
$output->writeln('updated Api Classes in <info>src/Api</info>'); |
56
|
|
|
} |
57
|
|
|
} |
58
|
|
|
|