Debian Codegraph @

lib/3rdParty/composer/symfony/translation/Extractor/ChainExtractor.php

raw symbols SCIP
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <[email protected]>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Symfony\Component\Translation\Extractor;
13
14 use Symfony\Component\Translation\MessageCatalogue;
15
16 /**
17 * ChainExtractor extracts translation messages from template files.
18 *
19 * @author Michel Salib <[email protected]>
20 */
21 class ChainExtractor implements ExtractorInterface
22 {
23 /**
24 * The extractors.
25 *
26 * @var ExtractorInterface[]
27 */
28 private array $extractors = [];
29
30 /**
31 * Adds a loader to the translation extractor.
32 */
33 public function addExtractor(string $format, ExtractorInterface $extractor): void
34 {
35 $this->extractors[$format] = $extractor;
36 }
37
38 public function setPrefix(string $prefix): void
39 {
40 foreach ($this->extractors as $extractor) {
41 $extractor->setPrefix($prefix);
42 }
43 }
44
45 public function extract(string|iterable $directory, MessageCatalogue $catalogue): void
46 {
47 foreach ($this->extractors as $extractor) {
48 $extractor->extract($directory, $catalogue);
49 }
50 }
51 }