2024-10-30 15:12:55 -04:00
|
|
|
<?php
|
|
|
|
|
2024-12-10 13:30:08 -05:00
|
|
|
namespace Socialbox\Classes\Configuration;
|
2024-10-30 15:12:55 -04:00
|
|
|
|
2024-12-10 13:30:08 -05:00
|
|
|
class InstanceConfiguration
|
|
|
|
{
|
|
|
|
private bool $enabled;
|
2025-01-03 12:27:04 -05:00
|
|
|
private string $name;
|
2024-12-10 13:30:08 -05:00
|
|
|
private ?string $domain;
|
|
|
|
private ?string $rpcEndpoint;
|
2025-01-08 14:53:48 -05:00
|
|
|
private array $dnsMocks;
|
2024-10-30 15:12:55 -04:00
|
|
|
|
2024-12-10 13:30:08 -05:00
|
|
|
/**
|
|
|
|
* Constructor that initializes object properties with the provided data.
|
|
|
|
*
|
|
|
|
* @param array $data An associative array with keys 'enabled', 'domain', 'private_key', and 'public_key'.
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function __construct(array $data)
|
|
|
|
{
|
|
|
|
$this->enabled = (bool)$data['enabled'];
|
2025-01-03 12:27:04 -05:00
|
|
|
$this->name = $data['name'];
|
2024-12-10 13:30:08 -05:00
|
|
|
$this->domain = $data['domain'];
|
|
|
|
$this->rpcEndpoint = $data['rpc_endpoint'];
|
2025-01-08 14:53:48 -05:00
|
|
|
$this->dnsMocks = $data['dns_mocks'];
|
2024-12-10 13:30:08 -05:00
|
|
|
}
|
2024-10-30 15:12:55 -04:00
|
|
|
|
2024-12-10 13:30:08 -05:00
|
|
|
/**
|
|
|
|
* Checks if the current object is enabled.
|
|
|
|
*
|
|
|
|
* @return bool True if the object is enabled, false otherwise.
|
|
|
|
*/
|
|
|
|
public function isEnabled(): bool
|
|
|
|
{
|
|
|
|
return $this->enabled;
|
|
|
|
}
|
2024-10-30 15:12:55 -04:00
|
|
|
|
2025-01-03 12:27:04 -05:00
|
|
|
public function getName(): string
|
|
|
|
{
|
|
|
|
return $this->name;
|
|
|
|
}
|
|
|
|
|
2024-12-10 13:30:08 -05:00
|
|
|
/**
|
|
|
|
* Retrieves the domain.
|
|
|
|
*
|
|
|
|
* @return string|null The domain.
|
|
|
|
*/
|
|
|
|
public function getDomain(): ?string
|
|
|
|
{
|
|
|
|
return $this->domain;
|
|
|
|
}
|
2024-10-30 15:12:55 -04:00
|
|
|
|
2024-12-10 13:30:08 -05:00
|
|
|
/**
|
|
|
|
* @return string|null
|
|
|
|
*/
|
|
|
|
public function getRpcEndpoint(): ?string
|
|
|
|
{
|
|
|
|
return $this->rpcEndpoint;
|
|
|
|
}
|
2025-01-08 14:53:48 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function getDnsMocks(): array
|
|
|
|
{
|
|
|
|
return $this->dnsMocks;
|
|
|
|
}
|
2024-12-10 13:30:08 -05:00
|
|
|
}
|