This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Bundle/FrameworkBundle/Command/XliffLintCommand.php
Nicolas Grekas f5939a8336 Merge branch '2.8' into 3.4
* 2.8:
  Fix Clidumper tests
  Enable the fixer enforcing fully-qualified calls for compiler-optimized functions
  Apply fixers
  Disable the native_constant_invocation fixer until it can be scoped
  Update the list of excluded files for the CS fixer
2018-07-26 10:45:46 +02:00

63 lines
1.5 KiB
PHP

<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\FrameworkBundle\Command;
use Symfony\Component\Translation\Command\XliffLintCommand as BaseLintCommand;
/**
* Validates XLIFF files syntax and outputs encountered errors.
*
* @author Grégoire Pineau <lyrixx@lyrixx.info>
* @author Robin Chalas <robin.chalas@gmail.com>
* @author Javier Eguiluz <javier.eguiluz@gmail.com>
*
* @final
*/
class XliffLintCommand extends BaseLintCommand
{
protected static $defaultName = 'lint:xliff';
public function __construct()
{
$directoryIteratorProvider = function ($directory, $default) {
if (!is_dir($directory)) {
$directory = $this->getApplication()->getKernel()->locateResource($directory);
}
return $default($directory);
};
$isReadableProvider = function ($fileOrDirectory, $default) {
return 0 === strpos($fileOrDirectory, '@') || $default($fileOrDirectory);
};
parent::__construct(null, $directoryIteratorProvider, $isReadableProvider);
}
/**
* {@inheritdoc}
*/
protected function configure()
{
parent::configure();
$this->setHelp($this->getHelp().<<<'EOF'
Or find all files in a bundle:
<info>php %command.full_name% @AcmeDemoBundle</info>
EOF
);
}
}