public function validate()
 {
     $errors = [];
     $errors = $this->validateVoider($errors);
     $errors = $this->validateContextForActivity($errors);
     return array_merge($errors, parent::validate());
 }
 public function validate()
 {
     $errors = [];
     foreach ($this->getSetProps() as $set_prop) {
         $errors = array_merge($errors, (new Language($set_prop))->validate());
         $errors = array_merge($errors, array_map(function ($error) use($set_prop) {
             return $error->addTrace($set_prop);
         }, (new String($this->value->{$set_prop}))->validate()));
     }
     return array_merge($errors, parent::validate());
 }
Exemple #3
0
 public function validate()
 {
     $errors = $this->validateTypedElement();
     // Gets the used identifiers.
     $used_identifiers = $this->countIdentifiers();
     // Checks that only one identifier is used.
     if ($this->validateIdentifiers($used_identifiers)) {
         $errors[] = new Error($this->identifierError($used_identifiers));
     }
     return array_merge($errors, parent::validate());
 }
 public function validate()
 {
     $errors = [];
     $verb_id = $this->getPropValue('verb.id');
     $object_type = $this->getPropValue('object.objectType');
     // Validates voider.
     if ($verb_id === 'http://adlnet.gov/expapi/verbs/voided' && $object_type !== 'StatementRef') {
         $errors[] = new Error("`object.objectType` must be `StatementRef` not `{$object_type}` when voiding");
     }
     return array_merge($errors, parent::validate());
 }
Exemple #5
0
 protected function getSetProps($object = null)
 {
     return parent::getSetProps($object);
 }