• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

api-platform / core / 19171073905

07 Nov 2025 02:17PM UTC coverage: 0.0% (-24.3%) from 24.303%
19171073905

push

github

web-flow
feat(symfony): allow symfony makers namespace configuration (#7497)

0 of 19 new or added lines in 6 files covered. (0.0%)

14716 existing lines in 467 files now uncovered.

0 of 56762 relevant lines covered (0.0%)

0.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Symfony/Maker/MakeStateProcessor.php
1
<?php
2

3
/*
4
 * This file is part of the API Platform project.
5
 *
6
 * (c) Kévin Dunglas <dunglas@gmail.com>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11

12
declare(strict_types=1);
13

14
namespace ApiPlatform\Symfony\Maker;
15

16
use Symfony\Bundle\MakerBundle\ConsoleStyle;
17
use Symfony\Bundle\MakerBundle\DependencyBuilder;
18
use Symfony\Bundle\MakerBundle\Generator;
19
use Symfony\Bundle\MakerBundle\InputConfiguration;
20
use Symfony\Bundle\MakerBundle\Maker\AbstractMaker;
21
use Symfony\Component\Console\Command\Command;
22
use Symfony\Component\Console\Input\InputArgument;
23
use Symfony\Component\Console\Input\InputInterface;
24
use Symfony\Component\Console\Input\InputOption;
25

26
final class MakeStateProcessor extends AbstractMaker
27
{
28
    public function __construct(private readonly string $namespacePrefix = '')
29
    {
NEW
30
    }
×
31

32
    /**
33
     * {@inheritdoc}
34
     */
35
    public static function getCommandName(): string
36
    {
UNCOV
37
        return 'make:state-processor';
×
38
    }
39

40
    /**
41
     * {@inheritdoc}
42
     */
43
    public static function getCommandDescription(): string
44
    {
UNCOV
45
        return 'Creates an API Platform state processor';
×
46
    }
47

48
    /**
49
     * {@inheritdoc}
50
     */
51
    public function configureCommand(Command $command, InputConfiguration $inputConfig): void
52
    {
UNCOV
53
        $command
×
UNCOV
54
            ->addArgument('name', InputArgument::REQUIRED, 'Choose a class name for your state processor (e.g. <fg=yellow>AwesomeStateProcessor</>)')
×
NEW
55
            ->addOption('namespace-prefix', 'p', InputOption::VALUE_REQUIRED, 'Specify the namespace prefix to use for the state processor class', $this->namespacePrefix.'State')
×
UNCOV
56
            ->setHelp(file_get_contents(__DIR__.'/Resources/help/MakeStateProcessor.txt'));
×
57
    }
58

59
    /**
60
     * {@inheritdoc}
61
     */
62
    public function configureDependencies(DependencyBuilder $dependencies): void
63
    {
UNCOV
64
    }
×
65

66
    /**
67
     * {@inheritdoc}
68
     */
69
    public function generate(InputInterface $input, ConsoleStyle $io, Generator $generator): void
70
    {
UNCOV
71
        $stateProcessorClassNameDetails = $generator->createClassNameDetails(
×
UNCOV
72
            $input->getArgument('name'),
×
NEW
73
            trim($input->getOption('namespace-prefix'), '\\').'\\'
×
UNCOV
74
        );
×
75

UNCOV
76
        $generator->generateClass(
×
UNCOV
77
            $stateProcessorClassNameDetails->getFullName(),
×
UNCOV
78
            __DIR__.'/Resources/skeleton/StateProcessor.php.tpl'
×
UNCOV
79
        );
×
UNCOV
80
        $generator->writeChanges();
×
81

UNCOV
82
        $this->writeSuccessMessage($io);
×
UNCOV
83
        $io->text([
×
UNCOV
84
            'Next: Open your new state processor class and start customizing it.',
×
UNCOV
85
        ]);
×
86
    }
87
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc