예제 #1
0
 public function testToArray()
 {
     $ticket = $this->_buildTicket();
     // Add the channel we left off in the basic build
     $ticket->setChannel(new Channel('Support'));
     $ticket2 = Ticket::fromArray($ticket->toArray());
     $this->assertEquals($ticket->toArray(), $ticket2->toArray());
 }
예제 #2
0
 public static function fromArray(array $data)
 {
     $ticket = new Ticket($data['id']);
     $participants = [];
     foreach ($data['timeline'] as $event) {
         $ticket->addEvent(TicketEvent::fromArray($event));
     }
     return $ticket;
 }