Checks if both IBANs belong to the EEA (European Economic Area)
This function does not check if the IBANs are valid.

@param string $iban1
@param string $iban2
@return bool
345000
public static function isEEATransaction($iban1, $iban2)
    {
        // remove whitespaces
        $iban1 = preg_replace('#\s+#','',$iban1);
        $iban2 = preg_replace('#\s+#','',$iban2);

        // check if both county codes belong to the EEA
        $EEA = ['IS' => 1, 'LI' => 1, 'NO' => 1, 'BE' => 1, 'BG' => 1, 'DK' => 1, 'DE' => 1,
                'EE' => 1, 'FI' => 1, 'FR' => 1, 'GR' => 1, 'IE' => 1, 'IT' => 1, 'HR' => 1,
                'LV' => 1, 'LT' => 1, 'LU' => 1, 'MT' => 1, 'NL' => 1, 'AT' => 1, 'PL' => 1,
                'PT' => 1, 'RO' => 1, 'SE' => 1, 'SK' => 1, 'SI' => 1, 'ES' => 1, 'CZ' => 1,
                'HU' => 1, 'GB' => 1, 'CY' => 1];

        if(isset($EEA[strtoupper(substr($iban1,0,2))],$EEA[strtoupper(substr($iban2,0,2))]))
            return true;

        return false;
    }
1085934
public function whereBetween(string $field, $value1, $value2)
    {
        return $this->addCondition('AND', $field, [$value1, $value2], 'BETWEEN');
    }
68953
public static function haveTheSameTypeAndValue($value1, $value2)
    {
        if (\gettype($value1) !== \gettype($value2)) {
            return false;
        }

        return self::haveTheSameValue($value1, $value2);
    }
457986
public function mergeResults($a1, $a2)
    {

        reset($a2);

        while (list($key, $val) = each($a2)) {
            if (isset($a1[$key])) {
                if (is_array($val)) {
                    if ($key != 'nserver') {
                        $a1[$key] = $this->mergeResults($a1[$key], $val);
                    }
                } else {
                    $val = trim($val);
                    if ($val != '') {
                        $a1[$key] = $val;
                    }
                }
            } else {
                $a1[$key] = $val;
            }
        }

        return $a1;
    }
1174997
public function setIban($value)
    {
        if ($this->billing_country === 'DE') {
            $this->validateIban(self::PATTERN_DE_IBAN, $value);
        }

        return parent::setIban($value);
    }
935073
private static function compareArrays(array $input1, array $input2)
    {
        foreach ($input1 as $key => $value) {
            if (!array_key_exists($key, $input2)) {
                return false;
            } else {
                if (!self::isStructureSame($value, $input2[$key])) {
                    return false;
                }
            }
        }

        return true;
    }
1249628
public function compare($key1 , $key2) {
        $record1 = $this->contents[$key1];
        $record2 = $this->contents[$key2];

        // If a content's fieldtype is compulsory in the database than it would have priority than any other noncompulsory content.
        if ( ($record1->required && $record2->required) || (!$record1->required && !$record2->required)) {
            if ($record1->priority === $record2->priority) {
                return $key1 < $key2 ? 1 : -1;
            }

            return $record1->priority < $record2->priority ? -1 : 1;

        } else if ($record1->required && !$record2->required) {
            return 1;
        } else {
            return -1;
        }

    }
1275178
public static function areEqual($value1, $value2) : bool
    {
        return $value1 === $value2 || self::hash($value1) === self::hash($value2);
    }
776616
public function IsValidForCurrentUser()
    {
        $bIsValidForUser = false;
        $bIsValidShippingCountry = false;
        $bIsValidBillingCountry = false;

        $oUser = TdbDataExtranetUser::GetInstance();
        $bIsValidGroup = $this->checkUserGroup($oUser);
        if ($bIsValidGroup) {
            $bIsValidForUser = $this->checkUser($oUser);
        }
        if ($bIsValidForUser && $bIsValidGroup) {
            $bIsValidShippingCountry = $this->checkUserShippingCountry($oUser);
        }
        if ($bIsValidForUser && $bIsValidGroup && $bIsValidShippingCountry) {
            $bIsValidBillingCountry = $this->checkUserBillingCountry($oUser);
        }

        return $bIsValidForUser && $bIsValidGroup && $bIsValidShippingCountry && $bIsValidBillingCountry;
    }
712234
public function add(Money\Money $money1, Money\Money $money2)
    {
        return $this->accountant->add($money1, $money2);
    }
950415
private static function getIbanLength($iban)
    {
        $countrycode = substr($iban, 0, 2);

        $lengths = array(
            'AL' => 28,
            'AD' => 24,
            'AT' => 20,
            'AZ' => 28,
            'BH' => 22,
            'BE' => 16,
            'BA' => 20,
            'BR' => 29,
            'BG' => 22,
            'CR' => 21,
            'HR' => 21,
            'CY' => 28,
            'CZ' => 24,
            'DK' => 18,
            'DO' => 28,
            'TL' => 23,
            'EE' => 20,
            'FO' => 18,
            'FI' => 18,
            'FR' => 27,
            'GE' => 22,
            'DE' => 22,
            'GI' => 23,
            'GR' => 27,
            'GL' => 18,
            'GT' => 28,
            'HU' => 28,
            'IS' => 26,
            'IE' => 22,
            'IL' => 23,
            'IT' => 27,
            'JO' => 30,
            'KZ' => 20,
            'XK' => 20,
            'KW' => 30,
            'LV' => 21,
            'LB' => 28,
            'LI' => 21,
            'LT' => 20,
            'LU' => 20,
            'MK' => 19,
            'MT' => 31,
            'MR' => 27,
            'MU' => 30,
            'MC' => 27,
            'MD' => 24,
            'ME' => 22,
            'NL' => 18,
            'NO' => 15,
            'PK' => 24,
            'PS' => 29,
            'PL' => 28,
            'PT' => 25,
            'QA' => 29,
            'RO' => 24,
            'SM' => 27,
            'SA' => 24,
            'RS' => 22,
            'SK' => 24,
            'SI' => 19,
            'ES' => 24,
            'SE' => 24,
            'CH' => 21,
            'TN' => 24,
            'TR' => 26,
            'AE' => 23,
            'GB' => 22,
            'VG' => 24,
            'DZ' => 24,
            'AO' => 25,
            'BJ' => 28,
            'BF' => 27,
            'BI' => 16,
            'CM' => 27,
            'CV' => 25,
            'IR' => 26,
            'CI' => 28,
            'MG' => 27,
            'ML' => 28,
            'MZ' => 25,
            'SN' => 28,
            'UA' => 29
        );

        return isset($lengths[$countrycode]) ? $lengths[$countrycode] : false;
    }
476499
public function isEqual(MoneyInterface $first, MoneyInterface $second)
    {
        $this->resolveCurrency($first, $second);
        return $this->math->isEqual($first->getAmount(), $second->getAmount());
    }
908776
public static function is_e1nation($country)
	{
		$e1nation = false;
		if ($country)
		{
			if (!($gdb = self::getGeoDBO()))
			{
				return $e1nation;
			}

			$gdb->setQuery("SELECT COUNT(*) FROM countrygroup WHERE LOWER(countrycode) = LOWER(" . $gdb->quote($country) . ") AND countrygroup = 'E1'");
			$c = $gdb->loadResult();
			if ($c > 0)
			{
				$e1nation = true;
			}
		}
		return $e1nation;
	}
578904
public function IsValidForCurrentUser($bCheckShippingCountry = true)
    {
        $bIsValidForUser = false;
        $bIsValidGroup = false;
        $bIsValidShippingCountry = false;

        $oUser = TdbDataExtranetUser::GetInstance();

        if ($this->fieldRestrictToSignedInUsers || $oUser->IsLoggedIn() || $oUser->HasData()) {
            $typeDataAccess = $this->getShopShippingTypeDataAccess();
            if ($oUser->IsLoggedIn() || $oUser->HasData()) {
                // check user group
                $aUserGroups = $typeDataAccess->getPermittedUserGroupIds($this->id);
                if (!is_array($aUserGroups) || count($aUserGroups) < 1) {
                    $bIsValidGroup = true;
                } else {
                    $bIsValidGroup = $oUser->InUserGroups($aUserGroups);
                }

                // now check user id
                if ($bIsValidGroup) {
                    $aUserList = $typeDataAccess->getPermittedUserIds($this->id);
                    if (!is_array($aUserList) || count($aUserList) < 1) {
                        $bIsValidForUser = true;
                    } else {
                        $bIsValidForUser = in_array($oUser->id, $aUserList);
                    }
                }

                // check shipping country
                if ($bCheckShippingCountry) {
                    if ($bIsValidForUser && $bIsValidGroup) {
                        $oShippingAddress = $oUser->GetShippingAddress();
                        $iShippingCountryId = $oShippingAddress->fieldDataCountryId;
                        if (!$oShippingAddress->ContainsData()) {
                            $oBillingAddress = $oUser->GetBillingAddress();
                            $iShippingCountryId = $oBillingAddress->fieldDataCountryId;
                        }
                        $bIsValidShippingCountry = $this->IsValidForCountry($iShippingCountryId);
                    }
                } else {
                    $bIsValidShippingCountry = true;
                }
            }
        } elseif (!$this->fieldRestrictToSignedInUsers && !$oUser->IsLoggedIn()) {
            // not logged in, but set not restricted to signed in users
            $bIsValidForUser = true;
            $bIsValidGroup = true;
            $bIsValidShippingCountry = true;
        }

        return $bIsValidForUser && $bIsValidGroup && $bIsValidShippingCountry;
    }
397311
protected function isEqual($model1, $model2, $keys)
    {
        if ($this->isEqual !== null) {
            return call_user_func($this->isEqual, $model1, $model2, $keys);
        }
        foreach ($keys as $key) {
            if (ArrayHelper::getValue($model1, $key) != ArrayHelper::getValue($model2, $key)) {
                return false;
            }
        }
        return true;
    }
1036541
protected function validate_iban($field, $input, $param = null)
    {
        if (!isset($input[$field]) || empty($input[$field])) {
            return;
        }

        $character = array(
            'A' => 10, 'C' => 12, 'D' => 13, 'E' => 14, 'F' => 15, 'G' => 16,
            'H' => 17, 'I' => 18, 'J' => 19, 'K' => 20, 'L' => 21, 'M' => 22,
            'N' => 23, 'O' => 24, 'P' => 25, 'Q' => 26, 'R' => 27, 'S' => 28,
            'T' => 29, 'U' => 30, 'V' => 31, 'W' => 32, 'X' => 33, 'Y' => 34,
            'Z' => 35,
        );

        if (!preg_match("/\A[A-Z]{2}\d{2} ?[A-Z\d]{4}( ?\d{4}){1,} ?\d{1,4}\z/", $input[$field])) {
            return array(
                'field' => $field,
                'value' => $input[$field],
                'rule' => __FUNCTION__,
                'param' => $param,
            );
        }

        $iban = str_replace(' ', '', $input[$field]);
        $iban = substr($iban, 4).substr($iban, 0, 4);
        $iban = strtr($iban, $character);

        if (bcmod($iban, 97) != 1) {
            return array(
                'field' => $field,
                'value' => $input[$field],
                'rule' => __FUNCTION__,
                'param' => $param,
            );
        }
    }
1251166
public function isValid($value = null, $context = null)
    {
        if (!is_string($value)) {
            $this->error(self::INVALID);

            return false;
        }

        $country = $this->getCountry();

        if (!array_key_exists($country, $this->iban)) {
            if (array_key_exists($country, $context)) {
                $country = $context[$country];
            } else {
                $country = substr($value, 0, 2);
            }
        }

        if (!array_key_exists($country, $this->iban)) {
            $this->error(self::UNSUPPORTED);

            return false;
        }

        if (!preg_match($this->iban[$country]['iban'], $value)) {
            if ($this->allowBban && $this->iban[$country]['bban']) {
                return true;
            }

            $this->error(self::NO_MATCH);

            return false;
        }

        return true;
    }