public static function formatPhoneNumber($phoneNumber, $formatType = Tools::PHONE_NUMBER_FORMAT_NUMBER)
    {
        $formatType = (int)$formatType;

        if ($formatType !== self::PHONE_NUMBER_FORMAT_INTERNATIONAL && $formatType !== self::PHONE_NUMBER_FORMAT_INTERNATIONAL_NICE &&
            $formatType !== self::PHONE_NUMBER_FORMAT_NUMBER && $formatType !== self::PHONE_NUMBER_FORMAT_NICE &&
            $formatType !== self::PHONE_NUMBER_FORMAT_SMSTOOLS
        ) {
            return false;
        }

        if (!Validate::isPhoneNumber($phoneNumber)) {
            return false;
        }

        $phoneNumber = self::removeSpace($phoneNumber);
        $phoneLen = \strlen($phoneNumber);

        if ($phoneLen > 9 && 0 !== strpos($phoneNumber, '+')) {
            $phoneNumber = '+' . $phoneNumber;
            $phoneLen++;
        }

        if ($phoneLen !== 9 && !($phoneLen >= 11 && $phoneLen <= 13 && 0 === strpos($phoneNumber, '+'))) {
            return false;
        }

        $international = ($phoneLen !== 9);

        switch ($formatType) {
            case self::PHONE_NUMBER_FORMAT_INTERNATIONAL_NICE:
                $formattedPhone = preg_replace(
                    '/^(\+\d{1,3})(\d{3})(\d{3})(\d{3})$/',
                    '$1 $2 $3 $4',
                    $international ? $phoneNumber : '+420' . $phoneNumber
                );
                break;
            case self::PHONE_NUMBER_FORMAT_INTERNATIONAL:
                $formattedPhone = $international ? $phoneNumber : '+420' . $phoneNumber;
                break;
            case self::PHONE_NUMBER_FORMAT_NICE:
                $formattedPhone = preg_replace(
                    '/^(\+\d{1,3})(\d{3})(\d{3})(\d{3})$/',
                    '$2 $3 $4',
                    $international ? $phoneNumber : '+420' . $phoneNumber
                );
                break;
            case self::PHONE_NUMBER_FORMAT_NUMBER:
                $formattedPhone = $international ? substr($phoneNumber, -9) : $phoneNumber;
                break;
            case self::PHONE_NUMBER_FORMAT_SMSTOOLS:
                $formattedPhone = $international ? trim($phoneNumber, '+') : '420' . $phoneNumber;
                break;
            default:
                $formattedPhone = false;
        }

        return $formattedPhone;
    }