RequestRateProcessor   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 13
Bugs 0 Features 2
Metric Value
wmc 3
c 13
b 0
f 2
lcom 1
cbo 1
dl 0
loc 29
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A isPassed() 0 4 1
A afterCheckPassed() 0 5 1
A setCollector() 0 5 1
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
}