diff --git a/src/Api/Campaigns.php b/src/Api/Campaigns.php
index 775d2d2..0fe1c24 100644
--- a/src/Api/Campaigns.php
+++ b/src/Api/Campaigns.php
@@ -31,15 +31,9 @@ use SkillDisplay\PHPToolKit\Entity\Campaign;
class Campaigns
{
- /**
- * @var Settings
- */
- protected $settings;
+ protected Settings $settings;
- /**
- * @var Client
- */
- protected $client;
+ protected Client $client;
public function __construct(
Settings $settings,
diff --git a/src/Api/MemberSkills.php b/src/Api/MemberSkills.php
new file mode 100644
index 0000000..ec2c7f6
--- /dev/null
+++ b/src/Api/MemberSkills.php
@@ -0,0 +1,69 @@
+settings = $settings;
+ $this->client = $client;
+ }
+
+ public function getMemberSkillsById(int $id)
+ {
+ if ($id <= 0) {
+ throw new \Exception('ID of Organisation has to be a positive integer.');
+ }
+ $url = $this->settings->getAPIUrl() . '/api/v1/organisation/' . $id . '/listVerifications/json';
+ try {
+ $result = $this->client->send(new Request(
+ 'GET',
+ $url,
+ [
+ 'Content-Type' => 'application/json',
+ 'x-api-key' => $this->settings->getApiKey()
+ ]
+ ));
+ } catch (ClientException $e) {
+ if ($e->getCode() === 404) {
+ throw new \InvalidArgumentException('Given Organisation with id "' . $id . '" not available.', 1601881616);
+ }
+ throw $e;
+ }
+
+ if ($result->getStatusCode() !== 200) {
+ throw new \Exception('Did not get proper response for Organisation.', 1600693562);
+ }
+
+ $body = (string) $result->getBody();
+
+ if (strpos($body, 'Oops, an error occurred') !== false) {
+ throw new \Exception('Did not get proper response for Organisation. Organisation with id "' . $id . '" does probably not exist.', 1600694312);
+ }
+
+ $body = json_decode((string) $result->getBody(), true);
+ $skills = [];
+ foreach ($body as $skill) {
+ $skills[] = Entity::createFromJson(json_encode($skill), $this->settings);
+ }
+ return $skills;
+ }
+}
diff --git a/src/Api/Organisation.php b/src/Api/Organisation.php
new file mode 100644
index 0000000..67e2bc1
--- /dev/null
+++ b/src/Api/Organisation.php
@@ -0,0 +1,61 @@
+settings = $settings;
+ $this->client = $client;
+ }
+
+ public function getStatisticById(int $id)
+ {
+ if ($id <= 0) {
+ throw new \Exception('ID of Organisation has to be a positive integer.');
+ }
+ $url = $this->settings->getAPIUrl() . '/api/v1/organisation/' . $id . '/statistic';
+ try {
+ $result = $this->client->send(new Request(
+ 'GET',
+ $url,
+ [
+ 'Content-Type' => 'application/json',
+ 'x-api-key' => $this->settings->getApiKey()
+ ]
+ ));
+ } catch (ClientException $e) {
+ if ($e->getCode() === 404) {
+ throw new \InvalidArgumentException('Given Organisation with id "' . $id . '" not available.', 1601881616);
+ }
+ throw $e;
+ }
+
+ if ($result->getStatusCode() !== 200) {
+ throw new \Exception('Did not get proper response for Organisation.', 1600693562);
+ }
+
+ $body = (string) $result->getBody();
+
+ if (strpos($body, 'Oops, an error occurred') !== false) {
+ throw new \Exception('Did not get proper response for Organisation. Organisation with id "' . $id . '" does probably not exist.', 1600694312);
+ }
+ return Entity::createFromJson($body, $this->settings);
+ }
+}
diff --git a/src/Api/Skill.php b/src/Api/Skill.php
index 5ae0a50..bbd8ebc 100644
--- a/src/Api/Skill.php
+++ b/src/Api/Skill.php
@@ -31,15 +31,9 @@ use SkillDisplay\PHPToolKit\Entity\Skill as Entity;
class Skill
{
- /**
- * @var Settings
- */
- protected $settings;
+ protected Settings $settings;
- /**
- * @var Client
- */
- protected $client;
+ protected Client $client;
public function __construct(
Settings $settings,
diff --git a/src/Api/SkillSet.php b/src/Api/SkillSet.php
index fb55c7a..1a3b21c 100644
--- a/src/Api/SkillSet.php
+++ b/src/Api/SkillSet.php
@@ -31,15 +31,9 @@ use SkillDisplay\PHPToolKit\Entity\SkillSet as Entity;
class SkillSet
{
- /**
- * @var Settings
- */
- protected $settings;
+ protected Settings $settings;
- /**
- * @var Client
- */
- protected $client;
+ protected Client $client;
public function __construct(
Settings $settings,
diff --git a/src/Api/SkillSetProgress.php b/src/Api/SkillSetProgress.php
new file mode 100644
index 0000000..788cb0a
--- /dev/null
+++ b/src/Api/SkillSetProgress.php
@@ -0,0 +1,80 @@
+
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+use GuzzleHttp\Client;
+use GuzzleHttp\Exception\ClientException;
+use GuzzleHttp\Psr7\Request;
+use SkillDisplay\PHPToolKit\Configuration\Settings;
+use SkillDisplay\PHPToolKit\Entity\SkillSetProgress as Entity;
+
+class SkillSetProgress
+{
+ protected Settings $settings;
+ protected Client $client;
+
+ public function __construct(
+ Settings $settings,
+ Client $client
+ ) {
+ $this->settings = $settings;
+ $this->client = $client;
+ }
+
+ public function getById(int $id): Entity
+ {
+ if ($id <= 0) {
+ throw new \Exception('ID of SkillSet has to be a positive integer.', 1688639724754);
+ }
+
+ $url = $this->settings->getAPIUrl() . '/api/v1/skillset/' . $id . '/progress';
+ try {
+ $result = $this->client->send(new Request(
+ 'GET',
+ $url,
+ [
+ 'Content-Type' => 'application/json',
+ 'x-api-key' => $this->settings->getApiKey()
+ ]
+ ));
+ } catch (ClientException $e) {
+ if ($e->getCode() === 404) {
+ throw new \InvalidArgumentException('Given SkillSet with id "' . $id . '" not available.', 1688639748718);
+ }
+ throw $e;
+ }
+
+ if ($result->getStatusCode() !== 200) {
+ throw new \Exception('Did not get proper response for SkillSetProgress.', 1688639840720);
+ }
+
+ $body = (string) $result->getBody();
+
+ if (strpos($body, 'Oops, an error occurred') !== false) {
+ throw new \Exception('Did not get proper response for SkillSetProgress. SkillSet with id "' . $id . '" does probably not exist.', 1688639873065);
+ }
+
+ return Entity::createFromJson($body, $this->settings);
+ }
+}
diff --git a/src/Configuration/Settings.php b/src/Configuration/Settings.php
index 43cb133..d4df146 100644
--- a/src/Configuration/Settings.php
+++ b/src/Configuration/Settings.php
@@ -6,30 +6,15 @@ namespace SkillDisplay\PHPToolKit\Configuration;
class Settings
{
- /**
- * @var string
- */
- private $user_secret = '';
+ private string $user_secret = '';
- /**
- * @var string
- */
- private $apiKey = '';
+ private string $apiKey = '';
- /**
- * @var int
- */
- private $verifierID = 0;
+ private int $verifierID = 0;
- /**
- * @var string
- */
- private $APIUrl = '';
+ private string $APIUrl = '';
- /**
- * @var string
- */
- private $mySkillDisplayUrl = '';
+ private string $mySkillDisplayUrl = '';
public function getVerifierID(): int
{
diff --git a/src/Entity/Brand.php b/src/Entity/Brand.php
index 7f8489e..2b61143 100644
--- a/src/Entity/Brand.php
+++ b/src/Entity/Brand.php
@@ -27,15 +27,9 @@ use SkillDisplay\PHPToolKit\Configuration\Settings;
class Brand
{
- /**
- * @var array
- */
- private $data;
+ private array $data;
- /**
- * @var Settings
- */
- private $settings;
+ private Settings $settings;
private function __construct(array $data, Settings $settings)
{
diff --git a/src/Entity/Campaign.php b/src/Entity/Campaign.php
index 27e4b08..67aca66 100644
--- a/src/Entity/Campaign.php
+++ b/src/Entity/Campaign.php
@@ -27,15 +27,9 @@ use SkillDisplay\PHPToolKit\Configuration\Settings;
class Campaign
{
- /**
- * @var array
- */
- private $data;
+ private array $data;
- /**
- * @var Settings
- */
- private $settings;
+ private Settings $settings;
public function __construct(array $data, Settings $settings)
{
diff --git a/src/Entity/MemberSkill.php b/src/Entity/MemberSkill.php
new file mode 100644
index 0000000..6f78fd9
--- /dev/null
+++ b/src/Entity/MemberSkill.php
@@ -0,0 +1,179 @@
+id = $json['uid'] ?? 0;
+ $entity->created = $json['created'] ?? '';
+ $entity->granted = $json['granted'] ?? '';
+ $entity->skillUid = $json['skillUid'] ?? 0;
+ $entity->skillUUid = $json['skillUUid'] ?? '';
+ $entity->skill = $json['skill'] ?? '';
+ $entity->domainTag = $json['domainTag'] ?? '';
+ $entity->level = $json['level'] ?? '';
+ $entity->user = $json['user'] ?? '';
+ $entity->firstName = $json['firstName'] ?? '';
+ $entity->lastName = $json['lastName'] ?? '';
+ $entity->certifier = $json['certifier'] ?? '';
+ $entity->organisation = $json['organisation'] ?? '';
+ $entity->campaign = $json['campaign'] ?? '';
+ $entity->skillSetUid = $json['skillSetUid'] ?? 0;
+ $entity->skillSetName = $json['skillSetName'] ?? '';
+
+ return $entity;
+ }
+
+
+ /**
+ * @return string
+ */
+ public function getCreated(): string
+ {
+ return $this->created;
+ }
+
+ /**
+ * @return string
+ */
+ public function getGranted(): string
+ {
+ return $this->granted;
+ }
+
+ /**
+ * @return int
+ */
+ public function getSkillUid(): int
+ {
+ return $this->skillUid;
+ }
+
+ /**
+ * @return string
+ */
+ public function getSkillUUid(): string
+ {
+ return $this->skillUUid;
+ }
+
+ /**
+ * @return string
+ */
+ public function getSkill(): string
+ {
+ return $this->skill;
+ }
+
+ /**
+ * @return string
+ */
+ public function getDomainTag(): string
+ {
+ return $this->domainTag;
+ }
+
+ /**
+ * @return string
+ */
+ public function getLevel(): string
+ {
+ return $this->level;
+ }
+
+ /**
+ * @return string
+ */
+ public function getUser(): string
+ {
+ return $this->user;
+ }
+
+ /**
+ * @return string
+ */
+ public function getFirstName(): string
+ {
+ return $this->firstName;
+ }
+
+ /**
+ * @return string
+ */
+ public function getLastName(): string
+ {
+ return $this->lastName;
+ }
+
+ /**
+ * @return string
+ */
+ public function getCertifier(): string
+ {
+ return $this->certifier;
+ }
+
+ /**
+ * @return string
+ */
+ public function getOrganisation(): string
+ {
+ return $this->organisation;
+ }
+
+ /**
+ * @return string
+ */
+ public function getCampaign(): string
+ {
+ return $this->campaign;
+ }
+
+ /**
+ * @return int
+ */
+ public function getSkillSetUid(): int
+ {
+ return $this->skillSetUid;
+ }
+
+ /**
+ * @return string
+ */
+ public function getSkillSetName(): string
+ {
+ return $this->skillSetName;
+ }
+
+ /**
+ * @return int
+ */
+ public function getId(): int
+ {
+ return $this->id;
+ }
+}
diff --git a/src/Entity/Organisation.php b/src/Entity/Organisation.php
new file mode 100644
index 0000000..48a97a3
--- /dev/null
+++ b/src/Entity/Organisation.php
@@ -0,0 +1,133 @@
+data = $data;
+ $this->settings = $settings;
+ }
+
+ public function getId(): int
+ {
+ return $this->data['uid'];
+ }
+
+ public function getName(): string
+ {
+ return $this->data['name'] ?? '';
+ }
+
+ public function getBrand(): Brand
+ {
+ if ($this->brand instanceof Brand) {
+ return $this->brand;
+ }
+
+ $this->brand = Brand::createFromJson(json_encode($this->data['brand']), $this->settings);
+
+ return $this->brand;
+ }
+
+ public function getComposition(): string
+ {
+ return $this->data['composition'] ?? '';
+ }
+
+ public function getCurrentMonthIssued(): int
+ {
+ return $this->data['currentMonthIssued'] ?? 0;
+ }
+
+ public function getCurrentMonthUsers(): int
+ {
+ return $this->data['currentMonthUsers'] ?? 0;
+ }
+
+ public function getCurrentMonthVerifications(): int
+ {
+ return $this->data['currentMonthVerifications'] ?? 0;
+ }
+
+ public function getInterestSets(): array
+ {
+ return $this->data['interestSets'] ?? [];
+ }
+
+ public function getLastMonthIssued(): int
+ {
+ return $this->data['lastMonthIssued'] ?? 0;
+ }
+
+ public function getLastMonthUsers(): int
+ {
+ return $this->data['lastMonthUsers'] ?? 0;
+ }
+
+ public function getLastMonthVerifications(): int
+ {
+ return $this->data['lastMonthVerifications'] ?? 0;
+ }
+
+ public function getMonthlyScores(): array
+ {
+ return $this->data['monthlyScores'] ?? [];
+ }
+
+ public function getPotential(): array
+ {
+ return $this->data['potential'] ?? [];
+ }
+
+ public function getSumIssued(): int
+ {
+ return $this->data['sumSkills'] ?? 0;
+ }
+
+ public function getSumSkills(): int
+ {
+ return $this->data['sumSkills'] ?? 0;
+ }
+
+ public function getSumSupportedSkills(): int
+ {
+ return $this->data['sumSupportedSkills'] ?? 0;
+ }
+
+ public function getSumVerifications(): int
+ {
+ return $this->data['sumVerifications'] ?? 0;
+ }
+
+ public function getTotalScore(): int
+ {
+ return $this->data['totalScore'] ?? 0;
+ }
+
+ public static function createFromJson(string $json, Settings $settings): self
+ {
+ return new Organisation(json_decode($json, true), $settings);
+ }
+
+ public function getAsArray(): array
+ {
+ return $this->toArray();
+ }
+
+ public function toArray(): array
+ {
+ return $this->data;
+ }
+}
diff --git a/src/Entity/Skill.php b/src/Entity/Skill.php
index 72e22b6..ccca05b 100644
--- a/src/Entity/Skill.php
+++ b/src/Entity/Skill.php
@@ -27,20 +27,11 @@ use SkillDisplay\PHPToolKit\Configuration\Settings;
class Skill
{
- /**
- * @var array
- */
- private $data;
+ private array $data;
- /**
- * @var Settings
- */
- private $settings;
+ private Settings $settings;
- /**
- * @var array
- */
- private $brands = [];
+ private array $brands = [];
private function __construct(array $data, Settings $settings)
{
diff --git a/src/Entity/SkillSet.php b/src/Entity/SkillSet.php
index e9a0293..d4acf2a 100644
--- a/src/Entity/SkillSet.php
+++ b/src/Entity/SkillSet.php
@@ -27,25 +27,13 @@ use SkillDisplay\PHPToolKit\Configuration\Settings;
class SkillSet
{
- /**
- * @var array
- */
- private $data;
+ private array $data;
- /**
- * @var Settings
- */
- private $settings;
+ private Settings $settings;
- /**
- * @var array
- */
- private $skills = [];
+ private array $skills = [];
- /**
- * @var Brand|null
- */
- private $brand = null;
+ private ?Brand $brand = null;
private function __construct(array $data, Settings $settings)
{
@@ -68,6 +56,11 @@ class SkillSet
return $this->data['description'] ?? '';
}
+ public function getProgressPercentage(): SkillSetProgress
+ {
+ return SkillSetProgress::createFromJson(json_encode($this->data['progressPercentage']), $this->settings);
+ }
+
public function getBrand(): Brand
{
if ($this->brand instanceof Brand) {
diff --git a/src/Entity/SkillSetProgress.php b/src/Entity/SkillSetProgress.php
new file mode 100644
index 0000000..20c6c76
--- /dev/null
+++ b/src/Entity/SkillSetProgress.php
@@ -0,0 +1,64 @@
+
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+use SkillDisplay\PHPToolKit\Configuration\Settings;
+
+class SkillSetProgress
+{
+ private array $data;
+
+ private Settings $settings;
+
+ private function __construct(array $data, Settings $settings)
+ {
+ $this->data = $data;
+ $this->settings = $settings;
+ }
+
+ public function getTier1(): float
+ {
+ return $this->data['tier1'] ?? 0;
+ }
+
+ public function getTier2(): float
+ {
+ return $this->data['tier2'] ?? 0;
+ }
+
+ public function getTier3(): float
+ {
+ return $this->data['tier3'] ?? 0;
+ }
+
+ public function getTier4(): float
+ {
+ return $this->data['tier4'] ?? 0;
+ }
+
+ public static function createFromJson(string $json, Settings $settings): SkillSetProgress
+ {
+ return new SkillSetProgress(json_decode($json, true), $settings);
+ }
+}
diff --git a/src/Example/FullSettingsRequired/AutoGrantBusinessVerification.php b/src/Example/FullSettingsRequired/AutoGrantBusinessVerification.php
index 64b8171..76b82a8 100644
--- a/src/Example/FullSettingsRequired/AutoGrantBusinessVerification.php
+++ b/src/Example/FullSettingsRequired/AutoGrantBusinessVerification.php
@@ -14,4 +14,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->outputResponse($myVerificationTool->issueVerification(193, '--skilldisplay-user-email--', VERIFICATION_BUSINESS, 567));
+$myVerificationTool->outputResponse($myVerificationTool->issueVerification(175, '--skilldisplay-user-email--', VERIFICATION_BUSINESS, false, 567, true));
diff --git a/src/Verification/Issuer.php b/src/Verification/Issuer.php
index c885a00..9c63f01 100644
--- a/src/Verification/Issuer.php
+++ b/src/Verification/Issuer.php
@@ -10,15 +10,9 @@ use SkillDisplay\PHPToolKit\Configuration\Settings;
class Issuer
{
- /**
- * @var Settings
- */
- private $settings;
+ private Settings $settings;
- /**
- * @var string
- */
- private $apislug = '/api/v1/verification/create';
+ private string $apislug = '/api/v1/verification/create';
/**
* @param int $ID ID of the Skill or SkillSet
@@ -26,7 +20,7 @@ class Issuer
* @param string $vtype one of VERIFICATION_SELF, VERIFICATION_EDUCATIONAL, VERIFICATION_BUSINESS, VERIFICATION_CERTIFICATION
* @param bool $isSkillSet
* @param int $campaignId
- *
+ * @param bool $autoConfirm
* @return array
*/
private function generateSignedRequestData(
diff --git a/src/Verification/Link.php b/src/Verification/Link.php
index bc13f43..3b5c58f 100644
--- a/src/Verification/Link.php
+++ b/src/Verification/Link.php
@@ -18,10 +18,7 @@ class Link
*/
private $id;
- /**
- * @var Settings
- */
- private $settings;
+ private Settings $settings;
public const SKILL = 'skill';
@@ -29,10 +26,7 @@ class Link
/* SVG Definitions */
- /**
- * @var string
- */
- private $verification_self_svg = '
+ private string $verification_self_svg = '
';
- /**
- * @var string
- */
- private $verification_educational_svg = '
+ private string $verification_educational_svg = '
';
- /**
- * @var string
- */
- private $verification_business_svg = '
+ private string $verification_business_svg = '
';
- /**
- * @var string
- */
- private $verification_certification_svg = '
+ private string $verification_certification_svg = '