Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
66.67% |
4 / 6 |
|
80.00% |
4 / 5 |
|
80.00% |
4 / 5 |
|
80.00% |
4 / 5 |
CRAP | |
0.00% |
0 / 1 |
| BaseController | |
66.67% |
4 / 6 |
|
80.00% |
4 / 5 |
|
80.00% |
4 / 5 |
|
80.00% |
4 / 5 |
5.20 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| logDebug | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| logInfo | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| logError | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| logWarning | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Controller; |
| 4 | |
| 5 | use App\Menu\MenuBase; |
| 6 | use App\Menu\MenuTwig; |
| 7 | use Psr\Log\LoggerInterface; |
| 8 | use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; |
| 9 | |
| 10 | class BaseController extends AbstractController |
| 11 | { |
| 12 | public MenuTwig $menuTwig; |
| 13 | protected LoggerInterface $logger; |
| 14 | |
| 15 | public function __construct(MenuBase $menu, LoggerInterface $applicationLogger) |
| 16 | { |
| 17 | $this->menuTwig = $menu->menuTwig; |
| 18 | $this->logger = $applicationLogger; |
| 19 | } |
| 20 | |
| 21 | /** |
| 22 | * Write a debug info in logger. |
| 23 | * |
| 24 | * @param mixed[] $context |
| 25 | */ |
| 26 | public function logDebug(string $message, array $context = []): void |
| 27 | { |
| 28 | $this->logger->debug($message, $context); |
| 29 | } |
| 30 | |
| 31 | /** |
| 32 | * Write an info in logger. |
| 33 | * |
| 34 | * @param mixed[] $context |
| 35 | */ |
| 36 | public function logInfo(string $message, array $context = []): void |
| 37 | { |
| 38 | $this->logger->info($message, $context); |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Write an error info in logger. |
| 43 | * |
| 44 | * @param mixed[] $context |
| 45 | */ |
| 46 | public function logError(string $message, array $context = []): void |
| 47 | { |
| 48 | $this->logger->error($message, $context); |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * Write a warning info in logger. |
| 53 | * |
| 54 | * @param mixed[] $context |
| 55 | */ |
| 56 | public function logWarning(string $message, array $context = []): void |
| 57 | { |
| 58 | $this->logger->warning($message, $context); |
| 59 | } |
| 60 | } |