Skip to content

Commit

Permalink
Merge pull request #142 from pwellingelastique/master
Browse files Browse the repository at this point in the history
Validation of endpoint in the Itunes validator
  • Loading branch information
Stafox authored Dec 2, 2020
2 parents d59cb06 + f5be278 commit 1308f3a
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/iTunes/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,7 @@ class Validator
*/
public function __construct(string $endpoint = self::ENDPOINT_PRODUCTION)
{
if ($endpoint !== self::ENDPOINT_PRODUCTION && $endpoint !== self::ENDPOINT_SANDBOX) {
throw new \InvalidArgumentException("Invalid endpoint '{$endpoint}'");
}

$this->endpoint = $endpoint;
$this->setEndpoint($endpoint);
}

/**
Expand Down Expand Up @@ -129,14 +125,15 @@ public function getEndpoint(): string
}

/**
* set endpoint.
*
* @param string $endpoint
*
* @return $this
* @throws \InvalidArgumentException
*/
public function setEndpoint(string $endpoint): self
{
if ($endpoint !== self::ENDPOINT_PRODUCTION && $endpoint !== self::ENDPOINT_SANDBOX) {
throw new \InvalidArgumentException("Invalid endpoint '{$endpoint}'");
}
$this->endpoint = $endpoint;

return $this;
Expand Down

0 comments on commit 1308f3a

Please sign in to comment.