| Conditions | 2 |
| Paths | 2 |
| Total Lines | 11 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 4 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 27 | function context(string $key = null, $default = null) |
||
|
|
|||
| 28 | { |
||
| 29 | $conversation = resolve(\FondBot\Conversation\ConversationManager::class); |
||
| 30 | |||
| 31 | $context = $conversation->getContext(); |
||
| 32 | 15 | ||
| 33 | if ($key === null) { |
||
| 34 | 15 | return $context; |
|
| 35 | } |
||
| 36 | 15 | ||
| 37 | 15 | return optional($context)->getItem($key, $default); |
|
| 38 | } |
||
| 40 |
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.