Exemple #1
0
 /**
  * Validates properties
  *
  * @throws InvoiceException
  */
 private function validate()
 {
     foreach (['name', 'town', 'address', 'zip', 'country'] as $val) {
         if (!$this->{$val} || !is_string($this->{$val})) {
             throw InvoiceException::wrongType('non-empty string', $this->{$val});
         }
     }
 }
 /**
  * @throws InvoiceException
  */
 private function validate()
 {
     if (!$this->currency || !is_string($this->currency)) {
         throw InvoiceException::wrongType('non-empty string', $this->currency);
     }
     if ($this->tax && !is_float($this->tax)) {
         throw InvoiceException::wrongType('float', $this->tax);
     }
 }
Exemple #3
0
 /**
  * Validates properties
  *
  * @throws InvoiceException
  */
 private function validate()
 {
     if (!$this->accountNumber || !is_string($this->accountNumber)) {
         throw InvoiceException::wrongType('non-empty string', $this->accountNumber);
     }
     if ($this->iBan !== NULL && !$this->iBan || !is_string($this->iBan)) {
         throw InvoiceException::wrongType('non-empty string or null', $this->iBan);
     }
     if ($this->swift !== NULL && !$this->swift || !is_string($this->swift)) {
         throw InvoiceException::wrongType('non-empty string or null', $this->iBan);
     }
 }
Exemple #4
0
 /**
  * Validates properties
  *
  * @throws InvoiceException
  */
 private function validate()
 {
     if (!$this->name || !is_string($this->name)) {
         throw InvoiceException::wrongType('non-empty string', $this->name);
     }
     if (!is_numeric($this->count)) {
         throw InvoiceException::wrongType('numeric', $this->count);
     }
     if (!is_numeric($this->price)) {
         throw InvoiceException::wrongType('numeric', $this->price);
     }
 }
Exemple #5
0
 /**
  * Validates properties
  *
  * @throws InvoiceException
  */
 private function validate()
 {
     if (!$this->number || !is_string($this->number) || !is_numeric($this->number)) {
         throw InvoiceException::wrongType('non-empty string or numeric', $this->number);
     }
 }