/**
  * 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));
     }
 }