M-Contributions /
Setting
| 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\Framework\App\Config\ScopeConfigInterface; |
||||
| 14 | use Magento\Store\Model\ScopeInterface; |
||||
| 15 | use Magento\Store\Model\Store; |
||||
| 16 | use Ticaje\Configuration\Setting\GeneralInterface; |
||||
|
0 ignored issues
–
show
|
|||||
| 17 | |||||
| 18 | /** |
||||
| 19 | * Trait General |
||||
| 20 | * @package Ticaje\Configuration\Traits |
||||
| 21 | * Classes using this trait must implement Ticaje\Configuration\Setting\GeneralInterface |
||||
| 22 | * @Disclaimer: This trait provides the general methods for operating with all configurations within General section of adminhtml/system.xml |
||||
| 23 | */ |
||||
| 24 | trait General |
||||
| 25 | { |
||||
| 26 | protected $generalPath = 'general'; // Could be overridden by client classes |
||||
| 27 | |||||
| 28 | /** |
||||
| 29 | * @inheritDoc |
||||
| 30 | */ |
||||
| 31 | public function getGeneralConfig($field = null, $storeId = null): string |
||||
| 32 | { |
||||
| 33 | return $this->scopeConfig->getValue($this->getXmlGeneralPath($field), ScopeInterface::SCOPE_STORE, $storeId) ?: ''; |
||||
| 34 | } |
||||
| 35 | |||||
| 36 | /** |
||||
| 37 | * @inheritDoc |
||||
| 38 | */ |
||||
| 39 | public function setValue($field, $value, $storeId = null): GeneralInterface |
||||
| 40 | { |
||||
| 41 | $storeId = $storeId ?: Store::DEFAULT_STORE_ID; |
||||
| 42 | $scope = $storeId == Store::DEFAULT_STORE_ID ? ScopeConfigInterface::SCOPE_TYPE_DEFAULT : ScopeInterface::SCOPE_STORES; |
||||
| 43 | $this->resourceConfig->saveConfig($this->getXmlGeneralPath($field), $value, $scope, $storeId); |
||||
| 44 | return $this; |
||||
| 45 | } |
||||
| 46 | |||||
| 47 | /** |
||||
| 48 | * @inheritDoc |
||||
| 49 | */ |
||||
| 50 | public function getXmlGeneralPath($field): string |
||||
| 51 | { |
||||
| 52 | $xmlPath = $this->getXmlBasePath() . '/' . $this->getGeneralPath(); |
||||
|
0 ignored issues
–
show
It seems like
getXmlBasePath() 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
Loading history...
|
|||||
| 53 | if ($field) { |
||||
| 54 | $xmlPath .= '/' . $field; |
||||
| 55 | } |
||||
| 56 | return $xmlPath; |
||||
| 57 | } |
||||
| 58 | |||||
| 59 | /** |
||||
| 60 | * @inheritDoc |
||||
| 61 | */ |
||||
| 62 | public function getGeneralPath(): string |
||||
| 63 | { |
||||
| 64 | return $this->generalPath; |
||||
| 65 | } |
||||
| 66 | } |
||||
| 67 |
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