Conditions | 2 |
Paths | 2 |
Total Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
29 | function context(string $key = null, $default = null) |
||
|
|||
30 | { |
||
31 | /** @var Manager $conversation */ |
||
32 | 15 | $conversation = resolve(Manager::class); |
|
33 | |||
34 | 15 | $context = $conversation->getContext(); |
|
35 | |||
36 | 15 | if ($key === null) { |
|
37 | 15 | return $context; |
|
38 | } |
||
39 | |||
40 | 3 | return optional($context)->getItem($key, $default); |
|
41 | } |
||
42 | } |
||
43 |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.