FeatureVoter   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 14
loc 14
c 0
b 0
f 0
wmc 2
lcom 0
cbo 0
ccs 6
cts 6
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A vote() 8 8 2

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 Jlis\Judge\Voters;
4
5
use Jlis\Judge\Feature;
6
use Jlis\Judge\Contracts\VoterInterface;
7
8
/**
9
 * @author Julius Ehrlich <[email protected]>
10
 */
11 View Code Duplication
class FeatureVoter implements VoterInterface
12
{
13
    /**
14
     * {@inheritdoc}
15
     */
16 5
    public function vote($parameter = null, $user = null, array $additional = [])
17
    {
18 5
        return Feature::decide(
19 5
            $parameter,
20 5
            $user,
21 5
            isset($additional['defaultIfNotFound']) ? (bool) $additional['defaultIfNotFound'] : false
22 5
        );
23
    }
24
}
25