original_string: public function get_badge_assertion() {
          global $CFG;
          $assertion = array();
          if ($this->_data) {
              $hash = $this->_data->uniquehash;
              $email = empty($this->_data->backpackemail) ? $this->_data->email : $this->_data->backpackemail;
              $assertionurl = new moodle_url('/badges/assertion.php', array('b' => $hash));
              $classurl = new moodle_url('/badges/assertion.php', array('b' => $hash, 'action' => 1));
  
              // Required.
              $assertion['uid'] = $hash;
              $assertion['recipient'] = array();
              $assertion['recipient']['identity'] = 'sha256$' . hash('sha256', $email . $CFG->badges_badgesalt);
              $assertion['recipient']['type'] = 'email'; // Currently the only supported type.
              $assertion['recipient']['hashed'] = true; // We are always hashing recipient.
              $assertion['recipient']['salt'] = $CFG->badges_badgesalt;
              $assertion['badge'] = $classurl->out(false);
              $assertion['verify'] = array();
              $assertion['verify']['type'] = 'hosted'; // 'Signed' is not implemented yet.
              $assertion['verify']['url'] = $assertionurl->out(false);
              $assertion['issuedOn'] = $this->_data->dateissued;
              // Optional.
              $assertion['evidence'] = $this->_url->out(false); // Currently issued badge URL.
              if (!empty($this->_data->dateexpire)) {
                  $assertion['expires'] = $this->_data->dateexpire;
              }
              $this->embed_data_badge_version2($assertion, OPEN_BADGES_V2_TYPE_ASSERTION);
          }
          return $assertion;
      }
code: public function get_badge_assertion() {
          global $CFG;
          $assertion = array();
          if ($this->_data) {
              $hash = $this->_data->uniquehash;
              $email = empty($this->_data->backpackemail) ? $this->_data->email : $this->_data->backpackemail;
              $assertionurl = new moodle_url('/badges/assertion.php', array('b' => $hash));
              $classurl = new moodle_url('/badges/assertion.php', array('b' => $hash, 'action' => 1));
  
              // Required.
              $assertion['uid'] = $hash;
              $assertion['recipient'] = array();
              $assertion['recipient']['identity'] = 'sha256$' . hash('sha256', $email . $CFG->badges_badgesalt);
              $assertion['recipient']['type'] = 'email'; // Currently the only supported type.
              $assertion['recipient']['hashed'] = true; // We are always hashing recipient.
              $assertion['recipient']['salt'] = $CFG->badges_badgesalt;
              $assertion['badge'] = $classurl->out(false);
              $assertion['verify'] = array();
              $assertion['verify']['type'] = 'hosted'; // 'Signed' is not implemented yet.
              $assertion['verify']['url'] = $assertionurl->out(false);
              $assertion['issuedOn'] = $this->_data->dateissued;
              // Optional.
              $assertion['evidence'] = $this->_url->out(false); // Currently issued badge URL.
              if (!empty($this->_data->dateexpire)) {
                  $assertion['expires'] = $this->_data->dateexpire;
              }
              $this->embed_data_badge_version2($assertion, OPEN_BADGES_V2_TYPE_ASSERTION);
          }
          return $assertion;
      }
code_tokens: public function get_badge_assertion ( ) { global $ CFG ; $ assertion = array ( ) ; if ( $ this -> _data ) { $ hash = $ this -> _data -> uniquehash ; $ email = empty ( $ this -> _data -> backpackemail ) ? $ this -> _data -> email : $ this -> _data -> backpackemail ; $ assertionurl = new moodle_url ( '/badges/assertion.php' , array ( 'b' => $ hash ) ) ; $ classurl = new moodle_url ( '/badges/assertion.php' , array ( 'b' => $ hash , 'action' => 1 ) ) ; // Required. $ assertion [ 'uid' ] = $ hash ; $ assertion [ 'recipient' ] = array ( ) ; $ assertion [ 'recipient' ] [ 'identity' ] = 'sha256$' . hash ( 'sha256' , $ email . $ CFG -> badges_badgesalt ) ; $ assertion [ 'recipient' ] [ 'type' ] = 'email' ; // Currently the only supported type. $ assertion [ 'recipient' ] [ 'hashed' ] = true ; // We are always hashing recipient. $ assertion [ 'recipient' ] [ 'salt' ] = $ CFG -> badges_badgesalt ; $ assertion [ 'badge' ] = $ classurl -> out ( false ) ; $ assertion [ 'verify' ] = array ( ) ; $ assertion [ 'verify' ] [ 'type' ] = 'hosted' ; // 'Signed' is not implemented yet. $ assertion [ 'verify' ] [ 'url' ] = $ assertionurl -> out ( false ) ; $ assertion [ 'issuedOn' ] = $ this -> _data -> dateissued ; // Optional. $ assertion [ 'evidence' ] = $ this -> _url -> out ( false ) ; // Currently issued badge URL. if ( ! empty ( $ this -> _data -> dateexpire ) ) { $ assertion [ 'expires' ] = $ this -> _data -> dateexpire ; } $ this -> embed_data_badge_version2 ( $ assertion , OPEN_BADGES_V2_TYPE_ASSERTION ) ; } return $ assertion ; }
docstring: Get badge assertion.
  
  @return array Badge assertion.
docstring_tokens: Get badge assertion .