Passed
Push — 1.0 ( bc4ae1...82a12a )
by Vladimir
03:01
created

WithPayload::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace FondBot\Conversation\Activators;
6
7
use FondBot\Drivers\ReceivedMessage;
8
9
class WithPayload implements Activator
10
{
11
    private $value;
12
13 3
    public function __construct(string $value)
14
    {
15 3
        $this->value = $value;
16 3
    }
17
18
    /**
19
     * Result of matching activator.
20
     *
21
     * @param ReceivedMessage $message
22
     *
23
     * @return bool
24
     */
25 2
    public function matches(ReceivedMessage $message): bool
26
    {
27 2
        return $message->hasData() && hash_equals($this->value, $message->getData());
28
    }
29
}
30