11<?php
22
3+ declare (strict_types=1 );
4+
35namespace Magepow \InfiniteScroll \Helper ;
46
57class Data extends \Magento \Framework \App \Helper \AbstractHelper
@@ -11,34 +13,46 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper
1113
1214 public function __construct (
1315 \Magento \Framework \App \Helper \Context $ context
14- )
15- {
16+ ) {
1617 parent ::__construct ($ context );
1718 $ this ->configModule = $ this ->getConfig (strtolower ($ this ->_getModuleName ()));
1819 }
1920
20- public function getConfig ($ cfg ='' )
21+ /**
22+ * @param string $cfg
23+ * @return \Magento\Framework\App\Config\ScopeConfigInterface|mixed
24+ */
25+ public function getConfig (string $ cfg = '' )
2126 {
22- if ($ cfg ) return $ this ->scopeConfig ->getValue ( $ cfg , \Magento \Store \Model \ScopeInterface::SCOPE_STORE );
27+ if ($ cfg ) {
28+ return $ this ->scopeConfig ->getValue ($ cfg , \Magento \Store \Model \ScopeInterface::SCOPE_STORE );
29+ }
2330 return $ this ->scopeConfig ;
2431 }
2532
26- public function getConfigModule ($ cfg ='' , $ value =null )
33+ /**
34+ * @param string $cfg
35+ * @param null $value
36+ * @return array|\Magento\Framework\App\Config\ScopeConfigInterface|mixed|null
37+ */
38+ public function getConfigModule (string $ cfg = '' , $ value = null )
2739 {
2840 $ values = $ this ->configModule ;
29- if ( !$ cfg ) return $ values ;
30- $ config = explode ('/ ' , $ cfg );
31- $ end = count ($ config ) - 1 ;
41+ if (!$ cfg ) {
42+ return $ values ;
43+ }
44+ $ config = explode ('/ ' , $ cfg );
45+ $ end = count ($ config ) - 1 ;
3246 foreach ($ config as $ key => $ vl ) {
33- if ( isset ($ values [$ vl ]) ) {
34- if ( $ key == $ end ) {
47+ if ( isset ($ values [$ vl ])) {
48+ if ( $ key === $ end ) {
3549 $ value = $ values [$ vl ];
36- }else {
50+ } else {
3751 $ values = $ values [$ vl ];
3852 }
39- }
53+ }
4054
4155 }
4256 return $ value ;
4357 }
44- }
58+ }
0 commit comments