Passed
Push — master ( 236a58...055c31 )
by Vladimir
07:58
created

InteractsWithSession::context()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 1
dl 0
loc 9
ccs 5
cts 5
cp 1
crap 2
rs 9.6666
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace FondBot\Conversation\Traits;
6
7
use FondBot\Drivers\Chat;
8
use FondBot\Drivers\User;
9
use FondBot\Foundation\Kernel;
10
11
trait InteractsWithSession
12
{
13
    /** @var Kernel */
14
    protected $kernel;
15
16
    /**
17
     * Get chat.
18
     *
19
     * @return Chat
20
     */
21 1
    protected function getChat(): Chat
22
    {
23 1
        return $this->kernel->getSession()->getChat();
24
    }
25
26
    /**
27
     * Get user.
28
     *
29
     * @return User
30
     */
31 2
    protected function getUser(): User
32
    {
33 2
        return $this->kernel->getSession()->getUser();
34
    }
35
}
36