1
0
Fork 0
mirror of https://github.com/archtechx/laravel-tips.git synced 2025-12-12 05:14:04 +00:00

php 7.4 refactor

This commit is contained in:
Samuel Štancl 2021-04-06 22:19:23 +02:00
parent 21c2fd4e94
commit bb40b60d3e
4 changed files with 40 additions and 15 deletions

View file

@ -9,13 +9,25 @@ use Illuminate\Support\Facades\Http;
*/
class Tweet
{
public string $id;
public string $text;
public TwitterUser $author;
public string|null $threadId = null;
public array $images = [];
public function __construct(
public string $id,
public string $text,
public TwitterUser $author,
public string|null $threadId = null,
public array $images = [],
) {}
string $id,
string $text,
TwitterUser $author,
string|null $threadId = null,
array $images = [],
) {
$this->id = $id;
$this->text = $text;
$this->author = $author;
$this->threadId = $threadId;
$this->images = $images;
}
/** Fetch a tweet. */
public static function fetch(string $id): Tweet