accounts/api/modules/session/models/protocols/BaseHasJoined.php

32 lines
728 B
PHP
Raw Normal View History

<?php
namespace api\modules\session\models\protocols;
abstract class BaseHasJoined implements HasJoinedInterface {
private $username;
2018-04-18 02:17:25 +05:30
private $serverId;
public function __construct(string $username, string $serverId) {
$this->username = trim($username);
$this->serverId = trim($serverId);
}
public function getUsername(): string {
return $this->username;
}
public function getServerId(): string {
return $this->serverId;
}
public function validate(): bool {
return !$this->isEmpty($this->username) && !$this->isEmpty($this->serverId);
}
private function isEmpty($value): bool {
return $value === null || $value === '';
}
}