本文整理汇总了PHP中fixer::registerBuiltInConfigs方法的典型用法代码示例。如果您正苦于以下问题:PHP fixer::registerBuiltInConfigs方法的具体用法?PHP fixer::registerBuiltInConfigs怎么用?PHP fixer::registerBuiltInConfigs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fixer
的用法示例。
在下文中一共展示了fixer::registerBuiltInConfigs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Execute the command line :
* php app/console swagger:generate --file=Resources/example/swagger.json.
*
*
* @param InputInterface $input
* @param OutputInterface $output
*
* @return int|null|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$style = new OutputFormatterStyle('red', 'yellow', array('bold', 'blink'));
$output->getFormatter()->setStyle('fire', $style);
$verbosity = $output->getVerbosity();
$manager = $this->getCreatorsManager();
$conf = $manager->getConfig();
if (isset($conf['definitions'])) {
$output->writeln('Start creating definitions...');
$manager->createDefinitions($conf['definitions'], $output);
$output->writeln('Finish creating definitions.');
} else {
$output->writeln('');
$output->writeln('WARNING: definitions not found');
}
if (isset($conf['paths'])) {
$output->writeln('Start creating controllers...');
$buildRoutingAnnotations = 'annotation' === $manager->getRoutingType();
$manager->createControllers($conf['paths'], $buildRoutingAnnotations, $output);
$output->writeln('Finish creating controllers.');
if ('yaml' == $manager->getRoutingType()) {
$output->writeln('Start creating routing yaml file...');
$manager->createRoutingYamlFile($conf['paths'], $output);
$output->writeln('Finish creating routing yaml file.');
}
} else {
$output->writeln('');
$output->writeln('WARNING: paths not found');
}
//security:
$security = isset($conf['security']) ? $conf['security'] : null;
$paths = isset($conf['paths']) ? $conf['paths'] : array();
$manager->createSecurityYamlFile($conf['basePath'], $security, $paths, $output);
$output->writeln('Finish creating security yaml file.');
if (!$input->getOption('no-csfixer')) {
$watcher = new Stopwatch();
$eventDispatcher = new EventDispatcher();
$dirs = array($manager->getOutputPath() . 'Controller/Api/', $manager->getOutputPath() . 'Api/Model');
$fixer = new fixer();
$fixer->setStopwatch(new Stopwatch());
$fixer->registerBuiltInFixers();
$fixer->registerBuiltInConfigs();
$config = new config();
$config->fixers($fixer->getFixers());
foreach ($dirs as $dir) {
if (file_exists($dir) && is_dir($dir)) {
$config->getFinder()->setDir($dir);
}
}
$fileProcessedEventListener = function (FixerFileProcessedEvent $event) use($output) {
$output->write($event->getStatusAsString());
};
$fixer->setEventDispatcher($eventDispatcher);
$eventDispatcher->addListener(FixerFileProcessedEvent::NAME, $fileProcessedEventListener);
$watcher->start('fixFiles');
$changed = $fixer->fix($config);
$watcher->stop('fixFiles');
$fixer->setEventDispatcher(null);
$eventDispatcher->removeListener(FixerFileProcessedEvent::NAME, $fileProcessedEventListener);
$output->writeln('');
$legend = array();
foreach (FixerFileProcessedEvent::getStatusMap() as $status) {
if ($status['symbol'] && $status['description']) {
$legend[] = $status['symbol'] . '-' . $status['description'];
}
}
$output->writeln('Legend: ' . implode(', ', array_unique($legend)));
if (OutputInterface::VERBOSITY_VERBOSE <= $verbosity) {
$i = 1;
foreach ($changed as $file => $fixResult) {
$output->writeln(sprintf('%4d) %s', $i++, $file));
}
$output->writeln('');
$fixEvent = $watcher->getEvent('fixFiles');
$output->writeln(sprintf('Fixed all files in %.3f seconds, %.3f MB memory used', $fixEvent->getDuration() / 1000, $fixEvent->getMemory() / 1024 / 1024));
}
}
}