Total Complexity | 3 |
Total Lines | 39 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | trait HasContext |
||
8 | { |
||
9 | /** @var string */ |
||
10 | protected $context = 'querydetector'; |
||
11 | |||
12 | /** |
||
13 | * Set specific context for the executed queries. |
||
14 | * |
||
15 | * @param string $context |
||
16 | * @return self |
||
17 | */ |
||
18 | public function setContext(string $context): self |
||
19 | { |
||
20 | $this->context = $context; |
||
21 | |||
22 | return $this; |
||
23 | } |
||
24 | |||
25 | /** |
||
26 | * Get the current context name |
||
27 | * |
||
28 | * @param string $context |
||
29 | * @return self |
||
30 | */ |
||
31 | public function getContext(): string |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * Generate a new context for the executed queries. |
||
38 | * |
||
39 | * @return self |
||
40 | */ |
||
41 | public function newContext(): self |
||
46 | } |
||
47 | } |