Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

TicketSolver.php 2.1KB

pirms 3 gadiem
pirms 3 gadiem
pirms 3 gadiem
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. namespace Lc\SovBundle\Solver\Ticket;
  3. use Lc\SovBundle\Model\Ticket\TicketInterface;
  4. use Lc\SovBundle\Model\Ticket\TicketModel;
  5. class TicketSolver
  6. {
  7. public function getTypeChoices(): array
  8. {
  9. return [
  10. TicketModel::TYPE_GENERAL_QUESTION,
  11. TicketModel::TYPE_TECHNICAL_PROBLEM,
  12. ];
  13. }
  14. public function getStatusChoices(): array
  15. {
  16. return [
  17. TicketModel::TICKET_STATUS_OPEN,
  18. TicketModel::TICKET_STATUS_BEING_PROCESSED,
  19. TicketModel::TICKET_STATUS_CLOSED,
  20. ];
  21. }
  22. public function getTypeLabel(TicketInterface $ticket): string
  23. {
  24. return 'entity.Ticket.fields.typeChoices.'.$ticket->getType();
  25. }
  26. public function getStatusLabel(TicketInterface $ticket): string
  27. {
  28. return 'entity.Ticket.fields.statusChoices.'.$ticket->getStatus();
  29. }
  30. public function getUsername(TicketInterface $ticket)
  31. {
  32. if ($ticket->getUser()) {
  33. return $ticket->getUser()->getName();
  34. } else {
  35. return strtoupper($ticket->getVisitorLastname()).' '.$ticket->getVisitorFirstname();
  36. }
  37. }
  38. public function getUserInfosTicket(TicketInterface $ticket)
  39. {
  40. $user = $ticket->getUser();
  41. if ($user) {
  42. return '#'.$user->getId().' '.$user->getName().' '.$user->getEmail();
  43. } else {
  44. return strtoupper($ticket->getVisitorLastname()).' '.$ticket->getVisitorFirstname().' '.$ticket->getVisitorEmail(
  45. );
  46. }
  47. }
  48. public function getEmail(TicketInterface $ticket)
  49. {
  50. if ($ticket->getUser()) {
  51. return $ticket->getUser()->getEmail();
  52. } else {
  53. return $ticket->getVisitorEmail();
  54. }
  55. }
  56. public function getVisitorInfos(TicketInterface $ticket)
  57. {
  58. return strtoupper($ticket->getVisitorLastname()).' '.$ticket->getVisitorFirstname().' ('.$ticket->getVisitorEmail(
  59. ).')';
  60. }
  61. public function getLastMessage(TicketInterface $ticket)
  62. {
  63. return $ticket->getTicketMessages()->last();
  64. }
  65. }