Completed
Pull Request — master (#397)
by De Cramer
02:34
created

PlayerListField   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 22
rs 10
c 0
b 0
f 0
ccs 0
cts 11
cp 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getElementName() 0 8 2
A isCompatible() 0 4 2
1
<?php
2
3
namespace eXpansion\Framework\Config\Ui\Fields;
4
use eXpansion\Framework\Config\Model\ConfigInterface;
5
use eXpansion\Framework\Config\Model\PlayerListConfig;
6
7
/**
8
 * Class PlayerListField
9
 *
10
 * @author    de Cramer Oliver<[email protected]>
11
 * @copyright 2018 Smile
12
 * @package eXpansion\Framework\Config\Ui\Fields
13
 */
14
class PlayerListField extends TextListField
15
{
16
    /**
17
     * @inheritdoc
18
     */
19
    protected function getElementName($element)
20
    {
21
        if (!empty($element->getNickName())) {
22
            return "{$element->getNickname()} {$element->getLogin()}";
23
        }
24
25
        return $element->getLogin();
26
    }
27
28
    /**
29
     * @inheritdoc
30
     */
31
    public function isCompatible(ConfigInterface $config): bool
32
    {
33
        return parent::isCompatible($config) && $config instanceof PlayerListConfig;
0 ignored issues
show
Bug introduced by
The class eXpansion\Framework\Config\Model\PlayerListConfig does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
34
    }
35
}