GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

ExtractNavigationXpathTest   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 7
c 1
b 0
f 0
lcom 1
cbo 3
dl 0
loc 59
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setUrl() 0 4 1
A setCategory() 0 4 1
A getBaseXpath() 0 4 1
A getChildXpath() 0 4 1
A testExecute() 0 14 3
1
<?php
2
3
namespace Magium\Magento\Cli\Command\Test;
4
5
use Magium\Extractors\Navigation\Menu;
6
use Magium\Magento\AbstractMagentoTestCase;
7
8
class ExtractNavigationXpathTest extends AbstractMagentoTestCase
9
{
10
11
    protected $baseXpath;
12
    protected $childXpath;
13
14
    protected $url;
15
    protected $category;
16
17
    /**
18
     * @param mixed $url
19
     */
20
    public function setUrl($url)
21
    {
22
        $this->url = $url;
23
    }
24
25
    /**
26
     * @param mixed $category
27
     */
28
    public function setCategory($category)
29
    {
30
        $this->category = $category;
31
    }
32
33
    /**
34
     * @return mixed
35
     */
36
    public function getBaseXpath()
37
    {
38
        return $this->baseXpath;
39
    }
40
41
    /**
42
     * @return mixed
43
     */
44
    public function getChildXpath()
45
    {
46
        return $this->childXpath;
47
    }
48
49
50
51
    public function testExecute()
52
    {
53
        if (!$this->category || !$this->url) {
54
            throw new MissingConfigurationException('Both the category and the url must be provided');
55
        }
56
        $this->commandOpen($this->url);
57
58
        $extractor = $this->getExtractor(Menu::EXTRACTOR);
59
        /* @var $extractor Menu */
60
        $extractor->setPath($this->category);
61
        $extractor->extract();
62
        $this->baseXpath = $extractor->getBaseXpath();
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $this->baseXpath is correct as $extractor->getBaseXpath() (which targets Magium\Extractors\Navigation\Menu::getBaseXpath()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
63
        $this->childXpath = $extractor->getChildXpath();
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $this->childXpath is correct as $extractor->getChildXpath() (which targets Magium\Extractors\Navigation\Menu::getChildXpath()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
64
    }
65
66
}