47 lines
1.1 KiB
PHP
47 lines
1.1 KiB
PHP
<?php
|
|
namespace Uiharu\Lookup;
|
|
|
|
use Uiharu\Url;
|
|
|
|
class TwitterLookupTweetResult extends TwitterLookupResult {
|
|
private object $tweetInfo;
|
|
|
|
public function __construct(Url $url, object $tweetInfo) {
|
|
parent::__construct($url);
|
|
$this->tweetInfo = $tweetInfo;
|
|
}
|
|
|
|
public function getObjectType(): string {
|
|
return 'twitter:tweet';
|
|
}
|
|
|
|
public function getTwitterTweetId(): string {
|
|
return $this->tweetInfo->tweetId;
|
|
}
|
|
|
|
public function hasTitle(): bool {
|
|
return $this->tweetInfo->profileName !== '';
|
|
}
|
|
public function getTitle(): string {
|
|
return $this->tweetInfo->profileName;
|
|
}
|
|
|
|
public function hasDescription(): bool {
|
|
return $this->tweetInfo->tweetText !== '';
|
|
}
|
|
public function getDescription(): string {
|
|
return $this->tweetInfo->tweetText;
|
|
}
|
|
|
|
public function hasPreviewImage(): bool {
|
|
return $this->tweetInfo->profilePicture !== '';
|
|
}
|
|
public function getPreviewImage(): string {
|
|
return $this->tweetInfo->profilePicture;
|
|
}
|
|
|
|
public function getTwitterResult(): object {
|
|
return $this->tweetInfo;
|
|
}
|
|
}
|