/** * @param string $type * @param string $address */ public function checkAddress($type, $address) { $this->open(); $testAddress = explode(', ', $address); $testAddress = array_filter($testAddress); $testAddress = array_values($testAddress); $type = strtolower($type); $type = ucfirst($type); $addressBox = $this->getElement('Account' . $type); $addressData = Helper::getElementProperty($addressBox, 'address'); $givenAddress = array(); /** @var Element $data */ foreach ($addressData as $data) { $part = $data->getHtml(); $parts = explode('<br />', $part); foreach ($parts as &$part) { $part = strip_tags($part); $part = str_replace(array(chr(0x9), ' '), ' ', $part); $part = str_replace(array(chr(0x9), ' '), ' ', $part); $part = trim($part); } unset($part); $givenAddress = array_merge($givenAddress, $parts); } $result = Helper::compareArrays($givenAddress, $testAddress); if ($result === true) { return; } $message = sprintf('The addresses are different! ("%s" not was found in "%s")', $result['value2'], $result['value']); Helper::throwException($message); }