Creates a valid and acceptable geographic coordinates.

@param string $coordinates

@throws InvalidArgumentException
483745
public function setFromString($coordinates)
    {
        if (!is_string($coordinates)) {
            throw new InvalidArgumentException('The given coordinates should be a string !');
        }

        try {
            $inDecimalDegree = $this->toDecimalDegrees($coordinates);
            $this->setLatitude($inDecimalDegree[0]);
            $this->setLongitude($inDecimalDegree[1]);
        } catch (InvalidArgumentException $e) {
            throw $e;
        }
    }
1057378
public static function create(object $googleData) : Coordinates
    {
        $build = new self($googleData);
        $address = $build->createCoordinatesFromGeometry();

        return $address;
    }
1087628
public function setPadding($padding = 0) {
		$padding = $this->parseSizes($padding);

		foreach ($padding as $side => $value) {
			if (! is_int($value) || $value < 0) {
				throw new InvalidArgumentException(sprintf(
					'Invalid %s padding: "%s". Must be a positive integer value.',
					$side, $value
				));
			}

			$this->padding[$side] = $value;
		}
	}
712733
public function setRegion($region)
    {
        $allowed_values = $this->getRegionAllowableValues();
        if (!in_array($region, $allowed_values)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'region', must be one of '%s'",
                    implode("', '", $allowed_values)
                )
            );
        }
        $this->container['region'] = $region;

        return $this;
    }
1142687
public function setLocation($location): self
    {
        // Location
        if (\is_array($location)) { // Latitude/Longitude
            // Latitude
            if (isset($location['lat'])) {
                $this->setLatitude($location['lat']);
            } else {
                throw new InvalidException('$location[\'lat\'] has to be set');
            }

            // Longitude
            if (isset($location['lon'])) {
                $this->setLongitude($location['lon']);
            } else {
                throw new InvalidException('$location[\'lon\'] has to be set');
            }
        } elseif (\is_string($location)) { // Geohash
            $this->setGeohash($location);
        } else { // Invalid location
            throw new InvalidException('$location has to be an array (latitude/longitude) or a string (geohash)');
        }

        return $this;
    }
846441
public function setLongdesc($longdesc)
    {
        if (Format::isUri($longdesc) === true || (is_string($longdesc) === true && empty($longdesc) === true)) {
            $this->longdesc = $longdesc;
        } else {
            $msg = "The 'longdesc' argument must be a valid URI, '" . $longdesc . "' given.";
            throw new InvalidArgumentException($msg);
        }
    }
68871
public function coordinatesToAddress(array $coordinates = [])
	{
		$this->shouldRunC2A = true;

		$this->returnLocationData = array_merge($this->returnLocationData, array_only($coordinates, ['latitude', 'longitude']));
		return $this;
	}
1011048
public function at($address)
    {
        if (AddressValidator::validate($address) === false) {
            throw new InvalidArgumentException('Please make sure address is valid.');
        }
        $this->toAddress = AddressFormatter::format($address);

        return $this;
    }
303687
public function setCoordinate(Coordinate $coordinate)
    {
        $this->sortsBy = array_map(function (array $sortBy) use ($coordinate) {
            if (self::TYPE_DISTANCE === $sortBy['type']) {
                $sortBy['coordinate'] = $coordinate;
            }

            return $sortBy;
        }, $this->sortsBy);

        return $this;
    }
394423
public function setDirection($direction)
    {
        if ($direction !== self::DIRECTION_FORWARD && $direction !== self::DIRECTION_REVERSE && $direction !== self::DIRECTION_BOTH) {
            throw new InvalidArgumentException('Invalid direction given');
        }
        $this->direction = $direction;

        return $this;
    }
288658
public function reverse($latitude, $longitude)
    {
        if (!$this->isLatitude($latitude)) {
            throw new \InvalidArgumentException(
                'Wrong value for latitude.'
            );
        }

        if (!$this->isLongitude($longitude)) {
            throw new \InvalidArgumentException(
                'Wrong value for longitude.'
            );
        }

        $response = $this->guzzleClient->get(
            'reverse',
            [
                'query' => [
                    'format' => $this->guzzleClient->getConfig('format'),
                    'lat'    => $latitude,
                    'lon'    => $longitude,
                    'addressdetails' => $this->guzzleClient->getConfig('addressdetails')
                ],
            ]
        );

        return $response;
    }
459441
public function setCurrency($currency)
    {
      if(!is_string($currency) || strlen(trim($currency)) == 0)
        throw new InvalidArgumentException(__METHOD__ . '; Invalid currency, must be a non empty string');

      $this->currency = $currency;
    }
408451
public function setPosition($position) : self
    {
        if (! (is_int($position) || is_null($position))) {
            throw new InvalidArgumentException(
                sprintf('Invalid $position type: "%s". Must be "int" or "null"', gettype($position))
            );
        }

        $this->position = $position;
        return $this;
    }
976249
protected function checkSaltPositionArgument($position): void
    {
        if (!in_array($position, [self::SALT_BEFORE, self::SALT_AFTER])) {
            throw new InvalidArgumentException(sprintf(
                '`%s` is an invalud argument, it has to be `` or ``',
                $position,
                self::SALT_BEFORE,
                self::SALT_AFTER
            ));
        }
    }
1117665
public function configure(Configuration $configuration)
    {
        foreach ($this->nsMap as $type => $map) {
            if (!count($map)) {
                continue;
            }
            $method = 'get' . ucfirst($type) . 'NamespacesMap';
            if (!method_exists($configuration, $method)) {
                throw new InvalidArgumentException('Invalid type of structure namespaces map: ' . $type);
            }
            /** @var $nsMap Configuration\NamespacesMap */
            $nsMap = $configuration->$method();
            $nsMap->add($map);
        }
    }
1325424
private function coordinatesQuery(CoordinatesInterface $coordinates) : string
    {
        $url = sprintf(self::API_COORDINATES_URL_SSL, $coordinates->getLatitude(), $coordinates->getLongitude());
        $url = $this->buildQuery($url, $this->apiKey, $this->locale, $this->region);

        return $url;
    }
578862
public function setAxis($axis)
    {
        if (is_string($axis) === true) {
            $this->axis = $axis;
        } else {
            $msg = "The 'axis' argument must be a string, '" . gettype($axis) . "' given.";
            throw new InvalidArgumentException($msg);
        }
    }