RandomVoter   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 14
c 0
b 0
f 0
wmc 2
lcom 0
cbo 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A vote() 0 8 2
1
<?php
2
3
namespace Jlis\Judge\Voters;
4
5
use Jlis\Judge\Contracts\VoterInterface;
6
7
/**
8
 * @author Julius Ehrlich <[email protected]>
9
 */
10
class RandomVoter implements VoterInterface
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15
    public function vote($parameter = null, $user = null, array $additional = [])
16
    {
17
        if (empty($parameter)) {
18
            return false;
19
        }
20
21
        return mt_rand(0, 100) <= (int) $parameter;
22
    }
23
}
24