Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| NewsUtilsTrait | |
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| newsUtils | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| setNewsUtils | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Olz\News\Utils; |
| 4 | |
| 5 | use Olz\Utils\WithUtilsCache; |
| 6 | use Symfony\Contracts\Service\Attribute\Required; |
| 7 | |
| 8 | trait NewsUtilsTrait { |
| 9 | protected function newsUtils(): NewsUtils { |
| 10 | $util = WithUtilsCache::get('newsUtils'); |
| 11 | assert($util); |
| 12 | return $util; |
| 13 | } |
| 14 | |
| 15 | #[Required] |
| 16 | public function setNewsUtils(NewsUtils $new): void { |
| 17 | WithUtilsCache::set('newsUtils', $new); |
| 18 | } |
| 19 | } |