Completed
Push — master ( 6d8169...2a43e4 )
by
unknown
01:43
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\Documentarian\Documentarian;
7
8
class RebuildDocumentation extends Command
9
{
10
    /**
11
     * The name and signature of the console command.
12
     *
13
     * @var string
14
     */
15
    protected $signature = 'apidoc:rebuild';
16
17
    /**
18
     * The console command description.
19
     *
20
     * @var string
21
     */
22
    protected $description = 'Rebuild your API documentation from your markdown file.';
23
24
    /**
25
     * Create a new command instance.
26
     *
27
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
28
     */
29
    public function __construct()
30
    {
31
        parent::__construct();
32
    }
33
34
    /**
35
     * Execute the console command.
36
     *
37
     * @return false|null
38
     */
39
    public function handle()
40
    {
41
        $outputPath = config('apidoc.output');
42
43
        $documentarian = new Documentarian();
44
45
        if (! is_dir($outputPath)) {
46
            $this->error('There is no existing documentation available at '.$outputPath.'.');
47
48
            return false;
49
        }
50
        $this->info('Rebuilding API HTML code from '.$outputPath.'/source/index.md');
51
52
        $documentarian->generate($outputPath);
53
54
        $this->info('Wrote HTML documentation to: '.$outputPath.'/index.html');
55
    }
56
}
57