-
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.
Added error support(this also fixes generic data check)
- Loading branch information
1 parent
0798429
commit bb27027
Showing
6 changed files
with
75 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace TemirkhanN\Generic; | ||
|
||
class Error | ||
{ | ||
private string $message; | ||
private int $code; | ||
/** @var array<mixed> */ | ||
private array $details; | ||
|
||
/** | ||
* @param string $message | ||
* @param int $code | ||
* @param array<mixed> $details | ||
*/ | ||
public function __construct(string $message, int $code = 0, array $details = []) | ||
{ | ||
$this->message = $message; | ||
$this->code = $code; | ||
$this->details = $details; | ||
} | ||
|
||
public function getMessage(): string | ||
{ | ||
return $this->message; | ||
} | ||
|
||
public function getCode(): int | ||
{ | ||
return $this->code; | ||
} | ||
|
||
/** | ||
* @return array<mixed> | ||
*/ | ||
public function getDetails(): array | ||
{ | ||
return $this->details; | ||
} | ||
} |
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
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
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