mirror of
https://github.com/SkillDisplay/PHPToolKit.git
synced 2024-11-21 23:46:09 +01:00
[FIX] Return ResponseInterface after issuing verification instead of direct output
This commit is contained in:
parent
6e73b71098
commit
1c8c07954f
2 changed files with 6 additions and 5 deletions
|
@ -11,4 +11,4 @@ use SkillDisplay\PHPToolKit\Verification\Issuer;
|
|||
// In order to grant an Educational Verification you just need to exchange the constant to VERIFICATION_EDUCATIONAL
|
||||
// (your Verifier Account needs the according permissions)
|
||||
$myVerificationTool = new Issuer($mySettings);
|
||||
$myVerificationTool->issueVerification(193,'--skilldisplay-user-email--', VERIFICATION_BUSINESS);
|
||||
$myVerificationTool->outputResponse($myVerificationTool->issueVerification(193,'--skilldisplay-user-email--', VERIFICATION_BUSINESS));
|
|
@ -38,7 +38,7 @@ class Issuer {
|
|||
*
|
||||
* Outputs a response of a request directly on the page
|
||||
*/
|
||||
private function outputResponse(ResponseInterface $response){
|
||||
public function outputResponse(ResponseInterface $response){
|
||||
// Get all of the response headers.
|
||||
foreach ($response->getHeaders() as $name => $values) {
|
||||
echo $name . ': ' . implode(', ', $values) . "\r\n";
|
||||
|
@ -51,8 +51,9 @@ class Issuer {
|
|||
* @param int $skillID SkillID of the skill for which the verification should be issued (can be read from URL after a search - eg.: https://my.dev.skilldisplay.eu/skill/4/0 has ID 4)
|
||||
* @param string $useremail E-Mail of the SkillDisplay user for whom you want to verify the skill
|
||||
* @param string $vtype Verification type, one of the constants in /src/Constants/VerificationTypes.php
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function issueVerification(int $skillID, string $useremail, string $vtype){
|
||||
public function issueVerification(int $skillID, string $useremail, string $vtype) : ResponseInterface {
|
||||
$requestData = $this->generateSignedRequestData($skillID, $useremail, $vtype);
|
||||
|
||||
$client = new \GuzzleHttp\Client();
|
||||
|
@ -66,8 +67,8 @@ class Issuer {
|
|||
json_encode($requestData)
|
||||
);
|
||||
|
||||
$response = $client->send($request);
|
||||
$this->outputResponse($response);
|
||||
return $client->send($request);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue