Conditions | 11 |
Paths | 28 |
Total Lines | 46 |
Code Lines | 26 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
32 | public static function get(\Aimeos\MShop\ContextIface $context, |
||
33 | \TYPO3\CMS\Extbase\Mvc\RequestInterface $request = null) : \Aimeos\MShop\Locale\Item\Iface |
||
34 | { |
||
35 | if (!isset(self::$locale)) { |
||
36 | $config = $context->config(); |
||
37 | |||
38 | |||
39 | $sitecode = $config->get('mshop/locale/site', 'default'); |
||
40 | $name = $config->get('typo3/param/name/site', 'site'); |
||
41 | |||
42 | if ($request !== null && $request->hasArgument($name) === true) { |
||
43 | $sitecode = $request->getArgument($name); |
||
44 | } elseif (($value = GeneralUtility::_GP('S')) !== null) { |
||
45 | $sitecode = $value; |
||
46 | } |
||
47 | |||
48 | |||
49 | $lang = $config->get('mshop/locale/language', ''); |
||
50 | $name = $config->get('typo3/param/name/language', 'locale'); |
||
51 | |||
52 | if ($request !== null && $request->hasArgument($name) === true) { |
||
53 | $lang = $request->getArgument($name); |
||
54 | } elseif (isset($GLOBALS['TSFE']->id)) { // TYPO3 9+ |
||
55 | $langid = GeneralUtility::makeInstance('TYPO3\CMS\Core\Context\Context')->getAspect('language')->getId(); |
||
56 | $site = GeneralUtility::makeInstance('TYPO3\CMS\Core\Site\SiteFinder')->getSiteByPageId($GLOBALS['TSFE']->id); |
||
57 | $lang = substr($site->getLanguageById($langid)->getLocale(), 0, 5); |
||
58 | } |
||
59 | |||
60 | |||
61 | $currency = $config->get('mshop/locale/currency', ''); |
||
62 | $name = $config->get('typo3/param/name/currency', 'currency'); |
||
63 | |||
64 | if ($request !== null && $request->hasArgument($name) === true) { |
||
65 | $currency = $request->getArgument($name); |
||
66 | } elseif (($value = GeneralUtility::_GP('C')) !== null) { |
||
67 | $currency = $value; |
||
68 | } |
||
69 | |||
70 | |||
71 | $localeManager = \Aimeos\MShop::create($context, 'locale'); |
||
72 | self::$locale = $localeManager->bootstrap($sitecode, $lang, $currency); |
||
73 | |||
74 | $config->apply(self::$locale->getSiteItem()->getConfig()); |
||
75 | } |
||
76 | |||
77 | return self::$locale; |
||
78 | } |
||
102 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths