These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | declare(strict_types=1); |
||
3 | |||
4 | namespace Nexendrie\Translation\Bridges\Tracy; |
||
5 | |||
6 | use Nexendrie\Translation\Loaders\ILoader, |
||
7 | Nexendrie\Translation\Translator, |
||
8 | Tracy\IBarPanel; |
||
9 | |||
10 | /** |
||
11 | * Debugger panel for Tracy |
||
12 | * |
||
13 | * @author Jakub Konečný |
||
14 | */ |
||
15 | 1 | class TranslationPanel implements IBarPanel { |
|
16 | /** @var Translator */ |
||
17 | protected $translator; |
||
18 | /** @var ILoader */ |
||
19 | protected $loader; |
||
20 | |||
21 | function __construct(Translator $translator, ILoader $loader) { |
||
0 ignored issues
–
show
|
|||
22 | 1 | $this->translator = $translator; |
|
23 | 1 | $this->loader = $loader; |
|
24 | 1 | } |
|
25 | |||
26 | function getTab(): string { |
||
0 ignored issues
–
show
|
|||
27 | 1 | $lang = $this->loader->getLang(); |
|
28 | 1 | $tab = file_get_contents(__DIR__ . "/TranslationPanel.tab.html"); |
|
29 | 1 | return str_replace("%lang%", $lang, $tab); |
|
30 | } |
||
31 | |||
32 | function getPanel(): string { |
||
0 ignored issues
–
show
|
|||
33 | 1 | $loader = $this->loader; |
|
34 | 1 | $translator = $this->translator; |
|
35 | 1 | $resourcesCount = count($loader->getResources(), COUNT_RECURSIVE) - count($loader->getResources()); |
|
36 | 1 | ob_start(); |
|
37 | 1 | require __DIR__ . "/TranslationPanel.panel.phtml"; |
|
38 | 1 | return ob_get_clean(); |
|
39 | } |
||
40 | } |
||
41 | ?> |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.