Completed
Push — master ( 066d89...19607d )
by De
01:54
created

RequestRateProcessor::setRequestRate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 4
Bugs 0 Features 0
Metric Value
c 4
b 0
f 0
dl 0
loc 6
rs 9.4286
cc 1
eloc 4
nc 1
nop 2
1
<?php
2
3
namespace Sokil\FraudDetector\Processor;
4
5
use Sokil\FraudDetector\Collector\CollectorInterface;
6
7
class RequestRateProcessor extends AbstractProcessor
8
{
9
    private $requestNumber = 1;
10
11
    private $timeInterval = 1;
12
13
    /**
14
     *
15
     * @var \Sokil\FraudDetector\RequestRate\Collector\CollectorInterface
16
     */
17
    private $collector;
18
19
    public function isPassed()
20
    {
21
        return !$this->collector->isRateLimitExceed();
22
    }
23
24
    public function afterCheckPassed()
25
    {
26
        $this->collector->collect();
27
        return $this;
28
    }
29
30
    public function setCollector(CollectorInterface $collector)
31
    {
32
        $this->collector = $collector;
0 ignored issues
show
Documentation Bug introduced by
It seems like $collector of type object<Sokil\FraudDetect...tor\CollectorInterface> is incompatible with the declared type object<Sokil\FraudDetect...tor\CollectorInterface> of property $collector.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
33
        return $this;
34
    }
35
}