当前位置: 首页>>代码示例>>PHP>>正文


PHP fixer::getFixers方法代码示例

本文整理汇总了PHP中fixer::getFixers方法的典型用法代码示例。如果您正苦于以下问题:PHP fixer::getFixers方法的具体用法?PHP fixer::getFixers怎么用?PHP fixer::getFixers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在fixer的用法示例。


在下文中一共展示了fixer::getFixers方法的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));
         }
     }
 }
开发者ID:enneite,项目名称:swagger-bundle,代码行数:88,代码来源:GenerateCommand.php


注:本文中的fixer::getFixers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。