Esempio n. 1
0
 /**
  * Find correspondent to local address by remote one
  *
  * @param Customer $customer
  * @param Address  $remoteAddress
  *
  * @return Address|false
  */
 protected function getCorrespondentLocalAddress(Customer $customer, Address $remoteAddress)
 {
     $filtered = $customer->getAddresses()->filter(function (Address $address) use($remoteAddress) {
         return $remoteAddress->getOriginId() === $address->getOriginId();
     });
     return $filtered->first();
 }