Refactored Configuration
This commit is contained in:
parent
5eeb06805a
commit
5555e79327
11 changed files with 247 additions and 46 deletions
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
namespace Socialbox\Classes\Configuration;
|
||||
|
||||
class DatabaseConfiguration
|
||||
{
|
||||
private string $host;
|
||||
private int $port;
|
||||
private string $username;
|
||||
private ?string $password;
|
||||
private string $name;
|
||||
|
||||
public function __construct(array $data)
|
||||
{
|
||||
$this->host = (string)$data['host'];
|
||||
$this->port = (int)$data['port'];
|
||||
$this->username = (string)$data['username'];
|
||||
$this->password = $data['password'] ? (string)$data['password'] : null;
|
||||
$this->name = (string)$data['name'];
|
||||
}
|
||||
|
||||
public function getHost(): string
|
||||
{
|
||||
return $this->host;
|
||||
}
|
||||
|
||||
public function getPort(): int
|
||||
{
|
||||
return $this->port;
|
||||
}
|
||||
|
||||
public function getUsername(): string
|
||||
{
|
||||
return $this->username;
|
||||
}
|
||||
|
||||
public function getPassword(): ?string
|
||||
{
|
||||
return $this->password;
|
||||
}
|
||||
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue