Issues (153)

src/Console/ConsoleProvider.php (4 issues)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Gacela\Console;
6
7
use Gacela\Console\Domain\FilenameSanitizer\FilenameSanitizer;
8
use Gacela\Console\Infrastructure\Command\CacheWarmCommand;
9
use Gacela\Console\Infrastructure\Command\DebugContainerCommand;
10
use Gacela\Console\Infrastructure\Command\ListModulesCommand;
11
use Gacela\Console\Infrastructure\Command\MakeFileCommand;
12
use Gacela\Console\Infrastructure\Command\MakeModuleCommand;
13
use Gacela\Console\Infrastructure\Command\ValidateConfigCommand;
14
use Gacela\Framework\AbstractProvider;
15
use Gacela\Framework\Container\Container;
16
17
/**
18
 * @extends AbstractProvider<ConsoleConfig>
19
 */
20
final class ConsoleProvider extends AbstractProvider
21
{
22
    public const COMMANDS = 'COMMANDS';
23
24
    public const TEMPLATE_BY_FILENAME_MAP = 'TEMPLATE_FILENAME_MAP';
25
26
    public function provideModuleDependencies(Container $container): void
27
    {
28
        $this->addCommands($container);
29
        $this->addTemplateByFilenameMap($container);
30
    }
31
32
    private function addCommands(Container $container): void
33
    {
34
        $container->set(self::COMMANDS, static fn (): array => [
35
            new MakeFileCommand(),
36
            new MakeModuleCommand(),
37
            new ListModulesCommand(),
38
            new DebugContainerCommand(),
39
            new CacheWarmCommand(),
40
            new ValidateConfigCommand(),
41
        ]);
42
    }
43
44
    private function addTemplateByFilenameMap(Container $container): void
45
    {
46
        $container->set(self::TEMPLATE_BY_FILENAME_MAP, fn (): array => [
47
            FilenameSanitizer::FACADE => $this->getConfig()->getFacadeMakerTemplate(),
0 ignored issues
show
The method getFacadeMakerTemplate() does not exist on Gacela\Framework\AbstractConfig. It seems like you code against a sub-type of Gacela\Framework\AbstractConfig such as Gacela\Console\ConsoleConfig. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

47
            FilenameSanitizer::FACADE => $this->getConfig()->/** @scrutinizer ignore-call */ getFacadeMakerTemplate(),
Loading history...
48
            FilenameSanitizer::FACTORY => $this->getConfig()->getFactoryMakerTemplate(),
0 ignored issues
show
The method getFactoryMakerTemplate() does not exist on Gacela\Framework\AbstractConfig. It seems like you code against a sub-type of Gacela\Framework\AbstractConfig such as Gacela\Console\ConsoleConfig. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

48
            FilenameSanitizer::FACTORY => $this->getConfig()->/** @scrutinizer ignore-call */ getFactoryMakerTemplate(),
Loading history...
49
            FilenameSanitizer::CONFIG => $this->getConfig()->getConfigMakerTemplate(),
0 ignored issues
show
The method getConfigMakerTemplate() does not exist on Gacela\Framework\AbstractConfig. It seems like you code against a sub-type of Gacela\Framework\AbstractConfig such as Gacela\Console\ConsoleConfig. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

49
            FilenameSanitizer::CONFIG => $this->getConfig()->/** @scrutinizer ignore-call */ getConfigMakerTemplate(),
Loading history...
50
            FilenameSanitizer::PROVIDER => $this->getConfig()->getProviderMakerTemplate(),
0 ignored issues
show
The method getProviderMakerTemplate() does not exist on Gacela\Framework\AbstractConfig. It seems like you code against a sub-type of Gacela\Framework\AbstractConfig such as Gacela\Console\ConsoleConfig. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

50
            FilenameSanitizer::PROVIDER => $this->getConfig()->/** @scrutinizer ignore-call */ getProviderMakerTemplate(),
Loading history...
51
        ]);
52
    }
53
}
54