Completed
Pull Request — master (#404)
by De Cramer
03:04
created

ExpansionVersion   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 24
loc 24
ccs 0
cts 13
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 10 10 1
A getInformation() 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
namespace eXpansion\Bundle\ServerInformation\Services\ServerInformation;
4
5
use eXpansion\Bundle\ServerInformation\Ui\Factory\ServerInformationLineFactory;
6
use eXpansion\Framework\AdminGroups\Helpers\AdminGroups;
7
use eXpansion\Framework\Core\Helpers\Version;
8
use eXpansion\Framework\Core\Storage\GameDataStorage;
9
use eXpansion\Framework\Core\Storage\PlayerStorage;
10
use FML\Controls\Control;
11
12 View Code Duplication
class ExpansionVersion extends AbstractServerInformation
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...
13
{
14
    /** @var Version */
15
    protected $version;
16
17
    public function __construct(
18
        ServerInformationLineFactory $serverInformationLineFactory,
19
        AdminGroups $adminGroupHelper,
20
        Version $version,
21
        $requiredPermission = null
22
    ) {
23
        parent::__construct($serverInformationLineFactory, $adminGroupHelper, $requiredPermission);
24
25
        $this->version = $version;
26
    }
27
28
    /**
29
     * @inheritdoc
30
     */
31
    public function getInformation(string $login): Control
32
    {
33
        return $this->serverInformationLineFactory->create("expansion_server_information.exp_version", $this->version->getExpansionVersion());
34
    }
35
}
36