/** * Parses the account data. * * @param AccountInterface $account * * @return array */ protected function parseAccount(AccountInterface $account) { if ($account) { $data = []; $data['id'] = $account->getId(); $data['name'] = $account->getName(); $data['phone'] = $account->getMainPhone(); $data['email'] = $account->getMainEmail(); $data['url'] = $account->getMainUrl(); // get main contact if ($account->getMainContact()) { $data['contact'] = $account->getMainContact()->getFullName(); } /* @var Address $accountAddress */ $accountAddress = $account->getMainAddress(); if ($accountAddress) { $data['address']['street'] = $accountAddress->getStreet(); $data['address']['number'] = $accountAddress->getNumber(); $data['address']['zip'] = $accountAddress->getZip(); $data['address']['city'] = $accountAddress->getCity(); $data['address']['country'] = $accountAddress->getCountry()->getName(); } return $data; } else { return null; } }