-
Notifications
You must be signed in to change notification settings - Fork 10
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
1 parent
a8c66e4
commit ec7bc57
Showing
4 changed files
with
112 additions
and
4 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,72 @@ | ||
<?php | ||
|
||
|
||
namespace DiskominfotikBandaAceh\ESignBSrE; | ||
|
||
|
||
class ESignBSreResponse | ||
{ | ||
private $status; | ||
private $errors; | ||
private $data; | ||
private $response; | ||
private const STATUS_OK = 200; | ||
|
||
public function __construct($response) | ||
{ | ||
$this->response = $response; | ||
|
||
$this->setStatus(); | ||
$this->setErrors(); | ||
$this->setData(); | ||
} | ||
|
||
private function setStatus(): void | ||
{ | ||
$this->status = $this->response->status(); | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getStatus(): int | ||
{ | ||
return $this->status; | ||
} | ||
|
||
/** | ||
* @param mixed $errors | ||
*/ | ||
public function setErrors(): void | ||
{ | ||
if ($this->status != self::STATUS_OK){ | ||
$this->errors = json_decode($this->response->body())->error; | ||
} | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getErrors() | ||
{ | ||
return $this->errors; | ||
} | ||
|
||
/** | ||
* @param mixed $data | ||
*/ | ||
public function setData(): void | ||
{ | ||
if ($this->status == self::STATUS_OK){ | ||
$this->data = $this->response->body(); | ||
} | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getData() | ||
{ | ||
return $this->data; | ||
} | ||
} |
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