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.

HelperResource   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 51
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 1
Metric Value
wmc 9
lcom 1
cbo 1
dl 51
loc 51
rs 10

9 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 5 5 1
A getName() 4 4 1
A getSpecName() 4 4 1
A getSrcFilename() 4 4 1
A getSrcNamespace() 4 4 1
A getSrcClassname() 4 4 1
A getSpecFilename() 4 4 1
A getSpecNamespace() 4 4 1
A getSpecClassname() 4 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
/**
3
 * MageSpec
4
 *
5
 * NOTICE OF LICENSE
6
 *
7
 * This source file is subject to the MIT License, that is bundled with this
8
 * package in the file LICENSE.
9
 * It is also available through the world-wide-web at this URL:
10
 *
11
 * http://opensource.org/licenses/MIT
12
 *
13
 * If you did not receive a copy of the license and are unable to obtain it
14
 * through the world-wide-web, please send an email
15
 * to <[email protected]> so we can send you a copy immediately.
16
 *
17
 * @category   MageTest
18
 * @package    PhpSpec_MagentoExtension
19
 *
20
 * @copyright  Copyright (c) 2012-2013 MageTest team and contributors.
21
 */
22
namespace MageTest\PhpSpec\MagentoExtension\Locator\Magento;
23
24
use PhpSpec\Locator\Resource as ResourceInterface;
25
26
/**
27
 * HelperResource
28
 *
29
 * @category   MageTest
30
 * @package    PhpSpec_MagentoExtension
31
 *
32
 * @author     MageTest team (https://github.com/MageTest/MageSpec/contributors)
33
 */
34 View Code Duplication
class HelperResource implements ResourceInterface
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
35
{
36
    private $parts;
37
    private $locator;
38
39
    public function __construct(array $parts, HelperLocator $locator)
40
    {
41
        $this->parts   = $parts;
42
        $this->locator = $locator;
43
    }
44
45
    public function getName()
46
    {
47
        return implode('_', $this->parts);
48
    }
49
50
    public function getSpecName()
51
    {
52
        return $this->getName() . 'Spec';
53
    }
54
55
    public function getSrcFilename()
56
    {
57
        return $this->locator->getFullSrcPath() . implode(DIRECTORY_SEPARATOR, $this->parts) . '.php';
58
    }
59
60
    public function getSrcNamespace()
61
    {
62
        return '';
63
    }
64
65
    public function getSrcClassname()
66
    {
67
        return implode('_', $this->parts);
68
    }
69
70
    public function getSpecFilename()
71
    {
72
        return $this->locator->getFullSpecPath() . implode(DIRECTORY_SEPARATOR, $this->parts) . 'Spec.php';
73
    }
74
75
    public function getSpecNamespace()
76
    {
77
        return rtrim($this->locator->getSpecNamespace(), '/\\');
78
    }
79
80
    public function getSpecClassname()
81
    {
82
        return $this->locator->getSpecNamespace() . implode('_', $this->parts).'Spec';
83
    }
84
}