47 lines
1.2 KiB
PHP
47 lines
1.2 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->data[0]->username;
|
|
}
|
|
|
|
public function hasTitle(): bool {
|
|
return isset($this->userInfo->data[0]->name);
|
|
}
|
|
public function getTitle(): string {
|
|
return $this->userInfo->data[0]->name;
|
|
}
|
|
|
|
public function hasDescription(): bool {
|
|
return isset($this->userInfo->data[0]->description);
|
|
}
|
|
public function getDescription(): string {
|
|
return $this->userInfo->data[0]->description;
|
|
}
|
|
|
|
public function hasPreviewImage(): bool {
|
|
return isset($this->userInfo->data[0]->profile_image_url);
|
|
}
|
|
public function getPreviewImage(): string {
|
|
return $this->userInfo->data[0]->profile_image_url;
|
|
}
|
|
|
|
public function getTwitterResult(): object {
|
|
return $this->userInfo;
|
|
}
|
|
}
|