RandomVoter::vote()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
c 0
b 0
f 0
rs 9.4285
cc 2
eloc 4
nc 2
nop 3
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