You are here

protected function LintCommand::findFiles in Twig Tweak 3.x

Same name and namespace in other branches
  1. 3.1.x src/Command/LintCommand.php \Drupal\twig_tweak\Command\LintCommand::findFiles()
1 call to LintCommand::findFiles()
LintCommand::getFilesInfo in src/Command/LintCommand.php

File

src/Command/LintCommand.php, line 143

Class

LintCommand
Command that will validate your template syntax and output encountered errors.

Namespace

Drupal\twig_tweak\Command

Code

protected function findFiles(string $filename) {
  if (is_file($filename)) {
    return [
      $filename,
    ];
  }
  elseif (is_dir($filename)) {
    return Finder::create()
      ->files()
      ->in($filename)
      ->name('*.twig');
  }
  throw new RuntimeException(sprintf('File or directory "%s" is not readable.', $filename));
}