|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?php
-
- namespace Lc\SovBundle\Solver\Ticket;
-
- use Lc\SovBundle\Model\Ticket\TicketInterface;
- use Lc\SovBundle\Model\Ticket\TicketModel;
-
- class TicketSolver
- {
- public function getTypeChoices(): array
- {
- return [
- TicketModel::TYPE_GENERAL_QUESTION,
- TicketModel::TYPE_TECHNICAL_PROBLEM,
- ];
- }
-
- public function getStatusChoices(): array
- {
- return [
- TicketModel::TICKET_STATUS_OPEN,
- TicketModel::TICKET_STATUS_BEING_PROCESSED,
- TicketModel::TICKET_STATUS_CLOSED,
- ];
- }
-
- public function getTypeLabel(TicketInterface $ticket): string
- {
- return 'entity.Ticket.fields.typeChoices.'.$ticket->getType();
- }
-
- public function getStatusLabel(TicketInterface $ticket): string
- {
- return 'entity.Ticket.fields.statusChoices.'.$ticket->getStatus();
- }
-
- public function getUsername(TicketInterface $ticket)
- {
- if ($ticket->getUser()) {
- return $ticket->getUser()->getName();
- } else {
- return strtoupper($ticket->getVisitorLastname()).' '.$ticket->getVisitorFirstname();
- }
- }
-
- public function getUserInfosTicket(TicketInterface $ticket)
- {
- $user = $ticket->getUser();
- if ($user) {
- return '#'.$user->getId().' '.$user->getName().' '.$user->getEmail();
- } else {
- return strtoupper($ticket->getVisitorLastname()).' '.$ticket->getVisitorFirstname().' '.$ticket->getVisitorEmail(
- );
- }
- }
-
- public function getEmail(TicketInterface $ticket)
- {
- if ($ticket->getUser()) {
- return $ticket->getUser()->getEmail();
- } else {
- return $ticket->getVisitorEmail();
- }
- }
-
- public function getVisitorInfos(TicketInterface $ticket)
- {
- return strtoupper($ticket->getVisitorLastname()).' '.$ticket->getVisitorFirstname().' ('.$ticket->getVisitorEmail(
- ).')';
- }
-
- public function getLastMessage(TicketInterface $ticket)
- {
- return $ticket->getTicketMessages()->last();
- }
- }
|