Authorization::passesAuthorization()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 7
c 0
b 0
f 0
ccs 4
cts 4
cp 1
rs 10
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace FondBot\Conversation\Concerns;
6
7
use FondBot\Events\MessageReceived;
8
9
trait Authorization
10
{
11
    /**
12
     * Determine if intent passes the authorization check.
13
     *
14
     * @param MessageReceived $message
15
     *
16
     * @return bool
17
     */
18 3
    public function passesAuthorization(MessageReceived $message): bool
19
    {
20 3
        if (method_exists($this, 'authorize')) {
21 1
            return $this->authorize($message);
22
        }
23
24 2
        return true;
25
    }
26
}
27