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

InteractsWithContext   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 2
c 2
b 1
f 0
lcom 1
cbo 0
dl 0
loc 26
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A remember() 0 4 1
A user() 0 4 1
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