|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Gacela\Console; |
|
6
|
|
|
|
|
7
|
|
|
use Gacela\Console\Domain\AllAppModules\AppModule; |
|
8
|
|
|
use Gacela\Console\Domain\CommandArguments\CommandArguments; |
|
9
|
|
|
use Gacela\Framework\AbstractFacade; |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* @extends AbstractFacade<ConsoleFactory> |
|
13
|
|
|
*/ |
|
14
|
|
|
final class ConsoleFacade extends AbstractFacade |
|
15
|
|
|
{ |
|
16
|
|
|
public function sanitizeFilename(string $filename): string |
|
17
|
|
|
{ |
|
18
|
|
|
return $this->getFactory() |
|
19
|
|
|
->createFilenameSanitizer() |
|
|
|
|
|
|
20
|
|
|
->sanitize($filename); |
|
21
|
|
|
} |
|
22
|
|
|
|
|
23
|
|
|
public function parseArguments(string $desiredNamespace): CommandArguments |
|
24
|
|
|
{ |
|
25
|
|
|
return $this->getFactory() |
|
26
|
|
|
->createCommandArgumentsParser() |
|
|
|
|
|
|
27
|
|
|
->parse($desiredNamespace); |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
public function generateFileContent( |
|
31
|
|
|
CommandArguments $commandArguments, |
|
32
|
|
|
string $filename, |
|
33
|
|
|
bool $withShortName = false, |
|
34
|
|
|
): string { |
|
35
|
|
|
return $this->getFactory() |
|
36
|
|
|
->createFileContentGenerator() |
|
|
|
|
|
|
37
|
|
|
->generate($commandArguments, $filename, $withShortName); |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* @return list<AppModule> |
|
42
|
|
|
*/ |
|
43
|
|
|
public function findAllAppModules(string $filter = ''): array |
|
44
|
|
|
{ |
|
45
|
|
|
return $this->getFactory() |
|
46
|
|
|
->createAllAppModulesFinder() |
|
|
|
|
|
|
47
|
|
|
->findAllAppModules($filter); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* @return array{ |
|
52
|
|
|
* registered_services: int, |
|
53
|
|
|
* frozen_services: int, |
|
54
|
|
|
* factory_services: int, |
|
55
|
|
|
* bindings: int, |
|
56
|
|
|
* cached_dependencies: int, |
|
57
|
|
|
* memory_usage: string |
|
58
|
|
|
* } |
|
59
|
|
|
*/ |
|
60
|
|
|
public function getContainerStats(): array |
|
61
|
|
|
{ |
|
62
|
|
|
return $this->getFactory()->getContainerStats(); |
|
|
|
|
|
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* @param class-string $className |
|
67
|
|
|
* |
|
68
|
|
|
* @return list<string> |
|
69
|
|
|
*/ |
|
70
|
|
|
public function getContainerDependencyTree(string $className): array |
|
71
|
|
|
{ |
|
72
|
|
|
return $this->getFactory()->getContainerDependencyTree($className); |
|
|
|
|
|
|
73
|
|
|
} |
|
74
|
|
|
} |
|
75
|
|
|
|