for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace SLLH\IsoCodesValidator\Dev\Console\Command;
use Gnugat\NomoSpaco\File\FileRepository;
use Gnugat\NomoSpaco\FqcnRepository;
use Gnugat\NomoSpaco\Token\ParserFactory;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
/**
* @author Sullivan Senechal <[email protected]>
*/
final class GenerateCommand extends Command
{
* {@inheritdoc}
protected function configure()
$this
->setName('generate')
;
}
protected function execute(InputInterface $input, OutputInterface $output)
$fqcnRepository = new FqcnRepository(new FileRepository(), new ParserFactory());
$isoCodesClasses = array_map(function ($fqcn) {
return str_replace('IsoCodes\\', '', $fqcn);
}, $fqcnRepository->findIn(__DIR__.'/../../../vendor/ronanguilloux/isocodes/src/IsoCodes'));
$constraintClasses = array_filter(array_map(function ($fqcn) {
return str_replace('SLLH\\IsoCodesValidator\\Constraints\\', '', $fqcn);
}, $fqcnRepository->findIn(__DIR__.'/../../../src/Constraints')), function ($className) {
return !empty(trim($className));
});
foreach (array_udiff($isoCodesClasses, $constraintClasses, 'strcasecmp') as $missingConstraint) {
$output->writeln("Generate <comment>${missingConstraint}</comment> constraint.");