src/Robo/Commands/Validate/TwigCommand.php
protected function executeTwigLintCommandAgainstFilesets(array $filesets) {
    $command = $this->createTwigLintCommand();

    /** @var \Acquia\Blt\Robo\Application $application */
    $application = $this->getContainer()->get('application');
    $application->add($command);

    $passed = TRUE;
    $failed_filesets = [];
    foreach ($filesets as $fileset_id => $fileset) {
      if (!is_null($fileset) && iterator_count($fileset)) {
        $this->say("Iterating over fileset $fileset_id...");
        $files = iterator_to_array($fileset);
        $input = new ArrayInput(['filename' => $files]);
        $exit_code = $application->runCommand($command, $input, $this->output());
        if ($exit_code) {
          // We iterate over all filesets before throwing an exception.
          $passed = FALSE;
          $failed_filesets[] = $fileset_id;
        }
      }
      else {
        $this->logger->info("No files were found in fileset $fileset_id. Skipped.");
      }
    }

    if (!$passed) {
      throw new BltException("Linting twig against fileset(s) " . implode(', ', $failed_filesets) . " returned a non-zero exit code.`");
    }

    // If exception wasn't thrown, checks were successful.
    $this->say("All Twig files contain valid syntax.");
  }
protected function executeTwigLintCommandAgainstFilesets(array $filesets) {
    $command = $this->createTwigLintCommand();

    /** @var \Acquia\Blt\Robo\Application $application */
    $application = $this->getContainer()->get('application');
    $application->add($command);

    $passed = TRUE;
    $failed_filesets = [];
    foreach ($filesets as $fileset_id => $fileset) {
      if (!is_null($fileset) && iterator_count($fileset)) {
        $this->say("Iterating over fileset $fileset_id...");
        $files = iterator_to_array($fileset);
        $input = new ArrayInput(['filename' => $files]);
        $exit_code = $application->runCommand($command, $input, $this->output());
        if ($exit_code) {
          // We iterate over all filesets before throwing an exception.
          $passed = FALSE;
          $failed_filesets[] = $fileset_id;
        }
      }
      else {
        $this->logger->info("No files were found in fileset $fileset_id. Skipped.");
      }
    }

    if (!$passed) {
      throw new BltException("Linting twig against fileset(s) " . implode(', ', $failed_filesets) . " returned a non-zero exit code.`");
    }

    // If exception wasn't thrown, checks were successful.
    $this->say("All Twig files contain valid syntax.");
  }
protected function executeTwigLintCommandAgainstFilesets ( array $ filesets ) { $ command = $ this -> createTwigLintCommand ( ) ; /** @var \Acquia\Blt\Robo\Application $application */ $ application = $ this -> getContainer ( ) -> get ( 'application' ) ; $ application -> add ( $ command ) ; $ passed = TRUE ; $ failed_filesets = [ ] ; foreach ( $ filesets as $ fileset_id => $ fileset ) { if ( ! is_null ( $ fileset ) && iterator_count ( $ fileset ) ) { $ this -> say ( "Iterating over fileset $fileset_id..." ) ; $ files = iterator_to_array ( $ fileset ) ; $ input = new ArrayInput ( [ 'filename' => $ files ] ) ; $ exit_code = $ application -> runCommand ( $ command , $ input , $ this -> output ( ) ) ; if ( $ exit_code ) { // We iterate over all filesets before throwing an exception. $ passed = FALSE ; $ failed_filesets [ ] = $ fileset_id ; } } else { $ this -> logger -> info ( "No files were found in fileset $fileset_id. Skipped." ) ; } } if ( ! $ passed ) { throw new BltException ( "Linting twig against fileset(s) " . implode ( ', ' , $ failed_filesets ) . " returned a non-zero exit code.`" ) ; } // If exception wasn't thrown, checks were successful. $ this -> say ( "All Twig files contain valid syntax." ) ; }
Lints twig against multiple filesets.

@param \Symfony\Component\Finder\Finder[] $filesets

@throws \Acquia\Blt\Robo\Exceptions\BltException
Lints twig against multiple filesets .