Completed
Push — master ( 5399be...8c507d )
by Marcel
02:20
created

UpdateDocumentation   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
c 1
b 0
f 1
lcom 1
cbo 2
dl 0
loc 52
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handle() 0 16 2
1
<?php
2
3
namespace Mpociot\ApiDoc\Commands;
4
5
use Illuminate\Console\Command;
6
use Illuminate\Support\Facades\Route;
7
use Mpociot\ApiDoc\ApiDocGenerator;
8
use Mpociot\Documentarian\Documentarian;
9
use phpDocumentor\Reflection\DocBlock;
10
use Symfony\Component\Process\Process;
11
12
class UpdateDocumentation extends Command
13
{
14
15
    /**
16
     * The name and signature of the console command.
17
     *
18
     * @var string
19
     */
20
    protected $signature = 'api:update 
21
                            {--location=public/docs : The documentation location}
22
    ';
23
24
    /**
25
     * The console command description.
26
     *
27
     * @var string
28
     */
29
    protected $description = 'Update and rebuild your API documentation from your markdown file.';
30
31
    /**
32
     * Create a new command instance.
33
     *
34
     * @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...
35
     */
36
    public function __construct()
37
    {
38
        parent::__construct();
39
    }
40
41
    /**
42
     * Execute the console command.
43
     *
44
     * @return mixed
45
     */
46
    public function handle()
47
    {
48
        $outputPath = $this->option('location');
49
50
        $documentarian = new Documentarian();
51
52
        if (!is_dir($outputPath)) {
53
            $this->error('There is no generated documentation available at '.$outputPath.'.');
54
            return false;
55
        }
56
        $this->info('Updating API HTML code');
57
58
        $documentarian->generate($outputPath);
59
60
        $this->info('Wrote HTML documentation to: ' . $outputPath . '/public/index.html');
61
    }
62
63
}
64