Get badge assertion.

@return array Badge assertion.
197772
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;
    }
797555
public function getServiceScoreLogo()
    {
        $params = $this->getRequest()->getParams();
        if (! isset($params['code']) || ! $this->helper->isCodeValid($params['code'])) {
            $this->helper->log('Feefo no valid code is set');
            return [];
        }

        $url = 'http://www.feefo.com/feefo/feefologo.jsp?logon=';
        $logon = $this->helper->getFeefoLogon();
        $template = '';
        if ($this->helper->getFeefoLogoTemplate()) {
            $template = '&template=' . $this->helper->getFeefoLogoTemplate();
        }
        $fullUrl = $url . $logon . $template;
        $vendorUrl = 'http://www.feefo.com/feefo/viewvendor.jsp?logon='
            . $logon;

        return ['vendorUrl' => $vendorUrl, 'fullUrl' => $fullUrl];
    }
650869
protected function fetchExecutionToken()
    {
        try {
            $response = $this->client->get(static::LOGIN_URL, [
                'headers' => [
                    'User-Agent' => 'niantic'
                ]
            ]);
        } catch(ServerException $e) {
            sleep(1);
            return $this->fetchExecutionToken();
        }

        if ($response->getStatusCode() !== 200) {
            throw new AuthenticationException("Could not retrieve execution token. Got status code " . $response->getStatusCode());
        }

        $jsonData = json_decode($response->getBody()->getContents());

        if (!$jsonData || !isset($jsonData->execution)) {
            throw new AuthenticationException("Could not retrieve execution token. Invalid JSON. TrainersClub could be offline or unstable.");
        }

        return $jsonData;
    }
722975
public function getAgeVerificationsFromAttrsMap()
    {
        $ageVerificationsArr = [];

        foreach ($this->profileAttributesMap as $attrName => $attributeObj) {
            foreach ($this->getAgeProcessors() as $ageProcessorClass) {
                $abstractAgeProcessorClass = '\\Yoti\\Util\\Age\\AbstractAgeProcessor';
                if (null !== $attrName
                    && null !== $attributeObj
                    && is_subclass_of($ageProcessorClass, $abstractAgeProcessorClass)
                ) {
                    /**
                     * @var \Yoti\Util\Age\AbstractAgeProcessor $ageProcessorObj
                     */
                    $ageProcessorObj = new $ageProcessorClass($attributeObj);

                    if ($ageVerification = $ageProcessorObj->process()) {
                        $ageVerificationsArr[$attrName] = $ageVerification;
                    }
                }
            }
        }

        return $ageVerificationsArr;
    }
761894
public function getAssertionsAction(Request $request, BadgeClass $badge)
    {
        return new JsonResponse(
            $this->finder->search(Assertion::class, array_merge(
                $request->query->all(),
                ['hiddenFilters' => ['badge' => $badge->getUuid(), 'revoked' => false]]
            ))
        );
    }
561245
public function getAccessToken() {
    $token = self::$auth->getAccessToken();
    return (null == $token || 'null' == $token) ? null : $token;
  }
1004891
public function get_criteria() {
        global $DB;
        $criteria = array();

        if ($records = (array)$DB->get_records('badge_criteria', array('badgeid' => $this->id))) {
            foreach ($records as $record) {
                $criteria[$record->criteriatype] = award_criteria::build((array)$record);
            }
        }

        return $criteria;
    }
914661
public function getBadgeAction(BadgeClass $badge)
    {
        return new JsonResponse($this->serializer->serialize($badge, [Options::ENFORCE_OPEN_BADGE_JSON]));
    }
80611
protected function _getPayload()
	{
		$aPayload = parent::_getPayload();

		$aPayload['aps']['alert'] = array();

		if (isset($this->_sText) && !isset($this->_sLocKey)) {
			$aPayload['aps']['alert']['body'] = (string)$this->_sText;
		}

		if (isset($this->_sActionLocKey)) {
			$aPayload['aps']['alert']['action-loc-key'] = $this->_sActionLocKey == '' ?
				null : (string)$this->_sActionLocKey;
		}

		if (isset($this->_sLocKey)) {
			$aPayload['aps']['alert']['loc-key'] = (string)$this->_sLocKey;
		}

		if (isset($this->_aLocArgs)) {
			$aPayload['aps']['alert']['loc-args'] = $this->_aLocArgs;
		}

		if (isset($this->_sLaunchImage)) {
			$aPayload['aps']['alert']['launch-image'] = (string)$this->_sLaunchImage;
		}

		if (isset($this->_sTitle)) {
			$aPayload['aps']['alert']['title'] = (string)$this->_sTitle;
		}
		
		if (isset($this->_sSubTitle)) {
			$aPayload['aps']['alert']['subtitle'] = (string)$this->_sSubTitle;
		}
		return $aPayload;
	}
539647
public function GetVerified()
    {
        // mark as already-called
        $this->_isLoggedIn = false;

        $gnLoginResult = $this->ExecuteCall("GetVerified", (object) [
            "loginId" => $this->_loginId
        ], GnResponseType::GnLogin, false, PHP_INT_MAX);

        if ($gnLoginResult != null && ! GnUtil::IsNullOrEmpty($gnLoginResult->LoginName)) {
            $this->_isLoggedIn = true;
        }

        return $gnLoginResult;
    }
34575
public function getAssertionAction(Assertion $assertion)
    {
        return new JsonResponse($this->serializer->serialize($assertion, [Options::ENFORCE_OPEN_BADGE_JSON]));
    }
32521
public function getFlags()
    {
        $flags = array();
        foreach ($this->names as $name => $bit) {
            if (($this->bitmask & $bit) === $bit) {
                $flags[] = $name;
            }
        }

        return $flags;
    }
779927
public function getDepartment(){
	    if (!$this->access_token && !$this->checkAuth()) return false;
	    $result = $this->http_get(self::API_URL_PREFIX.self::DEPARTMENT_LIST_URL.'access_token='.$this->access_token);
	    if ($result)
	    {
	        $json = json_decode($result,true);
	        if (!$json || !empty($json['errcode'])) {
	            $this->errCode = $json['errcode'];
	            $this->errMsg = $json['errmsg'];
	            return false;
	        }
	        return $json;
	    }
	    return false;
	}
1227654
protected function _getPayload()
	{
		$aPayload[self::APPLE_RESERVED_NAMESPACE] = array();

		if (isset($this->_sText)) {
		    if (isset($this->_sTitle) && strlen($this->_sTitle) > 0) {
		        // if the title is set, use it 
		        $aPayload[self::APPLE_RESERVED_NAMESPACE]['alert'] = array();
		        $aPayload[self::APPLE_RESERVED_NAMESPACE]['alert']['title'] =  (string)$this->_sTitle;
		        $aPayload[self::APPLE_RESERVED_NAMESPACE]['alert']['body'] = (string)$this->_sText;
		    } else {
		        // if the title is not set, use the standard alert message format
		        $aPayload[self::APPLE_RESERVED_NAMESPACE]['alert'] = (string)$this->_sText;
		    }
		}
		
		if (isset($this->_nBadge) && $this->_nBadge >= 0) {
			$aPayload[self::APPLE_RESERVED_NAMESPACE]['badge'] = (int)$this->_nBadge;
		}
		if (isset($this->_sSound)) {
			$aPayload[self::APPLE_RESERVED_NAMESPACE]['sound'] = (string)$this->_sSound;
		}
		if (isset($this->_bContentAvailable)) {
			$aPayload[self::APPLE_RESERVED_NAMESPACE]['content-available'] = (int)$this->_bContentAvailable;
		}
		if (isset($this->_bMutableContent)) {
			$aPayload[self::APPLE_RESERVED_NAMESPACE]['mutable-content'] = (int)$this->_bMutableContent;
		}
		if (isset($this->_sCategory)) {
			$aPayload[self::APPLE_RESERVED_NAMESPACE]['category'] = (string)$this->_sCategory;
		}
		if (isset($this->_sThreadID)) {
		    $aPayload[self::APPLE_RESERVED_NAMESPACE]['thread-id'] = (string)$this->_sThreadID;
        }

		if (is_array($this->_aCustomProperties)) {
			foreach($this->_aCustomProperties as $sPropertyName => $mPropertyValue) {
				$aPayload[$sPropertyName] = $mPropertyValue;
			}
		}

		return $aPayload;
	}
135885
public function getDeviceValidationToken()
    {
        $username = $this->httpRequest()->post('username');
        $token = $this->getLoginInstance()->generateDeviceValidationToken($username);

        return ['deviceValidationToken' => $token];
    }
712996
public function getAuthorization()
    {
        if (!$this->hasHeader('Authorization')) {
            return null;
        }
        $temp = explode(' ', trim($this->getHeaderLine('Authorization')), 2);
        switch (strtolower($temp[0])) {
            case 'basic':
                $temp[1] = base64_decode($temp[1]);
                $temp[1] = explode(':', $temp[1], 2);
                return ['username' => $temp[1][0], 'password' => $temp[1][1] ?? null];
            case 'token':
            case 'oauth':
            case 'bearer':
                return ['token' => $temp[1] ?? null];
            default:
                return null;
        }
    }
44670
public function getOauthAccessToken(){
        $code = isset($_GET['code'])?$_GET['code']:'';
        if (!$code) return false;
        $result = $this->http_get(self::API_BASE_URL_PREFIX.self::OAUTH_TOKEN_URL.'appid='.$this->appid.'&secret='.$this->appsecret.'&code='.$code.'&grant_type=authorization_code');
        if ($result)
        {
            $json = json_decode($result,true);
            if (!$json || !empty($json['errcode'])) {
                $this->errCode = $json['errcode'];
                $this->errMsg = $json['errmsg'];
                return false;
            }
            $this->user_token = $json['access_token'];
            return $json;
        }
        return false;
    }