mirror of
https://github.com/friendica/friendica
synced 2025-04-27 21:50:11 +00:00
Add additional Mastodon timeline sorting date types and data to output
This commit is contained in:
parent
1adb23d8fd
commit
1f6578229e
6 changed files with 138 additions and 33 deletions
|
@ -38,7 +38,7 @@ class Status extends BaseDataTransferObject
|
|||
{
|
||||
/** @var string */
|
||||
protected $id;
|
||||
/** @var string (Datetime) */
|
||||
/** @var string|null (Datetime) */
|
||||
protected $created_at;
|
||||
/** @var string|null */
|
||||
protected $in_reply_to_id = null;
|
||||
|
@ -107,8 +107,8 @@ class Status extends BaseDataTransferObject
|
|||
*/
|
||||
public function __construct(array $item, Account $account, Counts $counts, UserAttributes $userAttributes, bool $sensitive, Application $application, array $mentions, array $tags, Card $card, array $attachments, array $in_reply, array $reblog, FriendicaExtension $friendica, array $quote = null, array $poll = null)
|
||||
{
|
||||
$this->id = (string)$item['uri-id'];
|
||||
$this->created_at = DateTimeFormat::utc($item['created'], DateTimeFormat::JSON);
|
||||
$this->id = (string)$item['uri-id'];
|
||||
$this->created_at = $item['created'];
|
||||
|
||||
if ($item['gravity'] == Item::GRAVITY_COMMENT) {
|
||||
$this->in_reply_to_id = (string)$item['thr-parent-id'];
|
||||
|
@ -155,18 +155,21 @@ class Status extends BaseDataTransferObject
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the current created_at DateTime as an integer timestamp
|
||||
* @return \DateTime
|
||||
* @throws \Exception
|
||||
* Returns the current created_at string or null if not set
|
||||
* @return \DateTime|null
|
||||
*/
|
||||
public function createdAtTimestamp(): \DateTime
|
||||
public function createdAt(): ?string
|
||||
{
|
||||
$result = new \DateTime($this->created_at);
|
||||
if (!$result) {
|
||||
throw new \Exception('Unknown date-time format');
|
||||
}
|
||||
return $this->created_at;
|
||||
}
|
||||
|
||||
return $result;
|
||||
/**
|
||||
* Returns the Friendica Extension properties
|
||||
* @return FriendicaExtension
|
||||
*/
|
||||
public function friendicaExtension(): FriendicaExtension
|
||||
{
|
||||
return $this->friendica;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue