|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* PHP version 7.1 |
|
4
|
|
|
* |
|
5
|
|
|
* This source file is subject to the license that is bundled with this package in the file LICENSE. |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
namespace PhUml\Console\Commands; |
|
9
|
|
|
|
|
10
|
|
|
use Symfony\Component\Console\Command\Command; |
|
11
|
|
|
use Symfony\Component\Console\Input\InputOption; |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* There are 8 options to generate the digraph for a class diagram |
|
15
|
|
|
* |
|
16
|
|
|
* 1. `recursive`. If present it will look recursively within the `directory` provided |
|
17
|
|
|
* 2. `associations`. If present the command will generate associations between the classes/interfaces |
|
18
|
|
|
* injected through the constructor and the attributes of a class |
|
19
|
|
|
* 3. `hide-private` If present it will show only public and protected members |
|
20
|
|
|
* 4. `hide-protected` If present it will show only public and private members |
|
21
|
|
|
* 5. `hide-methods` If present it will show only attributes and constants |
|
22
|
|
|
* 6. `hide-attributes` If present it will show only methods |
|
23
|
|
|
* 7. `hide-attributes` If present it will not produce a table row if no attributes or methods are |
|
24
|
|
|
* present |
|
25
|
|
|
* 8. `theme` There are 3 color schemes (themes) that you can choose from: `phuml`, which is the |
|
26
|
|
|
* default one, `php` and `classic` |
|
27
|
|
|
*/ |
|
28
|
|
|
trait WithDigraphConfiguration |
|
29
|
|
|
{ |
|
30
|
48 |
|
public function addDigraphOptions(Command $command): void |
|
31
|
|
|
{ |
|
32
|
|
|
$command |
|
33
|
48 |
|
->addOption( |
|
34
|
48 |
|
'recursive', |
|
35
|
48 |
|
'r', |
|
36
|
48 |
|
InputOption::VALUE_NONE, |
|
37
|
48 |
|
'Look for classes in the given directory and its sub-directories' |
|
38
|
|
|
) |
|
39
|
48 |
|
->addOption( |
|
40
|
48 |
|
'associations', |
|
41
|
48 |
|
'a', |
|
42
|
48 |
|
InputOption::VALUE_NONE, |
|
43
|
48 |
|
'Extract associations between classes from constructor parameters and attributes' |
|
44
|
|
|
) |
|
45
|
48 |
|
->addOption( |
|
46
|
48 |
|
'hide-private', |
|
47
|
48 |
|
'i', |
|
48
|
48 |
|
InputOption::VALUE_NONE, |
|
49
|
48 |
|
'Ignore private attributes, constants and methods' |
|
50
|
|
|
) |
|
51
|
48 |
|
->addOption( |
|
52
|
48 |
|
'hide-protected', |
|
53
|
48 |
|
'o', |
|
54
|
48 |
|
InputOption::VALUE_NONE, |
|
55
|
48 |
|
'Ignore protected attributes, constants and methods' |
|
56
|
|
|
) |
|
57
|
48 |
|
->addOption( |
|
58
|
48 |
|
'hide-methods', |
|
59
|
48 |
|
'm', |
|
60
|
48 |
|
InputOption::VALUE_NONE, |
|
61
|
48 |
|
'Ignore all methods' |
|
62
|
|
|
) |
|
63
|
48 |
|
->addOption( |
|
64
|
48 |
|
'hide-attributes', |
|
65
|
48 |
|
't', |
|
66
|
48 |
|
InputOption::VALUE_NONE, |
|
67
|
48 |
|
'Ignore all attributes and constants' |
|
68
|
|
|
) |
|
69
|
48 |
|
->addOption( |
|
70
|
48 |
|
'hide-empty-blocks', |
|
71
|
48 |
|
'b', |
|
72
|
48 |
|
InputOption::VALUE_NONE, |
|
73
|
48 |
|
'Do not generate empty blocks for attributes or methods' |
|
74
|
|
|
) |
|
75
|
48 |
|
->addOption( |
|
76
|
48 |
|
'theme', |
|
77
|
48 |
|
'e', |
|
78
|
48 |
|
InputOption::VALUE_OPTIONAL, |
|
79
|
48 |
|
'Colors and fonts to be used for the diagram [phuml, php, classic]', |
|
80
|
48 |
|
'phuml' |
|
81
|
|
|
) |
|
82
|
|
|
; |
|
83
|
48 |
|
} |
|
84
|
|
|
} |
|
85
|
|
|
|