1 | <?php |
||
2 | |||
3 | namespace Firegento\DevDashboard\Plugin; |
||
4 | |||
5 | use Firegento\DevDashboard\Model\Config; |
||
6 | |||
7 | class UseDevDashboard |
||
8 | { |
||
9 | |||
10 | /** @var \Magento\Backend\Model\Auth\Session */ |
||
11 | protected $_authSession; |
||
12 | |||
13 | /** @var \Firegento\DevDashboard\Api\ConfigRepositoryInterface */ |
||
14 | protected $_configRepository; |
||
15 | |||
16 | /** |
||
17 | * @param \Magento\Backend\Model\Auth\Session $authSession |
||
18 | * @param \Firegento\DevDashboard\Api\ConfigRepositoryInterface $configRepositoryInterface |
||
19 | */ |
||
20 | public function __construct( |
||
21 | \Magento\Backend\Model\Auth\Session $authSession, |
||
22 | \Firegento\DevDashboard\Api\ConfigRepositoryInterface $configRepository |
||
23 | ) { |
||
24 | $this->_authSession = $authSession; |
||
25 | $this->_configRepository = $configRepository; |
||
26 | } |
||
27 | |||
28 | /** |
||
29 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
||
30 | * @param \Magento\Backend\Model\Url $subject |
||
31 | * @param callable $callable |
||
32 | * @return string |
||
33 | */ |
||
34 | public function aroundGetStartupPageUrl(\Magento\Backend\Model\Url $subject, callable $callable) |
||
0 ignored issues
–
show
|
|||
35 | { |
||
36 | |||
37 | $userId = $this->_authSession->getUser()->getId(); |
||
38 | |||
39 | /** @var Config $config */ |
||
40 | $config = $this->_configRepository->getByUserId($userId); |
||
41 | if ($config->getData('use_devdashboard')) { |
||
42 | return 'devdashboard/index/index'; |
||
43 | } |
||
44 | |||
45 | return $callable(); |
||
46 | } |
||
47 | } |
||
48 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.