This commit is contained in:
steven 2025-08-11 22:23:30 +02:00
commit 72a26edcff
22092 changed files with 2101903 additions and 0 deletions

View file

@ -0,0 +1,36 @@
<?php
namespace Spekulatius\PHPScraper\DataTransferObjects;
/**
* A simplified DTO to hold feed entries with incomplete data.
*
* This isn't aimed at keeping all details but the key values.
*/
class FeedEntry
{
/**
* @todo with drop of PHP7.4 we should make these public and remove the initialization above.
* @todo with drop of PHP7.4 and 8.0 we should make this `readonly`.
*/
public function __construct(
// Support for PHP7.4
public string $title,
public string $description,
public string $link
) {
}
/**
* @param array<string, string> $data
**/
public static function fromArray(array $data): self
{
// Convert to an object and return the instance.
return new self(
$data['title'] ?? '',
$data['description'] ?? '',
$data['link']
);
}
}