Validates the country to be updated
@return boolean|null
437693
protected function validateCountry()
    {
        $id = $this->getUpdatingId();

        if ($id === false) {
            return null;
        }

        $data = $this->country->get($id);

        if (empty($data)) {
            $this->setErrorUnavailable('update', $this->translation->text('Country'));
            return false;
        }

        $this->setUpdating($data);
        return true;
    }
759080
protected function submitEditCountry()
    {
        if ($this->isPosted('delete')) {
            $this->deleteCountry();
        } else if ($this->isPosted('save') && $this->validateEditCountry()) {
            if (isset($this->data_country['code'])) {
                $this->updateCountry();
            } else {
                $this->addCountry();
            }
        }
    }
508825
protected function validateDestinationCreate()
    {
        if ($this->isError()) {
            return null;
        }

        $name = $this->getSubmitted('name');
        $files = $this->getSubmitted('files');

        /* @var $file \SplFileInfo */
        $file = reset($files);
        $directory = $file->getRealPath();

        if (file_exists("$directory/$name")) {
            $this->setError('name', $this->translation->text('Destination already exists'));
            return false;
        }

        $this->setSubmitted('destination', "$directory/$name");
        return true;
    }
1289099
protected function validateEditCountryState()
    {
        $this->setSubmitted('state');
        $this->setSubmittedBool('status');
        $this->setSubmitted('update', $this->data_state);
        $this->setSubmitted('country', $this->data_country['code']);

        $this->validateComponent('country_state');

        return !$this->hasErrors();
    }
33832
private function isFormatValid()
    {
        $countryCode = $this->getCountryCode();
        $accountIdentification = $this->getAccountIdentification();

        return !(preg_match('/' . static::$ibanFormatMap[$countryCode][1] . '/', $accountIdentification) !== 1);
    }
634942
protected function validateImageStyle()
    {
        $id = $this->getUpdatingId();

        if ($id === false) {
            return null;
        }

        $data = $this->image_style->get($id);

        if (empty($data)) {
            $this->setErrorUnavailable('update', $this->translation->text('Image style'));
            return false;
        }

        $this->setSubmitted('update', $data);
        return true;
    }
926526
protected function validateDataStore()
    {
        $field = 'data';

        if ($this->isExcluded($field)) {
            return null;
        }

        $value = $this->getSubmitted($field);

        if ($this->isUpdating()) {
            if (!isset($value)) {
                $this->unsetSubmitted($field);
                return null;
            }
        } else if (empty($value)) {
            $value = $this->store->getConfig(null, $this->store->getDefault());
            // Will be set later
            unset($value['title'], $value['meta_title']);
        }

        if (!is_array($value)) {
            $this->setErrorInvalid($field, $this->translation->text('Settings'));
            return false;
        }

        $this->setSubmitted('data', $value);

        $this->validateDataTitleStore();
        $this->validateDataEmailStore();
        $this->validateDataMapStore();
        $this->validateDataMetaTitleStore();
        $this->validateDataMetaDescriptionStore();
        $this->validateDataTranslationStore();
        $this->validateDataThemeStore();

        return !$this->isError();
    }
1143754
public static function validate($phoneNumber, $country = null)
    {
        $phoneNumber = trim($phoneNumber);
        if (empty($phoneNumber)) {
            return false;
        }
        $country = strtoupper($country);
        $phoneUtil = PhoneNumberUtil::getInstance();
        try {
            $numberProto = $phoneUtil->parse($phoneNumber, $country);
        } catch (NumberParseException $e) {
            return false;
        }

        return $phoneUtil->isValidNumber($numberProto);
    }
1136402
protected function updateFormatCountry()
    {
        $format = $this->getSubmitted();

        foreach ($format as $id => &$item) {

            $item['status'] = isset($item['status']);
            $item['required'] = isset($item['required']);

            if ($id === 'country') {
                $item['status'] = 1;
                $item['required'] = 1;
            }

            if ($item['required']) {
                $item['status'] = 1;
            }
        }

        if ($this->country->update($this->data_country['code'], array('format' => $format))) {
            $this->redirect('admin/settings/country', $this->text('Country has been updated'), 'success');
        }

        $this->redirect('', $this->text('Country has not been updated'), 'warning');
    }
802303
protected function validateFieldAddress($field)
    {
        if ($this->isExcluded($field) || $this->isError('country')) {
            return null;
        }

        $value = $this->getSubmitted($field);

        if ($this->isUpdating() && !isset($value)) {
            $this->unsetSubmitted($field);
            return null;
        }

        $format = $this->getCountryFormatAddress();

        if (empty($format[$field]['required'])) {
            return null;
        }

        if (!isset($value) || $value === '' || mb_strlen($value) > 255) {
            $this->setErrorLengthRange($field, $format[$field]['name'], 1, 255);
            return false;
        }

        return true;
    }
1284431
public function isValid($my_number = '')
    {
        try {
            $phoneNumber = new PhoneNumber();
            $phoneNumber->setDebugStatus($this->DEBUG);
            $phoneNumber->setLoggerPath($this->loggerPath);
            $phoneNumber->__construct();
            $result = $phoneNumber->is_valid(trim($my_number), self::CURRENT_COUNTRY);
            $this->_debug->info(__FUNCTION__, 'Result: ' . $result);

            return $result;
        }
        catch (\Exception $e) {
            $message = 'Error File: ' . $e->getFile() . ' - Line: ' . $e->getLine() . ' - Code: ' . $e->getCode() . ' - Message: ' . $e->getMessage();
            if (function_exists('log_message')) {
                log_message('error', $message);
            }
            $this->_debug->error(__FUNCTION__, $message);

            return NULL;
        }
    }
1130616
protected function validateZoneCountryState()
    {
        $field = 'zone_id';
        $value = $this->getSubmitted($field);

        if (empty($value)) {
            return null;
        }

        $label = $this->translation->text('Zone');

        if (!is_numeric($value)) {
            $this->setErrorNumeric($field, $label);
            return false;
        }

        $zone = $this->zone->get($value);

        if (empty($zone)) {
            $this->setErrorUnavailable($field, $label);
            return false;
        }

        return true;
    }
86926
protected function validatePage()
    {
        $id = $this->getUpdatingId();

        if ($id === false) {
            return null;
        }

        $data = $this->page->get($id);

        if (empty($data)) {
            $this->setErrorUnavailable('update', $this->translation->text('Page'));
            return false;
        }

        $this->setUpdating($data);
        return true;
    }
1094994
protected function validateWishlist()
    {
        $id = $this->getUpdatingId();

        if ($id === false) {
            return null;
        }

        $data = $this->wishlist->get($id);

        if (empty($data)) {
            $this->setErrorUnavailable('update', $this->translation->text('Wishlist'));
            return false;
        }

        $this->setUpdating($data);
        return true;
    }
1270139
protected function getCountryFormatAddress()
    {
        $updating = $this->getUpdating();

        if (isset($updating['country_format'])) {
            return $updating['country_format'];
        }

        $field = 'country';
        $code = $this->getSubmitted($field);

        if (!isset($code)) {
            return $this->country->getDefaultFormat();
        }

        $country = $this->country->get($code);

        if (empty($country['format'])) {
            $this->setErrorUnavailable($field, $this->translation->text('Country'));
            return array();
        }

        return $country['format'];
    }
857671
public function is_valid() {
        $ret = false;

        if (is_null($this->division) === false && is_null($this->datafileURI) === false &&
            is_null($this->subscribe) === false && is_null($this->profileUpdate) === false &&
            is_null($this->listLoadName) === false && is_null($this->loadMode) === false &&
            is_null($this->headers) === false && is_null($this->maxErrors) === false &&
            is_null($this->errorType) === false
        ) {
            $ret = true;
        }

        return $ret;
    }
322432
protected function validateStatusUser()
    {
        $field = 'user';

        if ($this->isExcluded($field)) {
            return null;
        }

        $value = $this->getSubmitted($field);

        if (is_numeric($value)) {
            $value = $this->user->get($value);
        }

        if (empty($value['status']) || empty($value['user_id'])) {
            $this->setErrorUnavailable($field, $this->translation->text('User'));
            return false;
        }

        $this->setSubmitted($field, $value);
        return true;
    }