]> git.immae.eu Git - github/wallabag/wallabag.git/blame - vendor/symfony/translation/Symfony/Component/Translation/Extractor/ChainExtractor.php
gitignore vendor
[github/wallabag/wallabag.git] / vendor / symfony / translation / Symfony / Component / Translation / Extractor / ChainExtractor.php
CommitLineData
4f5b44bd
NL
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Translation\Extractor;
13
14use Symfony\Component\Translation\MessageCatalogue;
15
16/**
17 * ChainExtractor extracts translation messages from template files.
18 *
19 * @author Michel Salib <michelsalib@hotmail.com>
20 */
21class ChainExtractor implements ExtractorInterface
22{
23 /**
24 * The extractors.
25 *
26 * @var ExtractorInterface[]
27 */
28 private $extractors = array();
29
30 /**
31 * Adds a loader to the translation extractor.
32 *
33 * @param string $format The format of the loader
34 * @param ExtractorInterface $extractor The loader
35 */
36 public function addExtractor($format, ExtractorInterface $extractor)
37 {
38 $this->extractors[$format] = $extractor;
39 }
40
41 /**
42 * {@inheritDoc}
43 */
44 public function setPrefix($prefix)
45 {
46 foreach ($this->extractors as $extractor) {
47 $extractor->setPrefix($prefix);
48 }
49 }
50
51 /**
52 * {@inheritDoc}
53 */
54 public function extract($directory, MessageCatalogue $catalogue)
55 {
56 foreach ($this->extractors as $extractor) {
57 $extractor->extract($directory, $catalogue);
58 }
59 }
60}