Пример #1
0
 /**
  * Transfrom claim into an array
  *
  * @param  Claim $claim
  * @return array
  * @throws \LogicException If $claim is not a Claim instance
  */
 public function toArray($claim)
 {
     if (!$claim instanceof Claim) {
         throw new \LogicException('ClaimArrayizer can only arrayize Claim objects');
     }
     return ['_id' => $claim->getId(), 'type' => 'wb:claim', 'title' => 'Ansökan ' . $claim->getId(), 'contact' => $this->contactArrayizer->toArray($claim->getContact()), 'account' => $this->accountArrayizer->toArray($claim->getAccountWrapper()), 'requested' => $claim->getRequestedAmount()->getAmount(), 'approved' => $claim->getApprovedAmount()->getAmount(), 'comment' => $claim->getComment(), 'created' => $claim->getCreated()->format(self::DATE_FORMAT), 'updated' => $claim->getUpdated()->format(self::DATE_FORMAT)];
 }
Пример #2
0
 public function getKey(Claim $claim)
 {
     return (string) $claim->getAccountWrapper()->getAccount();
 }