Refactor and extend configuration classes.
This commit is contained in:
parent
01253d5115
commit
395e6b95ff
24 changed files with 1158 additions and 682 deletions
|
@ -1,83 +1,151 @@
|
|||
<?php
|
||||
|
||||
namespace Socialbox\Classes\Configuration;
|
||||
namespace Socialbox\Classes\Configuration;
|
||||
|
||||
class CacheConfiguration
|
||||
{
|
||||
private bool $enabled;
|
||||
private string $engine;
|
||||
private string $host;
|
||||
private int $port;
|
||||
private ?string $username;
|
||||
private ?string $password;
|
||||
private ?int $database;
|
||||
|
||||
private bool $sessionsEnabled;
|
||||
private int $sessionsTtl;
|
||||
private int $sessionsMax;
|
||||
|
||||
public function __construct(array $data)
|
||||
class CacheConfiguration
|
||||
{
|
||||
$this->enabled = (bool)$data['enabled'];
|
||||
$this->engine = (string)$data['engine'];
|
||||
$this->host = (string)$data['host'];
|
||||
$this->port = (int)$data['port'];
|
||||
$this->username = $data['username'] ? (string)$data['username'] : null;
|
||||
$this->password = $data['password'] ? (string)$data['password'] : null;
|
||||
$this->database = $data['database'] ? (int)$data['database'] : null;
|
||||
private bool $enabled;
|
||||
private string $engine;
|
||||
private string $host;
|
||||
private int $port;
|
||||
private ?string $username;
|
||||
private ?string $password;
|
||||
private ?int $database;
|
||||
|
||||
$this->sessionsEnabled = (bool)$data['sessions']['enabled'];
|
||||
$this->sessionsTtl = (int)$data['sessions']['ttl'];
|
||||
$this->sessionsMax = (int)$data['sessions']['max'];
|
||||
}
|
||||
private bool $sessionsEnabled;
|
||||
private int $sessionsTtl;
|
||||
private int $sessionsMax;
|
||||
|
||||
public function isEnabled(): bool
|
||||
{
|
||||
return $this->enabled;
|
||||
}
|
||||
/**
|
||||
* Constructor to initialize configuration values.
|
||||
*
|
||||
* @param array $data An associative array containing configuration data.
|
||||
* Keys include:
|
||||
* - enabled (bool): Whether the feature is enabled.
|
||||
* - engine (string): The engine type.
|
||||
* - host (string): The host address.
|
||||
* - port (int): The port number.
|
||||
* - username (string|null): The username for authentication.
|
||||
* - password (string|null): The password for authentication.
|
||||
* - database (int|null): The database ID.
|
||||
* - sessions (array): Session-specific settings. Keys include:
|
||||
* - enabled (bool): Whether sessions are enabled.
|
||||
* - ttl (int): Session time-to-live in seconds.
|
||||
* - max (int): Maximum number of concurrent sessions.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(array $data)
|
||||
{
|
||||
$this->enabled = (bool)$data['enabled'];
|
||||
$this->engine = (string)$data['engine'];
|
||||
$this->host = (string)$data['host'];
|
||||
$this->port = (int)$data['port'];
|
||||
$this->username = $data['username'] ? (string)$data['username'] : null;
|
||||
$this->password = $data['password'] ? (string)$data['password'] : null;
|
||||
$this->database = $data['database'] ? (int)$data['database'] : null;
|
||||
$this->sessionsEnabled = (bool)$data['sessions']['enabled'];
|
||||
$this->sessionsTtl = (int)$data['sessions']['ttl'];
|
||||
$this->sessionsMax = (int)$data['sessions']['max'];
|
||||
}
|
||||
|
||||
public function getEngine(): string
|
||||
{
|
||||
return $this->engine;
|
||||
}
|
||||
/**
|
||||
* Checks whether the feature is enabled.
|
||||
*
|
||||
* @return bool Returns true if the feature is enabled, false otherwise.
|
||||
*/
|
||||
public function isEnabled(): bool
|
||||
{
|
||||
return $this->enabled;
|
||||
}
|
||||
|
||||
public function getHost(): string
|
||||
{
|
||||
return $this->host;
|
||||
}
|
||||
/**
|
||||
* Retrieves the engine name.
|
||||
*
|
||||
* @return string Returns the name of the engine.
|
||||
*/
|
||||
public function getEngine(): string
|
||||
{
|
||||
return $this->engine;
|
||||
}
|
||||
|
||||
public function getPort(): int
|
||||
{
|
||||
return $this->port;
|
||||
}
|
||||
/**
|
||||
* Retrieves the host value.
|
||||
*
|
||||
* @return string The host as a string.
|
||||
*/
|
||||
public function getHost(): string
|
||||
{
|
||||
return $this->host;
|
||||
}
|
||||
|
||||
public function getUsername(): ?string
|
||||
{
|
||||
return $this->username;
|
||||
}
|
||||
/**
|
||||
* Retrieves the port value.
|
||||
*
|
||||
* @return int The port number.
|
||||
*/
|
||||
public function getPort(): int
|
||||
{
|
||||
return $this->port;
|
||||
}
|
||||
|
||||
public function getPassword(): ?string
|
||||
{
|
||||
return $this->password;
|
||||
}
|
||||
/**
|
||||
* Retrieves the username value.
|
||||
*
|
||||
* @return string|null The username, or null if not set.
|
||||
*/
|
||||
public function getUsername(): ?string
|
||||
{
|
||||
return $this->username;
|
||||
}
|
||||
|
||||
public function getDatabase(): ?int
|
||||
{
|
||||
return $this->database;
|
||||
}
|
||||
/**
|
||||
* Retrieves the password value.
|
||||
*
|
||||
* @return string|null The password as a string or null if not set.
|
||||
*/
|
||||
public function getPassword(): ?string
|
||||
{
|
||||
return $this->password;
|
||||
}
|
||||
|
||||
public function isSessionsEnabled(): bool
|
||||
{
|
||||
return $this->sessionsEnabled;
|
||||
}
|
||||
/**
|
||||
* Retrieves the database identifier.
|
||||
*
|
||||
* @return int|null The database identifier or null if not set.
|
||||
*/
|
||||
public function getDatabase(): ?int
|
||||
{
|
||||
return $this->database;
|
||||
}
|
||||
|
||||
public function getSessionsTtl(): int
|
||||
{
|
||||
return $this->sessionsTtl;
|
||||
}
|
||||
/**
|
||||
* Checks whether sessions are enabled.
|
||||
*
|
||||
* @return bool Returns true if sessions are enabled, otherwise false.
|
||||
*/
|
||||
public function isSessionsEnabled(): bool
|
||||
{
|
||||
return $this->sessionsEnabled;
|
||||
}
|
||||
|
||||
public function getSessionsMax(): int
|
||||
{
|
||||
return $this->sessionsMax;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Retrieves the time-to-live (TTL) value for sessions.
|
||||
*
|
||||
* @return int The TTL value for sessions.
|
||||
*/
|
||||
public function getSessionsTtl(): int
|
||||
{
|
||||
return $this->sessionsTtl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the maximum number of sessions allowed.
|
||||
*
|
||||
* @return int Returns the maximum number of sessions.
|
||||
*/
|
||||
public function getSessionsMax(): int
|
||||
{
|
||||
return $this->sessionsMax;
|
||||
}
|
||||
}
|
|
@ -1,46 +1,83 @@
|
|||
<?php
|
||||
|
||||
namespace Socialbox\Classes\Configuration;
|
||||
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)
|
||||
class DatabaseConfiguration
|
||||
{
|
||||
$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'];
|
||||
}
|
||||
private string $host;
|
||||
private int $port;
|
||||
private string $username;
|
||||
private ?string $password;
|
||||
private string $name;
|
||||
|
||||
public function getHost(): string
|
||||
{
|
||||
return $this->host;
|
||||
}
|
||||
/**
|
||||
* Constructor method to initialize properties from the provided data array.
|
||||
*
|
||||
* @param array $data Associative array containing the keys 'host', 'port', 'username', 'password', and 'name'.
|
||||
* - 'host' (string): The host of the server.
|
||||
* - 'port' (int): The port number.
|
||||
* - 'username' (string): The username for authentication.
|
||||
* - 'password' (string|null): The password for authentication, optional.
|
||||
* - 'name' (string): The name associated with the connection or resource.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
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 getPort(): int
|
||||
{
|
||||
return $this->port;
|
||||
}
|
||||
/**
|
||||
* Retrieves the host value.
|
||||
*
|
||||
* @return string The value of the host.
|
||||
*/
|
||||
public function getHost(): string
|
||||
{
|
||||
return $this->host;
|
||||
}
|
||||
|
||||
public function getUsername(): string
|
||||
{
|
||||
return $this->username;
|
||||
}
|
||||
/**
|
||||
* Retrieves the port value.
|
||||
*
|
||||
* @return int The value of the port.
|
||||
*/
|
||||
public function getPort(): int
|
||||
{
|
||||
return $this->port;
|
||||
}
|
||||
|
||||
public function getPassword(): ?string
|
||||
{
|
||||
return $this->password;
|
||||
}
|
||||
/**
|
||||
* Retrieves the username value.
|
||||
*
|
||||
* @return string The value of the username.
|
||||
*/
|
||||
public function getUsername(): string
|
||||
{
|
||||
return $this->username;
|
||||
}
|
||||
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Retrieves the password value.
|
||||
*
|
||||
* @return string|null The value of the password, or null if not set.
|
||||
*/
|
||||
public function getPassword(): ?string
|
||||
{
|
||||
return $this->password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the name value.
|
||||
*
|
||||
* @return string The value of the name
|
||||
*/
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
}
|
|
@ -1,115 +1,121 @@
|
|||
<?php
|
||||
|
||||
namespace Socialbox\Classes\Configuration;
|
||||
namespace Socialbox\Classes\Configuration;
|
||||
|
||||
use LogLib\Enums\LogLevel;
|
||||
use LogLib\Enums\LogLevel;
|
||||
|
||||
class LoggingConfiguration
|
||||
{
|
||||
private bool $consoleLoggingEnabled;
|
||||
private string $consoleLoggingLevel;
|
||||
private bool $fileLoggingEnabled;
|
||||
private string $fileLoggingLevel;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of the class with the given configuration data.
|
||||
*
|
||||
* @param array $data An associative array containing logging configuration settings.
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(array $data)
|
||||
class LoggingConfiguration
|
||||
{
|
||||
$this->consoleLoggingEnabled = (bool) $data['console_logging_enabled'];
|
||||
$this->consoleLoggingLevel = $data['console_logging_level'];
|
||||
$this->fileLoggingEnabled = (bool) $data['file_logging_enabled'];
|
||||
$this->fileLoggingLevel = $data['file_logging_level'];
|
||||
}
|
||||
private bool $consoleLoggingEnabled;
|
||||
private string $consoleLoggingLevel;
|
||||
private bool $fileLoggingEnabled;
|
||||
private string $fileLoggingLevel;
|
||||
|
||||
/**
|
||||
* Checks if console logging is enabled.
|
||||
*
|
||||
* @return bool True if console logging is enabled, otherwise false.
|
||||
*/
|
||||
public function isConsoleLoggingEnabled(): bool
|
||||
{
|
||||
return $this->consoleLoggingEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the logging level for console output.
|
||||
*
|
||||
* @return LogLevel The logging level configured for console output.
|
||||
*/
|
||||
public function getConsoleLoggingLevel(): LogLevel
|
||||
{
|
||||
return $this->parseLogLevel($this->consoleLoggingLevel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if file logging is enabled.
|
||||
*
|
||||
* @return bool True if file logging is enabled, false otherwise.
|
||||
*/
|
||||
public function isFileLoggingEnabled(): bool
|
||||
{
|
||||
return $this->fileLoggingEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the logging level for file logging.
|
||||
*
|
||||
* @return LogLevel The logging level set for file logging.
|
||||
*/
|
||||
public function getFileLoggingLevel(): LogLevel
|
||||
{
|
||||
return $this->parseLogLevel($this->fileLoggingLevel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the given log level from string format to a LogLevel enumeration.
|
||||
*
|
||||
* @param string $logLevel The log level as a string.
|
||||
* @return LogLevel The corresponding LogLevel enumeration.
|
||||
*/
|
||||
private function parseLogLevel(string $logLevel): LogLevel
|
||||
{
|
||||
switch (strtolower($logLevel)) {
|
||||
case LogLevel::DEBUG:
|
||||
case 'debug':
|
||||
case '6':
|
||||
case 'dbg':
|
||||
return LogLevel::DEBUG;
|
||||
case LogLevel::VERBOSE:
|
||||
case 'verbose':
|
||||
case '5':
|
||||
case 'vrb':
|
||||
return LogLevel::VERBOSE;
|
||||
default:
|
||||
case LogLevel::INFO:
|
||||
case 'info':
|
||||
case '4':
|
||||
case 'inf':
|
||||
return LogLevel::INFO;
|
||||
case LogLevel::WARNING:
|
||||
case 'warning':
|
||||
case '3':
|
||||
case 'wrn':
|
||||
return LogLevel::WARNING;
|
||||
case LogLevel::ERROR:
|
||||
case 'error':
|
||||
case '2':
|
||||
case 'err':
|
||||
return LogLevel::ERROR;
|
||||
case LogLevel::FATAL:
|
||||
case 'fatal':
|
||||
case '1':
|
||||
case 'crt':
|
||||
return LogLevel::FATAL;
|
||||
case LogLevel::SILENT:
|
||||
case 'silent':
|
||||
case '0':
|
||||
case 'sil':
|
||||
return LogLevel::SILENT;
|
||||
/**
|
||||
* Initializes a new instance of the class with the given configuration data.
|
||||
*
|
||||
* @param array $data An associative array containing logging configuration settings.
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(array $data)
|
||||
{
|
||||
$this->consoleLoggingEnabled = (bool) $data['console_logging_enabled'];
|
||||
$this->consoleLoggingLevel = $data['console_logging_level'];
|
||||
$this->fileLoggingEnabled = (bool) $data['file_logging_enabled'];
|
||||
$this->fileLoggingLevel = $data['file_logging_level'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if console logging is enabled.
|
||||
*
|
||||
* @return bool True if console logging is enabled, otherwise false.
|
||||
*/
|
||||
public function isConsoleLoggingEnabled(): bool
|
||||
{
|
||||
return $this->consoleLoggingEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the logging level for console output.
|
||||
*
|
||||
* @return LogLevel The logging level configured for console output.
|
||||
*/
|
||||
public function getConsoleLoggingLevel(): LogLevel
|
||||
{
|
||||
return $this->parseLogLevel($this->consoleLoggingLevel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if file logging is enabled.
|
||||
*
|
||||
* @return bool True if file logging is enabled, false otherwise.
|
||||
*/
|
||||
public function isFileLoggingEnabled(): bool
|
||||
{
|
||||
return $this->fileLoggingEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the logging level for file logging.
|
||||
*
|
||||
* @return LogLevel The logging level set for file logging.
|
||||
*/
|
||||
public function getFileLoggingLevel(): LogLevel
|
||||
{
|
||||
return $this->parseLogLevel($this->fileLoggingLevel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the given log level from string format to a LogLevel enumeration.
|
||||
*
|
||||
* @param string $logLevel The log level as a string.
|
||||
* @return LogLevel The corresponding LogLevel enumeration.
|
||||
*/
|
||||
private function parseLogLevel(string $logLevel): LogLevel
|
||||
{
|
||||
switch (strtolower($logLevel))
|
||||
{
|
||||
case LogLevel::DEBUG:
|
||||
case 'debug':
|
||||
case '6':
|
||||
case 'dbg':
|
||||
return LogLevel::DEBUG;
|
||||
|
||||
case LogLevel::VERBOSE:
|
||||
case 'verbose':
|
||||
case '5':
|
||||
case 'vrb':
|
||||
return LogLevel::VERBOSE;
|
||||
|
||||
default:
|
||||
case LogLevel::INFO:
|
||||
case 'info':
|
||||
case '4':
|
||||
case 'inf':
|
||||
return LogLevel::INFO;
|
||||
|
||||
case LogLevel::WARNING:
|
||||
case 'warning':
|
||||
case '3':
|
||||
case 'wrn':
|
||||
return LogLevel::WARNING;
|
||||
case LogLevel::ERROR:
|
||||
case 'error':
|
||||
case '2':
|
||||
case 'err':
|
||||
return LogLevel::ERROR;
|
||||
|
||||
case LogLevel::FATAL:
|
||||
case 'fatal':
|
||||
case '1':
|
||||
case 'crt':
|
||||
return LogLevel::FATAL;
|
||||
|
||||
case LogLevel::SILENT:
|
||||
case 'silent':
|
||||
case '0':
|
||||
case 'sil':
|
||||
return LogLevel::SILENT;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,171 +1,202 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* This class handles the configuration settings for user registration.
|
||||
*/
|
||||
namespace Socialbox\Classes\Configuration;
|
||||
|
||||
namespace Socialbox\Classes\Configuration;
|
||||
|
||||
class RegistrationConfiguration
|
||||
{
|
||||
private bool $registrationEnabled;
|
||||
private ?string $privacyPolicyDocument;
|
||||
private bool $acceptPrivacyPolicy;
|
||||
private ?string $termsOfServiceDocument;
|
||||
private bool $acceptTermsOfService;
|
||||
private bool $passwordRequired;
|
||||
private bool $otpRequired;
|
||||
private bool $displayNameRequired;
|
||||
private bool $emailVerificationRequired;
|
||||
private bool $smsVerificationRequired;
|
||||
private bool $phoneCallVerificationRequired;
|
||||
private bool $imageCaptchaVerificationRequired;
|
||||
|
||||
/**
|
||||
* Constructor method for initializing verification requirements.
|
||||
*
|
||||
* @param array $data An associative array containing the following keys:
|
||||
* 'registration_enabled', 'password_required',
|
||||
* 'otp_required', 'display_name_required',
|
||||
* 'email_verification_required', 'sms_verification_required',
|
||||
* 'phone_call_verification_required', 'image_captcha_verification_required'.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(array $data)
|
||||
class RegistrationConfiguration
|
||||
{
|
||||
$this->registrationEnabled = (bool)$data['enabled'];
|
||||
$this->privacyPolicyDocument = $data['privacy_policy_document'] ?? null;
|
||||
$this->acceptPrivacyPolicy = $data['accept_privacy_policy'] ?? true;
|
||||
$this->termsOfServiceDocument = $data['terms_of_service_document'] ?? null;
|
||||
$this->acceptTermsOfService = $data['accept_terms_of_service'] ?? true;
|
||||
$this->passwordRequired = (bool)$data['password_required'];
|
||||
$this->otpRequired = (bool)$data['otp_required'];
|
||||
$this->displayNameRequired = (bool)$data['display_name_required'];
|
||||
$this->emailVerificationRequired = (bool)$data['email_verification_required'];
|
||||
$this->smsVerificationRequired = (bool)$data['sms_verification_required'];
|
||||
$this->phoneCallVerificationRequired = (bool)$data['phone_call_verification_required'];
|
||||
$this->imageCaptchaVerificationRequired = (bool)$data['image_captcha_verification_required'];
|
||||
}
|
||||
private bool $registrationEnabled;
|
||||
private ?string $privacyPolicyDocument;
|
||||
private int $privacyPolicyDate;
|
||||
private bool $acceptPrivacyPolicy;
|
||||
private ?string $termsOfServiceDocument;
|
||||
private int $termsOfServiceDate;
|
||||
private bool $acceptTermsOfService;
|
||||
private ?string $communityGuidelinesDocument;
|
||||
private int $communityGuidelinesDate;
|
||||
private bool $acceptCommunityGuidelines;
|
||||
private bool $passwordRequired;
|
||||
private bool $otpRequired;
|
||||
private bool $displayNameRequired;
|
||||
private bool $displayPictureRequired;
|
||||
private bool $imageCaptchaVerificationRequired;
|
||||
|
||||
/**
|
||||
* Checks if the registration is enabled.
|
||||
*
|
||||
* @return bool True if registration is enabled, false otherwise.
|
||||
*/
|
||||
public function isRegistrationEnabled(): bool
|
||||
{
|
||||
return $this->registrationEnabled;
|
||||
}
|
||||
/**
|
||||
* Constructor method for initializing verification requirements.
|
||||
*
|
||||
* @param array $data An associative array containing the following keys:
|
||||
* 'registration_enabled', 'password_required',
|
||||
* 'otp_required', 'display_name_required',
|
||||
* 'email_verification_required', 'sms_verification_required',
|
||||
* 'phone_call_verification_required', 'image_captcha_verification_required'.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(array $data)
|
||||
{
|
||||
$this->registrationEnabled = (bool)$data['enabled'];
|
||||
$this->privacyPolicyDocument = $data['privacy_policy_document'] ?? null;
|
||||
$this->privacyPolicyDate = $data['privacy_policy_date'] ?? 0;
|
||||
$this->acceptPrivacyPolicy = $data['accept_privacy_policy'] ?? true;
|
||||
$this->termsOfServiceDocument = $data['terms_of_service_document'] ?? null;
|
||||
$this->termsOfServiceDate = $data['terms_of_service_date'] ?? 0;
|
||||
$this->acceptTermsOfService = $data['accept_terms_of_service'] ?? true;
|
||||
$this->communityGuidelinesDocument = $data['community_guidelines_document'] ?? null;
|
||||
$this->communityGuidelinesDate = $data['community_guidelines_date'] ?? 0;
|
||||
$this->acceptCommunityGuidelines = $data['accept_community_guidelines'] ?? true;
|
||||
$this->passwordRequired = (bool)$data['password_required'];
|
||||
$this->otpRequired = (bool)$data['otp_required'];
|
||||
$this->displayNameRequired = (bool)$data['display_name_required'];
|
||||
$this->displayPictureRequired = (bool)$data['display_picture_required'];
|
||||
$this->imageCaptchaVerificationRequired = (bool)$data['image_captcha_verification_required'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the registration is enabled.
|
||||
*
|
||||
* @return bool True if registration is enabled, false otherwise.
|
||||
*/
|
||||
public function isRegistrationEnabled(): bool
|
||||
{
|
||||
return $this->registrationEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the privacy policy document.
|
||||
*
|
||||
* @return ?string Returns the privacy policy document or null if not set.
|
||||
*/
|
||||
public function getPrivacyPolicyDocument(): ?string
|
||||
{
|
||||
return $this->privacyPolicyDocument;
|
||||
}
|
||||
/**
|
||||
* Retrieves the privacy policy document.
|
||||
*
|
||||
* @return ?string Returns the privacy policy document or null if not set.
|
||||
*/
|
||||
public function getPrivacyPolicyDocument(): ?string
|
||||
{
|
||||
return $this->privacyPolicyDocument;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if accepting the privacy policy is required.
|
||||
*
|
||||
* @return bool Returns true if the privacy policy must be accepted, false otherwise.
|
||||
*/
|
||||
public function isAcceptPrivacyPolicyRequired(): bool
|
||||
{
|
||||
return $this->acceptPrivacyPolicy;
|
||||
}
|
||||
/**
|
||||
* Retrieves the date of the privacy policy.
|
||||
*
|
||||
* @return int Returns the date of the privacy policy.
|
||||
*/
|
||||
public function getPrivacyPolicyDate(): int
|
||||
{
|
||||
return $this->privacyPolicyDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the terms of service document.
|
||||
*
|
||||
* @return ?string Returns the terms of service document or null if not set.
|
||||
*/
|
||||
public function getTermsOfServiceDocument(): ?string
|
||||
{
|
||||
return $this->termsOfServiceDocument;
|
||||
}
|
||||
/**
|
||||
* Checks if accepting the privacy policy is required.
|
||||
*
|
||||
* @return bool Returns true if the privacy policy must be accepted, false otherwise.
|
||||
*/
|
||||
public function isAcceptPrivacyPolicyRequired(): bool
|
||||
{
|
||||
return $this->acceptPrivacyPolicy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if accepting the terms of service is required.
|
||||
*
|
||||
* @return bool Returns true if the terms of service must be accepted, false otherwise.
|
||||
*/
|
||||
public function isAcceptTermsOfServiceRequired(): bool
|
||||
{
|
||||
return $this->acceptTermsOfService;
|
||||
}
|
||||
/**
|
||||
* Retrieves the terms of service document.
|
||||
*
|
||||
* @return ?string Returns the terms of service document or null if not set.
|
||||
*/
|
||||
public function getTermsOfServiceDocument(): ?string
|
||||
{
|
||||
return $this->termsOfServiceDocument;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if a password is required.
|
||||
*
|
||||
* @return bool True if a password is required, false otherwise.
|
||||
*/
|
||||
public function isPasswordRequired(): bool
|
||||
{
|
||||
return $this->passwordRequired;
|
||||
}
|
||||
/**
|
||||
* Retrieves the date of the terms of service.
|
||||
*
|
||||
* @return int Returns the date of the terms of service.
|
||||
*/
|
||||
public function getTermsOfServiceDate(): int
|
||||
{
|
||||
return $this->termsOfServiceDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if OTP (One-Time Password) is required.
|
||||
*
|
||||
* @return bool True if OTP is required, false otherwise.
|
||||
*/
|
||||
public function isOtpRequired(): bool
|
||||
{
|
||||
return $this->otpRequired;
|
||||
}
|
||||
/**
|
||||
* Checks if accepting the terms of service is required.
|
||||
*
|
||||
* @return bool Returns true if the terms of service must be accepted, false otherwise.
|
||||
*/
|
||||
public function isAcceptTermsOfServiceRequired(): bool
|
||||
{
|
||||
return $this->acceptTermsOfService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a display name is required.
|
||||
*
|
||||
* @return bool Returns true if a display name is required, false otherwise.
|
||||
*/
|
||||
public function isDisplayNameRequired(): bool
|
||||
{
|
||||
return $this->displayNameRequired;
|
||||
}
|
||||
/**
|
||||
* Retrieves the community guidelines document.
|
||||
*
|
||||
* @return ?string Returns the community guidelines document or null if not set.
|
||||
*/
|
||||
public function getCommunityGuidelinesDocument(): ?string
|
||||
{
|
||||
return $this->communityGuidelinesDocument;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if email verification is required.
|
||||
*
|
||||
* @return bool Returns true if email verification is required, false otherwise.
|
||||
*/
|
||||
public function isEmailVerificationRequired(): bool
|
||||
{
|
||||
return $this->emailVerificationRequired;
|
||||
}
|
||||
/**
|
||||
* Retrieves the date of the community guidelines.
|
||||
*
|
||||
* @return int Returns the date of the community guidelines.
|
||||
*/
|
||||
public function getCommunityGuidelinesDate(): int
|
||||
{
|
||||
return $this->communityGuidelinesDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if SMS verification is required.
|
||||
*
|
||||
* @return bool Returns true if SMS verification is required, false otherwise.
|
||||
*/
|
||||
public function isSmsVerificationRequired(): bool
|
||||
{
|
||||
return $this->smsVerificationRequired;
|
||||
}
|
||||
/**
|
||||
* Checks if accepting the community guidelines is required.
|
||||
*
|
||||
* @return bool Returns true if the community guidelines must be accepted, false otherwise.
|
||||
*/
|
||||
public function isAcceptCommunityGuidelinesRequired(): bool
|
||||
{
|
||||
return $this->acceptCommunityGuidelines;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if phone call verification is required.
|
||||
*
|
||||
* @return bool Returns true if phone call verification is required, false otherwise.
|
||||
*/
|
||||
public function isPhoneCallVerificationRequired(): bool
|
||||
{
|
||||
return $this->phoneCallVerificationRequired;
|
||||
}
|
||||
/**
|
||||
* Determines if a password is required.
|
||||
*
|
||||
* @return bool True if a password is required, false otherwise.
|
||||
*/
|
||||
public function isPasswordRequired(): bool
|
||||
{
|
||||
return $this->passwordRequired;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if image CAPTCHA verification is required.
|
||||
*
|
||||
* @return bool Returns true if image CAPTCHA verification is required, false otherwise.
|
||||
*/
|
||||
public function isImageCaptchaVerificationRequired(): bool
|
||||
{
|
||||
return $this->imageCaptchaVerificationRequired;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Determines if OTP (One-Time Password) is required.
|
||||
*
|
||||
* @return bool True if OTP is required, false otherwise.
|
||||
*/
|
||||
public function isOtpRequired(): bool
|
||||
{
|
||||
return $this->otpRequired;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a display name is required.
|
||||
*
|
||||
* @return bool Returns true if a display name is required, false otherwise.
|
||||
*/
|
||||
public function isDisplayNameRequired(): bool
|
||||
{
|
||||
return $this->displayNameRequired;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a display picture is required.
|
||||
*
|
||||
* @return bool Returns true if a display picture is required, false otherwise.
|
||||
*/
|
||||
public function isDisplayPictureRequired(): bool
|
||||
{
|
||||
return $this->displayPictureRequired;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if image CAPTCHA verification is required.
|
||||
*
|
||||
* @return bool Returns true if image CAPTCHA verification is required, false otherwise.
|
||||
*/
|
||||
public function isImageCaptchaVerificationRequired(): bool
|
||||
{
|
||||
return $this->imageCaptchaVerificationRequired;
|
||||
}
|
||||
}
|
|
@ -1,55 +1,55 @@
|
|||
<?php
|
||||
|
||||
namespace Socialbox\Classes\Configuration;
|
||||
namespace Socialbox\Classes\Configuration;
|
||||
|
||||
class SecurityConfiguration
|
||||
{
|
||||
private bool $displayInternalExceptions;
|
||||
private int $resolvedServersTtl;
|
||||
private int $captchaTtl;
|
||||
|
||||
/**
|
||||
* Constructor method for initializing class properties.
|
||||
*
|
||||
* @param array $data An associative array containing values for initializing the properties.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(array $data)
|
||||
class SecurityConfiguration
|
||||
{
|
||||
$this->displayInternalExceptions = $data['display_internal_exceptions'];
|
||||
$this->resolvedServersTtl = $data['resolved_servers_ttl'];
|
||||
$this->captchaTtl = $data['captcha_ttl'];
|
||||
}
|
||||
private bool $displayInternalExceptions;
|
||||
private int $resolvedServersTtl;
|
||||
private int $captchaTtl;
|
||||
|
||||
/**
|
||||
* Determines if the display of internal errors is enabled.
|
||||
*
|
||||
* @return bool True if the display of internal errors is enabled, false otherwise.
|
||||
*/
|
||||
public function isDisplayInternalExceptions(): bool
|
||||
{
|
||||
return $this->displayInternalExceptions;
|
||||
}
|
||||
/**
|
||||
* Constructor method for initializing class properties.
|
||||
*
|
||||
* @param array $data An associative array containing values for initializing the properties.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(array $data)
|
||||
{
|
||||
$this->displayInternalExceptions = $data['display_internal_exceptions'];
|
||||
$this->resolvedServersTtl = $data['resolved_servers_ttl'];
|
||||
$this->captchaTtl = $data['captcha_ttl'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the time-to-live (TTL) value for resolved servers.
|
||||
*
|
||||
* @return int The TTL value for resolved servers.
|
||||
*/
|
||||
public function getResolvedServersTtl(): int
|
||||
{
|
||||
return $this->resolvedServersTtl;
|
||||
}
|
||||
/**
|
||||
* Determines if the display of internal errors is enabled.
|
||||
*
|
||||
* @return bool True if the display of internal errors is enabled, false otherwise.
|
||||
*/
|
||||
public function isDisplayInternalExceptions(): bool
|
||||
{
|
||||
return $this->displayInternalExceptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the time-to-live (TTL) value for captchas.
|
||||
*
|
||||
* @return int The TTL value for captchas.
|
||||
*/
|
||||
public function getCaptchaTtl(): int
|
||||
{
|
||||
return $this->captchaTtl;
|
||||
}
|
||||
/**
|
||||
* Retrieves the time-to-live (TTL) value for resolved servers.
|
||||
*
|
||||
* @return int The TTL value for resolved servers.
|
||||
*/
|
||||
public function getResolvedServersTtl(): int
|
||||
{
|
||||
return $this->resolvedServersTtl;
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Retrieves the time-to-live (TTL) value for captchas.
|
||||
*
|
||||
* @return int The TTL value for captchas.
|
||||
*/
|
||||
public function getCaptchaTtl(): int
|
||||
{
|
||||
return $this->captchaTtl;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue