Issues (136)

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\ListModulesCommand;
9
use Gacela\Console\Infrastructure\Command\MakeFileCommand;
10
use Gacela\Console\Infrastructure\Command\MakeModuleCommand;
11
use Gacela\Framework\AbstractProvider;
12
use Gacela\Framework\Container\Container;
13
use Override;
14
15
/**
16
 * @extends AbstractProvider<ConsoleConfig>
17
 */
18
final class ConsoleProvider extends AbstractProvider
19
{
20
    public const COMMANDS = 'COMMANDS';
21
22
    public const TEMPLATE_BY_FILENAME_MAP = 'TEMPLATE_FILENAME_MAP';
23
24
    #[Override]
25
    public function provideModuleDependencies(Container $container): void
26
    {
27
        $this->addCommands($container);
28
        $this->addTemplateByFilenameMap($container);
29
    }
30
31
    private function addCommands(Container $container): void
32
    {
33
        $container->set(self::COMMANDS, static fn (): array => [
34
            new MakeFileCommand(),
35
            new MakeModuleCommand(),
36
            new ListModulesCommand(),
37
        ]);
38
    }
39
40
    private function addTemplateByFilenameMap(Container $container): void
41
    {
42
        $container->set(self::TEMPLATE_BY_FILENAME_MAP, fn (): array => [
43
            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

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

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

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

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