Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 4 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| LogTrait | |
0.00% |
0 / 4 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
| log | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| setLog | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Olz\Utils; |
| 4 | |
| 5 | use Psr\Log\LoggerAwareTrait; |
| 6 | use Psr\Log\LoggerInterface; |
| 7 | use Symfony\Contracts\Service\Attribute\Required; |
| 8 | |
| 9 | trait LogTrait { |
| 10 | use LoggerAwareTrait; |
| 11 | |
| 12 | protected function log(): LoggerInterface { |
| 13 | $util = WithUtilsCache::get('log'); |
| 14 | assert($util); |
| 15 | return $util; |
| 16 | } |
| 17 | |
| 18 | #[Required] |
| 19 | public function setLog(LoggerInterface $new): void { |
| 20 | $this->logger = $new; |
| 21 | WithUtilsCache::set('log', $new); |
| 22 | } |
| 23 | } |