Lines
85.71%
6 / 7
Methods
50.00%
1 / 2
Classes
0.00%
0 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| process | 83.33% | 5 / 6 | 0.00% | 0 / 1 | 2.02 | ||
| 22 | final readonly class AgentStatProcessor implements ProcessorInterface | |
| 23 | { | |
| 24 | public function __construct( | |
| 25 | private AgentStatService $agentStatService, | |
| 26 | private Security $security, | |
| 27 | private ChatActivity $chatActivity, | |
| 28 | ) { | |
| 29 | } | |
| 30 | ||
| 31 | public function process(mixed $data, Operation $operation, array $uriVariables = [], array $context = []): AgentStat | |
| 32 | { | |
| 33 | $user = $this->security->getUser(); | |
| 34 | if (!$user instanceof User) { | |
| 35 | throw new \LogicException('The operation requires ROLE_USER.'); | |
| 36 | } | |
| 37 | ||
| 38 | $agentStat = $this->agentStatService->create($user, $data); | |
| 39 | $this->chatActivity->statsUploaded($agentStat); | |
| 40 | ||
| 41 | return $agentStat; | |
| 42 | } | |
| 43 | } |