Passed
Push — master ( 61fa52...b9d74d )
by Vladimir
13:13
created

Intent::passesAuthorization()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace FondBot\Conversation;
6
7
use FondBot\Bot;
8
use FondBot\Conversation\Traits\Transitions;
9
use FondBot\Conversation\Activators\Activator;
10
use FondBot\Conversation\Traits\Authorization;
11
use FondBot\Conversation\Traits\HasActivators;
12
use FondBot\Conversation\Traits\SendsMessages;
13
use FondBot\Conversation\Traits\InteractsWithContext;
14
15
abstract class Intent implements Conversable
16
{
17
    use InteractsWithContext,
18
        SendsMessages,
19
        Authorization,
20
        HasActivators,
21
        Transitions;
22
23
    /**
24
     * Determine if intent passes the authorization check.
25
     *
26
     * @return bool
27
     */
28 1
    public function passesAuthorization(): bool
29
    {
30 1
        return true;
31
    }
32
33
    /**
34
     * Intent activators.
35
     *
36
     * @return Activator[]
37
     */
38
    abstract public function activators(): array;
39
40
    /**
41
     * Run intent.
42
     */
43
    abstract public function run(): void;
44
45
    /**
46
     * Handle intent.
47
     *
48
     * @param Bot $bot
49
     */
50 2
    public function handle(Bot $bot): void
51
    {
52 2
        $this->bot = $bot;
53 2
        $this->run();
54 2
    }
55
}
56