コード例 #1
0
 /**
  * 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;
 }
コード例 #2
0
ファイル: Validator.php プロジェクト: antoligy/Framework
 /**
  * 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);
 }