public function getValidSender() { $sender = new Sender(); $sender->setId(1); $sender->setPaperAddress($this->getValidPaperAddress()); try { $sender->verify(); } catch (Element $e) { throw new Exception('Sender is not valid'); } return $sender; }
public static function getValidSender($version) { $senders = self::validContent(); if (!isset($senders[$version])) { throw new Exception('Sender is not valid'); } $sender = new Sender(); $sender->setId($senders[$version][0]); $sender->setPaperAddress($senders[$version][1]); try { $sender->verify(); } catch (Element $e) { throw new Exception('PaperAddress is not valid'); } return $sender; }