Chance   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 4
dl 0
loc 18
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
namespace linkprofit\Chance;
4
5
use linkprofit\Chance\Strategies\StrategyFactory;
6
use linkprofit\Chance\Strategies\CalculationStrategyInterface;
7
8
/**
9
 * Расчёт вероятности на основе заданных параметров
10
 */
11
class Chance
12
{
13
    /** @var CalculationStrategyInterface */
14
    protected $strategy;
15
16 4
    public function __construct($value)
17
    {
18 4
        $this->strategy = (new StrategyFactory)->create($value);
19 4
    }
20
21
    /**
22
     * Расчитываем вероятность
23
     *
24
     * @return bool
25
     */
26 2
    public function get(): bool
27
    {
28 2
        return $this->strategy->calculate();
29
    }
30
}
31