web-base/core/Objects/ConnectionData.class.php
2022-02-21 13:01:03 +01:00

42 lines
995 B
PHP

<?php
namespace Objects;
class ConnectionData {
private string $host;
private int $port;
private string $login;
private string $password;
private array $properties;
public function __construct($host, $port, $login, $password) {
$this->host = $host;
$this->port = $port;
$this->login = $login;
$this->password = $password;
$this->properties = array();
}
public function getProperties(): array {
return $this->properties;
}
public function getProperty($key, $defaultValue='') {
return $this->properties[$key] ?? $defaultValue;
}
public function setProperty($key, $val): bool {
if (!is_scalar($val)) {
return false;
}
$this->properties[$key] = $val;
return true;
}
public function getHost(): string { return $this->host; }
public function getPort(): int { return $this->port; }
public function getLogin(): string { return $this->login; }
public function getPassword(): string { return $this->password; }
}