Total Complexity | 5 |
Total Lines | 63 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
6 | class SaveConfig |
||
7 | { |
||
8 | |||
9 | protected $_whitelist =[ |
||
10 | 'user_id', |
||
11 | 'configuration', |
||
12 | 'use_devdashboard' |
||
13 | ]; |
||
14 | |||
15 | protected $_configRepository; |
||
16 | |||
17 | protected $_messageManager; |
||
18 | |||
19 | /** |
||
20 | * SaveConfig constructor. |
||
21 | * @param \Firegento\DevDashboard\Model\ConfigFactory $configRepository |
||
|
|||
22 | * @param \Magento\Framework\Message\ManagerInterface $messageManager |
||
23 | */ |
||
24 | public function __construct( |
||
25 | \Firegento\DevDashboard\Model\ConfigRepository $configRepository, |
||
26 | \Magento\Framework\Message\ManagerInterface $messageManager |
||
27 | ) { |
||
28 | $this->_configRepository = $configRepository; |
||
29 | $this->_messageManager = $messageManager; |
||
30 | } |
||
31 | |||
32 | |||
33 | /** |
||
34 | * @param \Magento\User\Controller\Adminhtml\User\Save $subject |
||
35 | * @return array|void |
||
36 | * @throws \Exception |
||
37 | */ |
||
38 | public function afterExecute(\Magento\User\Controller\Adminhtml\User\Save $subject) |
||
39 | { |
||
40 | $userId = (int)$subject->getRequest()->getParam('user_id'); |
||
41 | $data = $subject->getRequest()->getPostValue(); |
||
42 | $data = $this->_filterData($data); |
||
43 | |||
44 | try { |
||
45 | |||
46 | /** @var \Firegento\DevDashboard\Model\Config $model */ |
||
47 | $model = $this->_configRepository->getByUserId($userId); |
||
48 | $model->setData($data); |
||
49 | $this->_configRepository->save($model); |
||
50 | |||
51 | } catch (\Exception $e) { |
||
52 | $this->_messageManager->addErrorMessage($e->getMessage()); |
||
53 | } |
||
54 | return []; |
||
55 | } |
||
56 | |||
57 | /** |
||
58 | * @param $data |
||
59 | * @return array |
||
60 | */ |
||
61 | protected function _filterData($data) |
||
69 | } |
||
70 | } |
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