1 | <?php |
||||||
2 | declare(strict_types=1); |
||||||
3 | |||||||
4 | /** |
||||||
5 | * Status Trait |
||||||
6 | * @category Ticaje |
||||||
7 | * @package Ticaje_Setting |
||||||
8 | * @author Hector Luis Barrientos <[email protected]> |
||||||
9 | */ |
||||||
10 | |||||||
11 | namespace Ticaje\Configuration\Traits; |
||||||
12 | |||||||
13 | use Magento\Store\Model\ScopeInterface; |
||||||
14 | |||||||
15 | /** |
||||||
16 | * Trait Status |
||||||
17 | * @package Ticaje\Configuration\Traits |
||||||
18 | * Classes using this trait must implement Ticaje\Configuration\GeneralInterface |
||||||
19 | */ |
||||||
20 | trait Status |
||||||
21 | { |
||||||
22 | /** |
||||||
23 | * @inheritDoc |
||||||
24 | */ |
||||||
25 | public function isEnabled($storeId = null): bool |
||||||
26 | { |
||||||
27 | $field = self::XML_FIELD_ENABLED; |
||||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||||
28 | $config = $this->scopeConfig->getValue($this->getXmlGeneralPath($field), ScopeInterface::SCOPE_STORE, $storeId) ?: ''; |
||||||
0 ignored issues
–
show
It seems like
getXmlGeneralPath() must be provided by classes using this trait. How about adding it as abstract method to this trait?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
29 | return (bool)$config; |
||||||
30 | } |
||||||
31 | |||||||
32 | /** |
||||||
33 | * @inheritDoc |
||||||
34 | */ |
||||||
35 | public function enable($storeId = null) |
||||||
36 | { |
||||||
37 | $value = (string)(int)(bool)self::ENABLED_VALUE; |
||||||
0 ignored issues
–
show
|
|||||||
38 | $this->setValue(self::XML_FIELD_ENABLED, $value, $storeId); |
||||||
0 ignored issues
–
show
It seems like
setValue() must be provided by classes using this trait. How about adding it as abstract method to this trait?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
39 | } |
||||||
40 | |||||||
41 | /** |
||||||
42 | * @inheritDoc |
||||||
43 | */ |
||||||
44 | public function disable($storeId = null) |
||||||
45 | { |
||||||
46 | $value = (string)(int)(bool)self::DISABLED_VALUE; |
||||||
0 ignored issues
–
show
|
|||||||
47 | $this->setValue(self::XML_FIELD_ENABLED, $value, $storeId); |
||||||
0 ignored issues
–
show
|
|||||||
48 | } |
||||||
49 | } |
||||||
50 |