Example #1
0
 /**
  * @param MailQueue $row
  * @param string $type
  * @return string
  */
 public function __invoke(MailQueue $row, $type)
 {
     if (!$row->has($type)) {
         throw new InvalidArgumentException('wrong type given in class ' . __CLASS__);
     }
     $method = 'get' . ucwords($type);
     $address = $row->{$method}();
     if (null === $address) {
         $address = $this->getMailOptions()->getAddressList()[$row->getTransport()];
         if (!$address instanceof Address) {
             $address = new Address($address['address'], $address['name']);
         }
     }
     if ($address instanceof Address) {
         $address = $address->toString();
     }
     return $address;
 }