namespace Symfony\Component\Yaml\Command;
use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Exception\InvalidArgumentException;
+use Symfony\Component\Console\Exception\RuntimeException;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
if (!$filename) {
if (!$stdin = $this->getStdin()) {
- throw new \RuntimeException('Please provide a filename or pipe file content to STDIN.');
+ throw new RuntimeException('Please provide a filename or pipe file content to STDIN.');
}
return $this->display($io, array($this->validate($stdin, $flags)));
}
if (!$this->isReadable($filename)) {
- throw new \RuntimeException(sprintf('File or directory "%s" is not readable.', $filename));
+ throw new RuntimeException(sprintf('File or directory "%s" is not readable.', $filename));
}
$filesInfo = array();
case 'json':
return $this->displayJson($io, $files);
default:
- throw new \InvalidArgumentException(sprintf('The format "%s" is not supported.', $this->format));
+ throw new InvalidArgumentException(sprintf('The format "%s" is not supported.', $this->format));
}
}
private function displayTxt(SymfonyStyle $io, array $filesInfo)
{
- $countFiles = count($filesInfo);
+ $countFiles = \count($filesInfo);
$erroredFiles = 0;
foreach ($filesInfo as $info) {
}
foreach ($this->getDirectoryIterator($fileOrDirectory) as $file) {
- if (!in_array($file->getExtension(), array('yml', 'yaml'))) {
+ if (!\in_array($file->getExtension(), array('yml', 'yaml'))) {
continue;
}
};
if (null !== $this->directoryIteratorProvider) {
- return call_user_func($this->directoryIteratorProvider, $directory, $default);
+ return \call_user_func($this->directoryIteratorProvider, $directory, $default);
}
return $default($directory);
};
if (null !== $this->isReadableProvider) {
- return call_user_func($this->isReadableProvider, $fileOrDirectory, $default);
+ return \call_user_func($this->isReadableProvider, $fileOrDirectory, $default);
}
return $default($fileOrDirectory);