comparison vendor/symfony/yaml/Command/LintCommand.php @ 16:c2387f117808

Routine composer update
author Chris Cannam
date Tue, 10 Jul 2018 15:07:59 +0100
parents 1fec387a4317
children 129ea1e6d783
comparison
equal deleted inserted replaced
15:e200cb7efeb3 16:c2387f117808
10 */ 10 */
11 11
12 namespace Symfony\Component\Yaml\Command; 12 namespace Symfony\Component\Yaml\Command;
13 13
14 use Symfony\Component\Console\Command\Command; 14 use Symfony\Component\Console\Command\Command;
15 use Symfony\Component\Console\Exception\InvalidArgumentException;
16 use Symfony\Component\Console\Exception\RuntimeException;
15 use Symfony\Component\Console\Input\InputInterface; 17 use Symfony\Component\Console\Input\InputInterface;
16 use Symfony\Component\Console\Input\InputOption; 18 use Symfony\Component\Console\Input\InputOption;
17 use Symfony\Component\Console\Output\OutputInterface; 19 use Symfony\Component\Console\Output\OutputInterface;
18 use Symfony\Component\Console\Style\SymfonyStyle; 20 use Symfony\Component\Console\Style\SymfonyStyle;
19 use Symfony\Component\Yaml\Exception\ParseException; 21 use Symfony\Component\Yaml\Exception\ParseException;
84 $this->displayCorrectFiles = $output->isVerbose(); 86 $this->displayCorrectFiles = $output->isVerbose();
85 $flags = $input->getOption('parse-tags') ? Yaml::PARSE_CUSTOM_TAGS : 0; 87 $flags = $input->getOption('parse-tags') ? Yaml::PARSE_CUSTOM_TAGS : 0;
86 88
87 if (!$filename) { 89 if (!$filename) {
88 if (!$stdin = $this->getStdin()) { 90 if (!$stdin = $this->getStdin()) {
89 throw new \RuntimeException('Please provide a filename or pipe file content to STDIN.'); 91 throw new RuntimeException('Please provide a filename or pipe file content to STDIN.');
90 } 92 }
91 93
92 return $this->display($io, array($this->validate($stdin, $flags))); 94 return $this->display($io, array($this->validate($stdin, $flags)));
93 } 95 }
94 96
95 if (!$this->isReadable($filename)) { 97 if (!$this->isReadable($filename)) {
96 throw new \RuntimeException(sprintf('File or directory "%s" is not readable.', $filename)); 98 throw new RuntimeException(sprintf('File or directory "%s" is not readable.', $filename));
97 } 99 }
98 100
99 $filesInfo = array(); 101 $filesInfo = array();
100 foreach ($this->getFiles($filename) as $file) { 102 foreach ($this->getFiles($filename) as $file) {
101 $filesInfo[] = $this->validate(file_get_contents($file), $flags, $file); 103 $filesInfo[] = $this->validate(file_get_contents($file), $flags, $file);
131 case 'txt': 133 case 'txt':
132 return $this->displayTxt($io, $files); 134 return $this->displayTxt($io, $files);
133 case 'json': 135 case 'json':
134 return $this->displayJson($io, $files); 136 return $this->displayJson($io, $files);
135 default: 137 default:
136 throw new \InvalidArgumentException(sprintf('The format "%s" is not supported.', $this->format)); 138 throw new InvalidArgumentException(sprintf('The format "%s" is not supported.', $this->format));
137 } 139 }
138 } 140 }
139 141
140 private function displayTxt(SymfonyStyle $io, array $filesInfo) 142 private function displayTxt(SymfonyStyle $io, array $filesInfo)
141 { 143 {