-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Daniel Kurowski
committed
Nov 10, 2023
1 parent
7cd11ad
commit e0ad0b6
Showing
2 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace HnutiBrontosaurus\BisClient\Event\Response; | ||
|
||
|
||
final class Tag | ||
{ | ||
|
||
private function __construct( | ||
private int $id, | ||
private string $name, | ||
private string $slug, | ||
private string $description, | ||
private bool $isActive, | ||
) {} | ||
|
||
|
||
/** | ||
* @param array{ | ||
* id: int, | ||
* name: string, | ||
* slug: string, | ||
* description: string, | ||
* is_active: bool, | ||
* } $payload | ||
*/ | ||
public static function fromPayload(array $payload): self | ||
{ | ||
return new self( | ||
$payload['id'], | ||
$payload['name'], | ||
$payload['slug'], | ||
$payload['description'], | ||
$payload['is_active'], | ||
); | ||
} | ||
|
||
|
||
public function getId(): int | ||
{ | ||
return $this->id; | ||
} | ||
|
||
|
||
public function getName(): string | ||
{ | ||
return $this->name; | ||
} | ||
|
||
|
||
public function getSlug(): string | ||
{ | ||
return $this->slug; | ||
} | ||
|
||
|
||
public function getDescription(): string | ||
{ | ||
return $this->description; | ||
} | ||
|
||
|
||
public function isActive(): bool | ||
{ | ||
return $this->isActive; | ||
} | ||
|
||
} |