private function validateFields() {
    $fieldsRequired = $this->fieldsRequired;
    $returnError = array();

    foreach ($fieldsRequired as $field) {
      if (C2PValidate::isEmpty($this->{$field}) && (!is_numeric($this->{$field})))
        $returnError[] = $field . ' is empty';
    }

    foreach ($this->fieldsSize as $field => $size) {
      if (isset($this->{$field}) && C2PValidate::strlen($this->{$field}) > $size)
        $returnError[] = $field . ' Length ' . $size;
    }

    foreach ($this->fieldsValidate as $field => $method) {
      if (!C2PValidate::isEmpty($this->{$field}) && !call_user_func(array('PayXpert\Connect2Pay\C2PValidate', $method), $this->{$field}))
        $returnError[] = $field . ' = ' . $this->{$field};
    }

    return $returnError;
  }
private function validateFields() {
    $fieldsRequired = $this->fieldsRequired;
    $returnError = array();

    foreach ($fieldsRequired as $field) {
      if (C2PValidate::isEmpty($this->{$field}) && (!is_numeric($this->{$field})))
        $returnError[] = $field . ' is empty';
    }

    foreach ($this->fieldsSize as $field => $size) {
      if (isset($this->{$field}) && C2PValidate::strlen($this->{$field}) > $size)
        $returnError[] = $field . ' Length ' . $size;
    }

    foreach ($this->fieldsValidate as $field => $method) {
      if (!C2PValidate::isEmpty($this->{$field}) && !call_user_func(array('PayXpert\Connect2Pay\C2PValidate', $method), $this->{$field}))
        $returnError[] = $field . ' = ' . $this->{$field};
    }

    return $returnError;
  }
private function validateFields ( ) { $ fieldsRequired = $ this -> fieldsRequired ; $ returnError = array ( ) ; foreach ( $ fieldsRequired as $ field ) { if ( C2PValidate :: isEmpty ( $ this -> { $ field } ) && ( ! is_numeric ( $ this -> { $ field } ) ) ) $ returnError [ ] = $ field . ' is empty' ; } foreach ( $ this -> fieldsSize as $ field => $ size ) { if ( isset ( $ this -> { $ field } ) && C2PValidate :: strlen ( $ this -> { $ field } ) > $ size ) $ returnError [ ] = $ field . ' Length ' . $ size ; } foreach ( $ this -> fieldsValidate as $ field => $ method ) { if ( ! C2PValidate :: isEmpty ( $ this -> { $ field } ) && ! call_user_func ( array ( 'PayXpert\Connect2Pay\C2PValidate' , $ method ) , $ this -> { $ field } ) ) $ returnError [ ] = $ field . ' = ' . $ this -> { $ field } ; } return $ returnError ; }
Check for fields validity

@return array empty if everything is OK or as many elements as errors
matched
Check for fields validity