These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | namespace Kunstmaan\TranslatorBundle\Service\Command\Exporter; |
||
3 | |||
4 | use Kunstmaan\TranslatorBundle\Model\Export\ExportFile; |
||
5 | |||
6 | /** |
||
7 | * Responsible for exporting translations into files |
||
8 | */ |
||
9 | class Exporter |
||
10 | { |
||
11 | /** |
||
12 | * Array of all translation exporter |
||
13 | * @var array |
||
14 | */ |
||
15 | private $exporters = array(); |
||
16 | |||
17 | public function getExportedContent(ExportFile $exportFile) |
||
0 ignored issues
–
show
|
|||
18 | { |
||
19 | return $this->getExporterByExtension($exportFile->getExtension())->export($exportFile->getArray()); |
||
20 | } |
||
21 | |||
22 | public function getExporterByExtension($extension) |
||
0 ignored issues
–
show
The return type could not be reliably inferred; please add a
@return annotation.
Our type inference engine in quite powerful, but sometimes the code does not
provide enough clues to go by. In these cases we request you to add a ![]() |
|||
23 | { |
||
24 | foreach ($this->exporters as $exporter) { |
||
25 | if ($exporter->supports($extension)) { |
||
26 | return $exporter; |
||
27 | } |
||
28 | } |
||
29 | |||
30 | throw new \Exception(sprintf('No %s file exporter found or defined.', $extension)); |
||
31 | } |
||
32 | |||
33 | public function setExporters($exporters) |
||
34 | { |
||
35 | $this->exporters = $exporters; |
||
36 | } |
||
37 | } |
||
38 |
Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a
@return
annotation as described here.