Skip to content

Commit

Permalink
Update UserGroupValidationResponse.php
Browse files Browse the repository at this point in the history
  • Loading branch information
slunak authored and OskarStark committed Sep 17, 2024
1 parent 9db03ec commit 935dfb6
Showing 1 changed file with 7 additions and 28 deletions.
35 changes: 7 additions & 28 deletions src/Client/Response/UserGroupValidationResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@
*/
class UserGroupValidationResponse extends Response
{
private bool $isGroup;
private ?bool $isGroup = null;

/**
* @var array<string>
*/
private array $devices;
private array $devices = [];

/**
* @var array<string>
*/
private array $licenses;
private array $licenses = [];

public function __construct(string $curlResponse)
{
Expand Down Expand Up @@ -60,41 +60,20 @@ public function getLicenses(): array
return $this->licenses;
}

private function setIsGroup(bool $isGroup): void
{
$this->isGroup = $isGroup;
}

/**
* @param array<string> $devices
*/
private function setDevices(array $devices): void
{
$this->devices = $devices;
}

/**
* @param array<string> $licenses
*/
private function setLicenses(array $licenses): void
{
$this->licenses = $licenses;
}

private function processCurlResponse(string $curlResponse): void
{
$decodedCurlResponse = $this->processInitialCurlResponse($curlResponse);

if ($this->getRequestStatus() === 1) {
$this->setDevices($decodedCurlResponse->devices);
$this->setLicenses($decodedCurlResponse->licenses);
$this->devices = $decodedCurlResponse->devices;
$this->licenses = $decodedCurlResponse->licenses;

if ($decodedCurlResponse->group === 1) {
$this->setIsGroup(true);
$this->isGroup = true;
}

if ($decodedCurlResponse->group === 0) {
$this->setIsGroup(false);
$this->isGroup = false;
}
}
}
Expand Down

0 comments on commit 935dfb6

Please sign in to comment.