* * 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:----s5ppL/zCu5YOv9XPKfEg0PiiUCM8N4sn0THwUzoFV9FpX/bNrmD8Z2UwFUxq0s1mdOMk5930B0YOIn0kkkTHx6xZjKoD7Y9eRhvzc213FL6/uL/8X5CC7m/xeEW7cND1TNQ9tvCJKvqTBAajnlrD/+krZYCRCN3rrvTupwFvH7ZhWYVzv3HFSC+muRw22cDvYQ/TkGmUCvomQAYoZGC9o1jNWB6OyxgiDLQ4fDCisvKBZ5FmmpVawNj8pPurNn17i9j8GaZDY69CTGnqQzEn1Fqb4S8LgniBHuilBBV2lQxjJ15JnbSRU/IiSQ8IfZwWnglxcyOpfLECDc+kquiIuKoen5kZRXPnY+LFQTauAI0kgg5ADQMAE5UskJ0ln/0W3i7vx43v6L8YFkQ9DLKS2VDIwk3Qiu5kbLJlDLDUkvBHUobjiGMg8Ma+S/V9pdicTu1aDA/DrcOOfL6MLx8iMB8ouTavcq5AFXPKOMOosotCyAyLYymSZa5v6FKfFEYKsPK+UeoCnaVGpKyVjMMxszwXISGU7kF795LC2UX9dowHY41Ixs4eL451jC56tvucwIU52/q878dS/y2Dtml7q3vLbqn9oA5QbYTqVZw8voVlchJTjI1U4AK+WTtx4A5rpjjO7WiEe6BKSQ00w6BzlUpVjQLybIWCydDSADyEFOQ=----ATTACHMENT:----OTM2Mzc2OTE2MTk5MjEzMiA3NjYyOTI3NDkwNDg1MjY3IDI4MzI3MDUzNDQ3NTE3Njg=