Exemplo n.º 1
0
 /**
  * Makes sure the architecture file is readable and helps the user if not.
  *
  * @param AIConfig $config
  * @param InputInterface $input
  * @param OutputInterface $output
  *
  * @return bool
  */
 private function isValidArchitectureFile(AIConfig $config, InputInterface $input, OutputInterface $output)
 {
     $arcFile = $config->getArchitecture();
     if (is_readable($arcFile)) {
         return true;
     }
     if (file_exists($arcFile)) {
         // permission error
         $output->writeln(sprintf(CliMessage::ARCHITECTURE_FILE_NOT_READABLE, $arcFile));
     } else {
         // no architecture file present
         $helper = $this->getHelper('question');
         $question = new ConfirmationQuestion(sprintf(CliMessage::ARCHITECTURE_FILE_ASK_TO_CREATE, $arcFile), false);
         if ($helper->ask($input, $output, $question)) {
             touch($arcFile);
             $output->writeln(sprintf(CliMessage::ARCHITECTURE_FILE_CREATED_EMPTY, $arcFile));
         }
         $output->writeln(CliMessage::ARCHITECTURE_FILE_HOWTO);
     }
     return false;
 }
Exemplo n.º 2
0
 /**
  * @return Config
  */
 private function createPhpDAConfig()
 {
     return new Config(['mode' => Config::USAGE_MODE, 'source' => $this->config->getSource(), 'ignore' => $this->config->getPhpDa()['ignore'], 'formatter' => Html::class, 'target' => $this->config->getOutput() . '/analysis.html', 'filePattern' => $this->config->getPhpDa()['filePattern'], 'groupLength' => 2, 'visitor' => [TagCollector::class, SuperglobalCollector::class], 'visitorOptions' => [DeclaredNamespaceCollector::class => ['minDepth' => 2, 'sliceLength' => 20], MetaNamespaceCollector::class => ['minDepth' => 2, 'sliceLength' => 20], UsedNamespaceCollector::class => ['minDepth' => 2, 'sliceLength' => 20], TagCollector::class => ['minDepth' => 2, 'sliceLength' => 20]], 'referenceValidator' => ReferenceValidator::class]);
 }