Completed
Push — master ( ebdf7a...2dba39 )
by Vladimir
05:12
created

kernel()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 1
Metric Value
eloc 1
dl 0
loc 3
c 2
b 0
f 1
ccs 1
cts 1
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
if (!function_exists('context')) {
6
    /**
7
     * Get context.
8
     *
9
     * @param string|null $key
10
     *
11
     * @param mixed|null  $default
12
     *
13
     * @return \FondBot\Conversation\Context|mixed
14
     */
15 1
    function context(string $key = null, $default = null)
16
    {
17
        $context = FondBot\Conversation::instance()->context();
18
19
        if ($key === null) {
20
            return $context;
21
        }
22
23
        return optional($context)->getItem($key, $default);
24
    }
25
}
26