coded = $this->encode($login, $password); } /** * It return true, because header is required when use login. * * @return bool True because header is required for login authorization. */ public function is_header_required(): bool { return true; } /** * This return content of the header. * * This return content of the headed, which contain coded login and * password. It is coded in the base64, which is not hash function end * could be easy decoded. It is cause that TLS must being used. * * @return string Content of the headed. */ public function header_content(): string { return 'Basic '.$this->coded; } /** * This encode login and password to use it headed. * * @param string $login Login of the user. * @param string $password Password for that user. * @return string Encoded form of login and password. */ private function encode(string $login, string $password): string { return base64_encode($login.':'.$password); } }