Conditions | 2 |
Paths | 2 |
Total Lines | 22 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
25 | public function autorun() : void |
||
26 | { |
||
27 | $settingModel = new Model\Setting(); |
||
28 | $contentModel = new Model\Content(); |
||
29 | $dbStatus = $this->_registry->get('dbStatus'); |
||
30 | $lastTable = $this->_registry->get('lastTable'); |
||
31 | $lastId = $this->_registry->get('lastId'); |
||
32 | $path = 'languages' . DIRECTORY_SEPARATOR . $this->_filePlaceholder . '.json'; |
||
33 | $setupArray = |
||
34 | [ |
||
35 | 'query' => $this->_request->getQuery('l'), |
||
36 | 'session' => $this->_request->getSession('language'), |
||
37 | 'contents' => $contentModel->getByTableAndId($lastTable, $lastId)->language, |
||
38 | 'settings' => $dbStatus === 2 ? $settingModel->get('language') : null, |
||
39 | 'browser' => substr($this->_request->getServer('HTTP_ACCEPT_LANGUAGE'), 0, 2), |
||
40 | 'fallback' => 'en' |
||
41 | ]; |
||
42 | |||
43 | /* detect language */ |
||
44 | |||
45 | $this->_output = $this->_detect('language', $path, $setupArray); |
||
46 | } |
||
47 | } |
||
48 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.