| Total Complexity | 7 |
| Total Lines | 46 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | class Logger implements LoggerInterface |
||
| 19 | { |
||
| 20 | private $entityDeleteLogs = []; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @var \Doctrine\Common\Persistence\ManagerRegistry |
||
| 24 | */ |
||
| 25 | private $doctrine; |
||
| 26 | |||
| 27 | public function __construct(ManagerRegistry $doctrine) |
||
| 28 | { |
||
| 29 | $this->doctrine = $doctrine; |
||
| 30 | } |
||
| 31 | |||
| 32 | public function log(AuditLog $event = null) |
||
| 33 | { |
||
| 34 | if (empty($event)) { |
||
| 35 | return; |
||
| 36 | } |
||
| 37 | |||
| 38 | if (DoctrineEvents::ENTITY_DELETED === $event->getTypeId()) { |
||
| 39 | $this->entityDeleteLogs[] = $event; |
||
| 40 | |||
| 41 | return; |
||
| 42 | } |
||
| 43 | |||
| 44 | $this->saveLog($event); |
||
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @param AuditLog $event |
||
| 49 | */ |
||
| 50 | protected function saveLog(AuditLog $event) |
||
| 55 | } |
||
| 56 | |||
| 57 | public function savePendingLogs() |
||
| 66 |