/** * Set the target currency * * @param string $targetCurrency ISO 4127 currency code * @return $this * @throws InvalidCurrencyException */ public function setTargetCurrency($targetCurrency) { $targetCurrency = strtoupper($targetCurrency); $violations = $this->validator->validate($targetCurrency, [new Currency(), new NotBlank()]); if ($violations->count() > 0) { throw new InvalidCurrencyException(sprintf('"%s" is not a valid currency.', $targetCurrency)); } $this->targetCurrency = $targetCurrency; return $this; }
/** * Validates the specified entity against its annotated rules * * @param \Wasp\Entity\Entity * @return void * @author Dan Cox */ public function validate($entity) { return $this->validator->validate($entity); }