1 | <?php |
||
13 | class GenerateDiagramCommand extends Command |
||
14 | { |
||
15 | const FORMAT_TEXT = 'text'; |
||
16 | |||
17 | const DEFAULT_FILENAME = 'graph'; |
||
18 | |||
19 | /** |
||
20 | * @var string |
||
21 | */ |
||
22 | protected $modelNamespace = 'Modules\{#}\Entities\{#}'; |
||
23 | |||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | protected $modulePath = 'Modules/{#}'; |
||
28 | |||
29 | /** |
||
30 | * The console command name. |
||
31 | * |
||
32 | * @var string |
||
33 | */ |
||
34 | protected $signature = 'generate:model-erd {models} {filename?} {--format=png}'; |
||
35 | |||
36 | /** |
||
37 | * The console command description. |
||
38 | * |
||
39 | * @var string |
||
40 | */ |
||
41 | protected $description = 'Generate ER diagram.'; |
||
42 | |||
43 | /** @var ModelFinder */ |
||
44 | protected $modelFinder; |
||
45 | |||
46 | /** @var RelationFinder */ |
||
47 | protected $relationFinder; |
||
48 | |||
49 | /** @var Graph */ |
||
50 | protected $graph; |
||
51 | |||
52 | /** @var GraphBuilder */ |
||
53 | protected $graphBuilder; |
||
54 | |||
55 | /** |
||
56 | * GenerateDiagramCommand constructor. |
||
57 | * |
||
58 | * @param ModelFinder $modelFinder |
||
59 | * @param RelationFinder $relationFinder |
||
60 | * @param GraphBuilder $graphBuilder |
||
61 | */ |
||
62 | public function __construct(ModelFinder $modelFinder, RelationFinder $relationFinder, GraphBuilder $graphBuilder) |
||
70 | |||
71 | /** |
||
72 | * @throws \phpDocumentor\GraphViz\Exception |
||
73 | */ |
||
74 | public function handle() |
||
104 | |||
105 | /** |
||
106 | * @return string |
||
107 | */ |
||
108 | protected function getOutputFileName(): string |
||
113 | |||
114 | /** |
||
115 | * @param array $directories |
||
116 | * @return Collection |
||
117 | */ |
||
118 | protected function getAllModelsFromEachDirectory(array $directories): Collection |
||
126 | |||
127 | /** |
||
128 | * @return Collection |
||
129 | */ |
||
130 | protected function getModelsThatShouldBeInspected(): Collection |
||
171 | } |
||
172 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.