Completed
Push — master ( cd535a...da42ba )
by Vladimir
02:31
created

InteractsWithContext::getUser()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace FondBot\Conversation\Traits;
6
7
use FondBot\Bot;
8
use FondBot\Contracts\Channels\User;
9
10
trait InteractsWithContext
11
{
12
    /** @var Bot */
13
    protected $bot;
14
15
    /**
16
     * Remember value in context.
17
     *
18
     * @param string $key
19
     * @param        $value
20
     */
21
    protected function remember(string $key, $value): void
22
    {
23
        $this->bot->getContext()->setValue($key, $value);
24
    }
25
26
    /**
27
     * Get user.
28
     *
29
     * @return User
30
     */
31
    public function user(): User
32
    {
33
        return $this->bot->getContext()->getUser();
34
    }
35
}
36