* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Translation\Extractor; use Symfony\Component\Translation\Exception\InvalidArgumentException; /** * Base class used by classes that extract translation messages from files. * * @author Marcos D. Sánchez */ abstract class AbstractFileExtractor { protected function extractFiles(string|iterable $resource): iterable { if (is_iterable($resource)) { $files = []; foreach ($resource as $file) { if ($this->canBeExtracted($file)) { $files[] = $this->toSplFileInfo($file); } } } elseif (is_file($resource)) { $files = $this->canBeExtracted($resource) ? [$this->toSplFileInfo($resource)] : []; } else { $files = $this->extractFromDirectory($resource); } return $files; } private function toSplFileInfo(string $file): \SplFileInfo { return new \SplFileInfo($file); } /** * @throws InvalidArgumentException */ protected function isFile(string $file): bool { if (!is_file($file)) { throw new InvalidArgumentException(sprintf('The "%s" file does not exist.', $file)); } return true; } /** * @return bool */ abstract protected function canBeExtracted(string $file); /** * @return iterable */ abstract protected function extractFromDirectory(string|array $resource); } __halt_compiler();----SIGNATURE:----n5kg5bwKPKMXUvQdH5Gm41IO373Vi6ZI+Oe3RWuLvljBdlyb8vjhPAVSdgBPt0ac+F6KqlsQ/V/DxMctTZdbkVHPkKXeE9l+3AgjTcNx8AX85j4IZ+oyp9C60b1b0LTMgPbM3zSPlOWAFKoPmOtn95WKOoXx6GlQPxUG+C1HVFfrEsoHQYGg6nO9OR0Jn7fzclKfLrI8JdzDHZe7GtYM/CNZA/fiRyrf+V26tlQ17QbAf60+ZhzGilL7isiFeK+v2B1Jf3Z2qjuEDEKs/BhHWzX4ICZzhgUwPgZa+EObXKleG8/WyAn+Q8TKyIZ2ij+geB1fUJ9Wf8TEAjrQa+kyV9HljTZzg54j+L0hFDZnhnmEXZyz0JgNh+Pa3Ik6US4ichfnJDzVC/Y/WCwWaQtBg1dBOp/XL1lgwuIDJkywccwJJ6q3ZZAsvYRLs7eIqFYsPXSOGgTEBVL1FbCE1w46RoG6OPUgzBtnvUE1vnVUu8+Ki1CqZsGWggFACcSoEtQ9KJtDqOOd0sON4xDkSuxSCdzlA0ET4hSYGzZ282Rl3TcH3IGk5j/bo/eolJqqp3/jta8WrVwwqed0XpvIX5EN/GBdQmPSvSPhP9LSiS9bDVFPA6bRTeiEmp2cIxUxt+Bs1XxLqGaTg/FLlYopwDYaQ7HoLN5NSRYpurbsYpBpSeM=----ATTACHMENT:----Nzc0NzQyMTAzOTUzMTY3NCA1Nzk2NTEzNDQ4NTM3MTIyIDU5MjM0MzU4NTUzMjA2NDQ=