Completed
Pull Request — master (#646)
by
unknown
01:25
created

RebuildDocumentation::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Mpociot\ApiDoc\Commands;
4
5
use Illuminate\Console\Command;
6
use Mpociot\ApiDoc\Tools\DocumentationConfig;
7
use Mpociot\ApiDoc\Writing\Writer;
8
9
class RebuildDocumentation extends Command
10
{
11
    protected $signature = 'apidoc:rebuild';
12
13
    protected $description = 'Rebuild your API documentation from your markdown file.';
14
15
    public function handle()
16
    {
17
        $sourceOutputPath = 'resources/docs/source';
18
        if (! is_dir($sourceOutputPath)) {
19
            $this->error('There is no existing documentation available at '.$sourceOutputPath.'.');
20
21
            return false;
22
        }
23
24
        $this->info('Rebuilding API documentation from '.$sourceOutputPath.'/index.md');
25
26
        $writer = new Writer($this, new DocumentationConfig(config('apidoc')));
27
        $writer->writeHtmlDocs();
28
    }
29
}
30