Completed
Push — master ( de59c0...367b4e )
by Vladimir
03:16
created

Payload   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 21
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A matches() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace FondBot\Conversation\Activators;
6
7
use FondBot\Events\MessageReceived;
8
use FondBot\Contracts\Conversation\Activator;
9
10
class Payload implements Activator
11
{
12
    protected $value;
13
14 3
    public function __construct(string $value)
15
    {
16 3
        $this->value = $value;
17 3
    }
18
19
    /**
20
     * Result of matching activator.
21
     *
22
     * @param MessageReceived $message
23
     *
24
     * @return bool
25
     */
26 2
    public function matches(MessageReceived $message): bool
27
    {
28 2
        return hash_equals($this->value, $message->getData());
29
    }
30
}
31