Validate an address
https://developers.taxjar.com/api/reference/?php#post-validate-an-address

@param array $parameters

@return object Validation object.
970877
public function validateAddress($parameters = [])
    {
        $response = $this->client->post('addresses/validate', [
            'json' => $parameters,
        ]);
        return json_decode($response->getBody())->addresses;
    }
749650
protected function registerAddressValidation()
    {
        $this->app->singleton('ups.address-validation', function (Container $app) {
            $config = $app->config->get('ups');

            return new AddressValidation(
                $config['access_key'],
                $config['user_id'],
                $config['password'],
                $config['sandbox'],
                null,
                $app->make('log')
            );
        });
    }
71819
public static function createInstanceToSave(array $parameters): PostbackImportModel
    {
        try {
            $model = new PostbackImportModel();

            $model
                ->setUserId($parameters[PostbackImportRepository::FIELD_USER_ID])
                ->setAction($parameters[PostbackImportRepository::FIELD_ACTION])
                ->setType($parameters[PostbackImportRepository::FIELD_TYPE])
            ;

            if ('all' !== $model->getType()) {
                $model
                    ->setInStockDaysAgo($parameters[PostbackImportRepository::FIELD_IN_STOCK_DAYS_AGO])
                    ->setFilters($parameters[PostbackImportRepository::FIELD_FILTERS])
                ;
            }

            return $model;

        } catch (\Exception $e) {
            throw $e;
        }
    }
441230
private function resolveLocation(array $parameters): ?Location
    {
        if (isset($parameters['locationId'])) {
            return $this->loadLocation((int) $parameters['locationId']);
        }

        if (isset($parameters['location'])) {
            return $parameters['location'];
        }

        return null;
    }
327924
private function checkResultParameters(array $parameters)
    {
        $requiredParameters = [
            'payment_status',
        ];

        foreach ($requiredParameters as $requiredParameter) {
            if (!isset($parameters[$requiredParameter])) {
                throw new ParameterNotReceivedException($requiredParameter);
            }
        }
    }
1271302
public function geocode($address)
    {
        $query = $this->buildQuery('address', $address);

        $response = $this->validateResponse(
            $this->getResponse($query)
        );

        return $this->buildResults($response['results']);
    }
336942
public function validate($value)
    {
        $result = parent::validate($value);
        return null === $result
            ? new EmailAddressValidationError($this)
            : $result;
    }
510026
public function postPostalAddress(Request $request)
    {
        $this->validates(
            $request->all(),
            [
                'name' => 'required',
                'street1' => 'required',
                'city' => 'required',
                'county' => 'required',
                'postcode' => 'required',
                'country' => 'required',
            ]
        );

        $pa = new PostalAddress;

        $pa->name = $request->input('name');
        $pa->street1 = $request->input('street1');
        $pa->street2 = $request->input('street2');
        $pa->city = $request->input('city');
        $pa->county = $request->input('county');
        $pa->postcode = $request->input('postcode');
        $pa->country = $this->country($request->input('country'))['alpha2'];
        $pa->added = time();

        $pa->user()->associate(Auth::user());

        $pa->save();

        return redirect('/account/postal-addresses')->withStatus('Postal address added.');
    }
774577
protected function validateFields(): void
    {
        $fields = $this->getArrayValue($this->joryArray, ['fld', 'fields']);

        // No fields set, that's ok. return.
        if ($fields === null) {
            return;
        }

        if (! is_array($fields)) {
            throw new JoryException('The fields parameter must be an array. (Location: '.$this->address.'fields)');
        }

        foreach ($fields as $key => $field) {
            if (! is_string($field)) {
                throw new JoryException('The fields parameter can only contain strings. (Location: '.$this->address.'fields.'.$key.')');
            }
        }
    }
906319
public static function requireParameters($parameters, $required)
    {
        //Work with arrays
        if (is_object($parameters)) {
            $parameters = (array)$parameters;
        }

        $missing = [];

        if (!is_array($required)) {
            $required = [$required];
        }

        foreach ($required as $key) {
            if (!isset($parameters[$key])) {
                array_push($missing, $key);
            }
        }

        if (count($missing)) {
            throw new MissingParametersException($missing);
        }
    }
958506
public function validateAddress($address, $field, $isRequired = true)
    {
        if ($isRequired && empty($address)) {
            $this->addError($field, sprintf('%s is empty', ucfirst($field)));
            return false;
        }

        $validator = new EmailValidator();
        $validation = new RFCValidation();

        $success = true;
        foreach ($address as $email => $label) {
            if (!is_scalar($label)) {
                $this->addError(
                    $field,
                    sprintf('Label for %s is not scalar, `%s` given', $field, gettype($label))
                );
                $label = gettype($label);
                $success = false;
            }

            if ($validator->isValid($email, $validation) == false) {
                $this->addError(
                    $field,
                    sprintf('`%s` is not a valid email address for %s `%s`', $email, $field, $label)
                );
                $success = false;
            }
        }

        return $success;
    }
972431
private function validateAddress($address) {
		ArgUtils::valType($address, 'scalar');
		
		$email = self::stripEmail($address);
		
		if (!filter_var($email, FILTER_VALIDATE_EMAIL)) throw new MailFormatException('invalid e-mail address: ' . $address);
	}
689033
public function toUri(array $parameters = [])   
    {
        
        $pattern = $this->getPattern();

        $wildcardsRegexes = $this->wildcardsToRegexGroups(
            $matches = $this->getPatternWildcards()
        );

        $parameters = array_slice($parameters, 0, count($wildcardsRegexes));
        
        $this->validateParametersByWildcards($matches, $parameters);

        $uri = preg_replace($wildcardsRegexes, $parameters, $pattern, 1);

        return '/' . rtrim($uri, '/');

    }
50331
protected function validateAddress()
    {
        $id = $this->getUpdatingId();

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

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

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

        $this->setUpdating($data);
        return true;
    }
677390
public function setParameters($parameters)
    {
        $this->parameters     = $parameters;
        $this->withParameters = !empty($this->parameters);

        return $this;
    }
202042
private function validateInput( $settings ) {
        if ( !isset( $settings["serverUrl"] ) ||
             !isset( $settings["username"] ) ||
             !isset( $settings["password"] )
        ) {
            throw new \InvalidArgumentException( 'Username, password or serverUrl is incorrect' );
        }

        if ( !filter_var( $settings["serverUrl"], FILTER_VALIDATE_URL )
             || strpos( $settings["serverUrl"], "." ) === false
        ) {
            throw new \InvalidArgumentException( 'Invalid serverUrl has been provided' );
        }

        if ( !in_array( $settings['authMode'], [ 'OnlineFederation', 'Federation' ] ) ) {
            throw new \InvalidArgumentException( 'Provided authentication mode <' . $this->authMode . '> is not supported' );
        }
    }
1114455
public function validate(...$params)
    {
        list($name, $value, $min, $max, $throws, $template) = $params;

        return ValidatorHelper::validateInteger($name, $value, $min, $max, $throws, $template);
    }