Issues (147)

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\DebugContainerCommand;
9
use Gacela\Console\Infrastructure\Command\ListModulesCommand;
10
use Gacela\Console\Infrastructure\Command\MakeFileCommand;
11
use Gacela\Console\Infrastructure\Command\MakeModuleCommand;
12
use Gacela\Framework\AbstractProvider;
13
use Gacela\Framework\Container\Container;
14
use Override;
15
16
/**
17
 * @extends AbstractProvider<ConsoleConfig>
18
 */
19
final class ConsoleProvider extends AbstractProvider
20
{
21
    public const COMMANDS = 'COMMANDS';
22
23
    public const TEMPLATE_BY_FILENAME_MAP = 'TEMPLATE_FILENAME_MAP';
24
25
    #[Override]
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
        ]);
40
    }
41
42
    private function addTemplateByFilenameMap(Container $container): void
43
    {
44
        $container->set(self::TEMPLATE_BY_FILENAME_MAP, fn (): array => [
45
            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

45
            FilenameSanitizer::FACADE => $this->getConfig()->/** @scrutinizer ignore-call */ getFacadeMakerTemplate(),
Loading history...
46
            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

46
            FilenameSanitizer::FACTORY => $this->getConfig()->/** @scrutinizer ignore-call */ getFactoryMakerTemplate(),
Loading history...
47
            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

47
            FilenameSanitizer::CONFIG => $this->getConfig()->/** @scrutinizer ignore-call */ getConfigMakerTemplate(),
Loading history...
48
            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

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