🎉 initial commit
This commit is contained in:
51
classes/Application/Models/Article.php
Normal file
51
classes/Application/Models/Article.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Application\Models;
|
||||
|
||||
use JMS\Serializer\Annotation\SerializedName;
|
||||
use JMS\Serializer\Annotation\Type;
|
||||
|
||||
class Article
|
||||
{
|
||||
use Meta;
|
||||
|
||||
#[SerializedName('authors')]
|
||||
#[Type('array<' . Author::class . '>')]
|
||||
protected array $authors;
|
||||
|
||||
#[SerializedName('headline')]
|
||||
#[Type('string')]
|
||||
protected string $headline;
|
||||
|
||||
#[SerializedName('excerpt')]
|
||||
#[Type('string')]
|
||||
protected string $excerpt;
|
||||
|
||||
#[SerializedName('image')]
|
||||
#[Type(Image::class)]
|
||||
protected Image $image;
|
||||
|
||||
#[SerializedName('text')]
|
||||
#[Type('string')]
|
||||
protected string $text;
|
||||
|
||||
/**
|
||||
* Return the title / headline.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle(): string {
|
||||
return $this->headline;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the text / article body text.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getText(): string {
|
||||
return $this->text;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user