uiharu/src/Lookup/TwitterLookupUserResult.php

47 lines
1.1 KiB
PHP

<?php
namespace Uiharu\Lookup;
use Uiharu\Url;
class TwitterLookupUserResult extends TwitterLookupResult {
private object $userInfo;
public function __construct(Url $url, object $userInfo) {
parent::__construct($url);
$this->userInfo = $userInfo;
}
public function getObjectType(): string {
return 'twitter:user';
}
public function getTwitterUserName(): string {
return $this->userInfo->userName;
}
public function hasTitle(): bool {
return $this->userInfo->profileName !== '';
}
public function getTitle(): string {
return $this->userInfo->profileName;
}
public function hasDescription(): bool {
return $this->userInfo->profileBio !== '';
}
public function getDescription(): string {
return $this->userInfo->profileBio;
}
public function hasPreviewImage(): bool {
return $this->userInfo->profilePicture !== '';
}
public function getPreviewImage(): string {
return $this->userInfo->profilePicture;
}
public function getTwitterResult(): object {
return $this->userInfo;
}
}