1 | <?php |
||
23 | final class JsFileExtractor implements FileVisitorInterface |
||
24 | { |
||
25 | /** |
||
26 | * @var FileSourceFactory |
||
27 | */ |
||
28 | private $fileSourceFactory; |
||
29 | |||
30 | /** |
||
31 | * @var JsTranslationExtractorInterface |
||
32 | */ |
||
33 | private $extractor; |
||
34 | |||
35 | /** |
||
36 | * @var string[] |
||
37 | */ |
||
38 | private $extensions; |
||
39 | |||
40 | /** |
||
41 | * JsFileExtractor constructor. |
||
42 | * |
||
43 | * @param FileSourceFactory $fileSourceFactory |
||
44 | * @param string[] $extensions |
||
45 | * @param JsTranslationExtractorInterface|null $extractor |
||
46 | */ |
||
47 | 5 | public function __construct(FileSourceFactory $fileSourceFactory, $extensions = null, JsTranslationExtractorInterface $extractor = null) |
|
53 | |||
54 | /** |
||
55 | * Called for non-specially handled files. |
||
56 | * |
||
57 | * This is not called if handled by a more specific method. |
||
58 | * |
||
59 | * @param \SplFileInfo $file |
||
60 | * @param MessageCatalogue $catalogue |
||
61 | */ |
||
62 | 4 | public function visitFile(\SplFileInfo $file, MessageCatalogue $catalogue) |
|
79 | |||
80 | /** |
||
81 | * @param \SplFileInfo $file |
||
82 | * |
||
83 | * @return TranslationCollection |
||
84 | */ |
||
85 | 3 | public function findTranslations(\SplFileInfo $file) |
|
89 | |||
90 | /** |
||
91 | * Called when a PHP file is encountered. |
||
92 | * |
||
93 | * The visitor already gets a parsed AST passed along. |
||
94 | * |
||
95 | * @param \SplFileInfo $file |
||
96 | * @param MessageCatalogue $catalogue |
||
97 | * @param array $ast |
||
98 | */ |
||
99 | 1 | public function visitPhpFile(\SplFileInfo $file, MessageCatalogue $catalogue, array $ast) |
|
102 | |||
103 | /** |
||
104 | * Called when a Twig file is encountered. |
||
105 | * |
||
106 | * The visitor already gets a parsed AST passed along. |
||
107 | * |
||
108 | * @param \SplFileInfo $file |
||
109 | * @param MessageCatalogue $catalogue |
||
110 | * @param \Twig_Node $ast |
||
111 | */ |
||
112 | 1 | public function visitTwigFile(\SplFileInfo $file, MessageCatalogue $catalogue, \Twig_Node $ast) |
|
115 | } |
||
116 |