Beispiel #1
0
 /**
  * Outputs the value of $this.
  * @return stdClass
  */
 public function getValue()
 {
     if (gettype($this->value) !== 'object') {
         return parent::getValue();
     }
     $value = clone $this->value;
     $set_props = $this->getSetProps();
     // Adds properties to value.
     foreach ($set_props as $set_prop) {
         if ($value->{$set_prop} instanceof Atom) {
             $value->{$set_prop} = $value->{$set_prop}->getValue();
         }
     }
     return $value;
 }
 /**
  * Validates a XAPIAtom.
  * @param XAPIAtom $atom Atom to be validated.
  * @param String $trace Where the atom has came from (i.e. request parameter name).
  */
 static function validateAtom(XAPIAtom $atom, $trace = null)
 {
     $errors = $atom->validate();
     if (count($errors) > 0) {
         throw new Exceptions\Validation(array_map(function (XAPIError $error) use($trace) {
             return (string) ($trace === null ? $error : $error->addTrace($trace));
         }, $errors));
     }
 }