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

ServerName::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 10
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 10
loc 10
ccs 0
cts 9
cp 0
rs 9.9332
c 0
b 0
f 0
cc 1
nc 1
nop 4
crap 2
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\Storage\GameDataStorage;
8
use FML\Controls\Control;
9
10 View Code Duplication
class ServerName 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...
11
{
12
    /** @var GameDataStorage */
13
    protected $dataStorage;
14
15
    public function __construct(
16
        ServerInformationLineFactory $serverInformationLineFactory,
17
        AdminGroups $adminGroupHelper,
18
        GameDataStorage $dataStorage,
19
        string $requiredPermission = null)
20
    {
21
        parent::__construct($serverInformationLineFactory, $adminGroupHelper, $requiredPermission);
22
23
        $this->dataStorage = $dataStorage;
24
    }
25
26
27
    /**
28
     * @inheritdoc
29
     */
30
    public function getInformation(string $login): Control
31
    {
32
        return $this->serverInformationLineFactory->create("expansion_server_information.server_name", $this->dataStorage->getServerOptions()->name);
33
    }
34
}
35