Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/translation/Command/XliffLintCommand.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\Translation\Command; | 12 namespace Symfony\Component\Translation\Command; |
13 | 13 |
14 use Symfony\Component\Console\Command\Command; | 14 use Symfony\Component\Console\Command\Command; |
15 use Symfony\Component\Console\Exception\RuntimeException; | |
15 use Symfony\Component\Console\Input\InputInterface; | 16 use Symfony\Component\Console\Input\InputInterface; |
16 use Symfony\Component\Console\Input\InputOption; | 17 use Symfony\Component\Console\Input\InputOption; |
17 use Symfony\Component\Console\Output\OutputInterface; | 18 use Symfony\Component\Console\Output\OutputInterface; |
18 use Symfony\Component\Console\Style\SymfonyStyle; | 19 use Symfony\Component\Console\Style\SymfonyStyle; |
19 | 20 |
79 $this->format = $input->getOption('format'); | 80 $this->format = $input->getOption('format'); |
80 $this->displayCorrectFiles = $output->isVerbose(); | 81 $this->displayCorrectFiles = $output->isVerbose(); |
81 | 82 |
82 if (!$filename) { | 83 if (!$filename) { |
83 if (!$stdin = $this->getStdin()) { | 84 if (!$stdin = $this->getStdin()) { |
84 throw new \RuntimeException('Please provide a filename or pipe file content to STDIN.'); | 85 throw new RuntimeException('Please provide a filename or pipe file content to STDIN.'); |
85 } | 86 } |
86 | 87 |
87 return $this->display($io, array($this->validate($stdin))); | 88 return $this->display($io, array($this->validate($stdin))); |
88 } | 89 } |
89 | 90 |
90 if (!$this->isReadable($filename)) { | 91 if (!$this->isReadable($filename)) { |
91 throw new \RuntimeException(sprintf('File or directory "%s" is not readable.', $filename)); | 92 throw new RuntimeException(sprintf('File or directory "%s" is not readable.', $filename)); |
92 } | 93 } |
93 | 94 |
94 $filesInfo = array(); | 95 $filesInfo = array(); |
95 foreach ($this->getFiles($filename) as $file) { | 96 foreach ($this->getFiles($filename) as $file) { |
96 $filesInfo[] = $this->validate(file_get_contents($file), $file); | 97 $filesInfo[] = $this->validate(file_get_contents($file), $file); |
134 case 'txt': | 135 case 'txt': |
135 return $this->displayTxt($io, $files); | 136 return $this->displayTxt($io, $files); |
136 case 'json': | 137 case 'json': |
137 return $this->displayJson($io, $files); | 138 return $this->displayJson($io, $files); |
138 default: | 139 default: |
139 throw new \InvalidArgumentException(sprintf('The format "%s" is not supported.', $this->format)); | 140 throw new InvalidArgumentException(sprintf('The format "%s" is not supported.', $this->format)); |
140 } | 141 } |
141 } | 142 } |
142 | 143 |
143 private function displayTxt(SymfonyStyle $io, array $filesInfo) | 144 private function displayTxt(SymfonyStyle $io, array $filesInfo) |
144 { | 145 { |