You've already forked dolibarr-api
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 759669e0dc | |||
| 3fe6def6ab |
@@ -4,15 +4,16 @@ namespace Magdev\DolibarrApi\Model;
|
|||||||
|
|
||||||
use DateTimeImmutable;
|
use DateTimeImmutable;
|
||||||
use DateTimeZone;
|
use DateTimeZone;
|
||||||
|
use JsonSerializable;
|
||||||
|
|
||||||
class StatusModel extends AbstractModel implements ModelInterface
|
class StatusModel extends AbstractModel implements ModelInterface, JsonSerializable
|
||||||
{
|
{
|
||||||
private ?string $dolibarVersion = null;
|
private ?string $dolibarrVersion = null;
|
||||||
private ?bool $accessLocked = null;
|
private ?bool $accessLocked = null;
|
||||||
private ?string $environment = null;
|
private ?string $environment = null;
|
||||||
private ?DateTimeImmutable $timestampNowUtc = null;
|
private ?DateTimeImmutable $timestampNowUtc = null;
|
||||||
private ?DateTimeZone $timestampPhpTz = null;
|
|
||||||
private ?DateTimeImmutable $dateTz = null;
|
private ?DateTimeImmutable $dateTz = null;
|
||||||
|
private ?DateTimeZone $timestampPhpTz = null;
|
||||||
|
|
||||||
public function __construct(?array $data = null)
|
public function __construct(?array $data = null)
|
||||||
{
|
{
|
||||||
@@ -21,12 +22,20 @@ class StatusModel extends AbstractModel implements ModelInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function jsonSerialize(): mixed
|
||||||
|
{
|
||||||
|
return $this->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
public function fromArray(array $data): static
|
public function fromArray(array $data): static
|
||||||
{
|
{
|
||||||
$this->setDolibarrVersion(dolibarVersion: $data['dolibarr_version'])
|
$this->setDolibarrVersion(dolibarrVersion: $data['dolibarr_version'])
|
||||||
->setAccessLocked(accessLocked: (bool) $data['access_locked'])
|
->setAccessLocked(accessLocked: (bool) $data['access_locked'])
|
||||||
->setEnvironment(environment: $data['environment'])
|
->setEnvironment(environment: $data['environment'])
|
||||||
->setTimestampNowUtc(timestampNowUtc: new DateTimeImmutable('@'.$data['timestamp_now_utc'], new DateTimeZone('UTC')))
|
->setTimestampNowUtc(timestampNowUtc: new DateTimeImmutable(
|
||||||
|
'@'.$data['timestamp_now_utc'],
|
||||||
|
new DateTimeZone('UTC')
|
||||||
|
))
|
||||||
->setDateTz(dateTz: $data['date_tz'])
|
->setDateTz(dateTz: $data['date_tz'])
|
||||||
->setTimestampPhpTz(timestampPhpTz: $data['timestamp_php_tz'])
|
->setTimestampPhpTz(timestampPhpTz: $data['timestamp_php_tz'])
|
||||||
->setStatusCode(statusCode: $data['code'])
|
->setStatusCode(statusCode: $data['code'])
|
||||||
@@ -49,12 +58,12 @@ class StatusModel extends AbstractModel implements ModelInterface
|
|||||||
|
|
||||||
public function getDolibarrVersion(): ?string
|
public function getDolibarrVersion(): ?string
|
||||||
{
|
{
|
||||||
return $this->dolibarVersion;
|
return $this->dolibarrVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setDolibarrVersion(?string $dolibarVersion): self
|
public function setDolibarrVersion(?string $dolibarrVersion): self
|
||||||
{
|
{
|
||||||
$this->dolibarVersion = $dolibarVersion;
|
$this->dolibarrVersion = $dolibarrVersion;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user