GenerateDocumentationAction   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 27
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 19 1
1
<?php
2
3
namespace App\Containers\Documentation\Actions;
4
5
use Apiato\Core\Foundation\Facades\Apiato;
6
use App\Ship\Parents\Actions\Action;
7
use App\Ship\Transporters\DataTransporter;
8
9
/**
10
 * Class GenerateDocumentationAction.
11
 *
12
 * @author Mahmoud Zalt <[email protected]>
13
 */
14
class GenerateDocumentationAction extends Action
15
{
16
17
    /**
18
     * @param \App\Ship\Transporters\DataTransporter $data
19
     */
20
    public function run(DataTransporter $data): void
21
    {
22
        $console = $data->command_instance;
23
24
        // parse the markdown file.
25
        Apiato::call('[email protected]');
26
27
        // get docs types that needs to be generated by the user base on his configs.
28
        $types = Apiato::call('[email protected]');
29
30
        $console->info("Generating API Documentations for (" . implode(' & ', $types) . ")\n");
31
32
        // for each type, generate docs.
33
        $documentationUrls = array_map(function ($type) use ($console) {
34
            return Apiato::call('[email protected]', [$type, $console]);
35
        }, $types);
36
37
        $console->info("Done! You can access your API Docs at: \n" . implode("\n", $documentationUrls));
38
    }
39
40
}
41