Passed
Push — master ( ca7167...276d5c )
by Fabian
06:10
created

UseDevDashboard::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
1
<?php
2
3
namespace Firegento\DevDashboard\Plugin;
4
5
6
class UseDevDashboard
7
{
8
9
    /** @var \Magento\Backend\Model\Auth\Session */
0 ignored issues
show
Bug introduced by
The type Magento\Backend\Model\Auth\Session was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
    protected $_authSession;
11
12
    /** @var \Firegento\DevDashboard\Model\ConfigRepository */
13
    protected $_configRepository;
14
15
    /**
16
     * @param \Magento\Backend\Model\Auth\Session $authSession
17
     * @param \Firegento\DevDashboard\Model\ConfigRepository
18
     */
19
    public function __construct(
20
        \Magento\Backend\Model\Auth\Session $authSession,
21
        \Firegento\DevDashboard\Model\ConfigRepository $configRepository
22
    )
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
Bug introduced by
The type Magento\Backend\Model\Url was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
Unused Code introduced by
The parameter $subject is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

34
    public function aroundGetStartupPageUrl(/** @scrutinizer ignore-unused */ \Magento\Backend\Model\Url $subject, callable $callable) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
35
36
        $userId = $this->_authSession->getUser()->getId();
37
        $config = $this->_configRepository->getByUserId($userId);
38
        if($config->getData('use_devdashboard')) {
39
            return 'devdashboard/index/index';
40
        }
41
        else {
42
            return $callable();
43
        }
44
45
    }
46
}