🎉 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;
|
||||
}
|
||||
}
|
17
classes/Application/Models/Author.php
Normal file
17
classes/Application/Models/Author.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Application\Models;
|
||||
|
||||
use JMS\Serializer\Annotation\SerializedName;
|
||||
use JMS\Serializer\Annotation\Type;
|
||||
|
||||
class Author
|
||||
{
|
||||
use Meta;
|
||||
|
||||
#[SerializedName('name')]
|
||||
#[Type('string')]
|
||||
private string $name;
|
||||
}
|
65
classes/Application/Models/Image.php
Normal file
65
classes/Application/Models/Image.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Application\Models;
|
||||
|
||||
use JMS\Serializer\Annotation\SerializedName;
|
||||
use JMS\Serializer\Annotation\Type;
|
||||
|
||||
class Image
|
||||
{
|
||||
use Meta;
|
||||
|
||||
#[SerializedName('path')]
|
||||
#[Type('string')]
|
||||
private string $path;
|
||||
|
||||
#[SerializedName('title')]
|
||||
#[Type('string')]
|
||||
private string $title;
|
||||
|
||||
#[SerializedName('mime')]
|
||||
#[Type('string')]
|
||||
private string $mime;
|
||||
|
||||
#[SerializedName('type')]
|
||||
#[Type('string')]
|
||||
private string $type;
|
||||
|
||||
#[SerializedName('description')]
|
||||
#[Type('string')]
|
||||
private string $description;
|
||||
|
||||
#[SerializedName('tags')]
|
||||
#[Type('array')]
|
||||
private array $tags;
|
||||
|
||||
#[SerializedName('size')]
|
||||
#[Type('string')]
|
||||
private string $size;
|
||||
|
||||
#[SerializedName('colors')]
|
||||
#[Type('array')]
|
||||
private array $colors;
|
||||
|
||||
#[SerializedName('width')]
|
||||
#[Type('string')]
|
||||
private string $width;
|
||||
|
||||
#[SerializedName('height')]
|
||||
#[Type('string')]
|
||||
private string $height;
|
||||
|
||||
#[SerializedName('altText')]
|
||||
#[Type('string')]
|
||||
private string $altText;
|
||||
|
||||
#[SerializedName('thumbhash')]
|
||||
#[Type('string')]
|
||||
private string $thumbhash;
|
||||
|
||||
#[SerializedName('folder')]
|
||||
#[Type('string')]
|
||||
private string $folder;
|
||||
}
|
38
classes/Application/Models/Meta.php
Normal file
38
classes/Application/Models/Meta.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Application\Models;
|
||||
|
||||
use DateTime;
|
||||
use JMS\Serializer\Annotation\SerializedName;
|
||||
use JMS\Serializer\Annotation\Type;
|
||||
|
||||
trait Meta
|
||||
{
|
||||
#[SerializedName('_model')]
|
||||
#[Type('string')]
|
||||
private ?string $metaModel;
|
||||
|
||||
#[SerializedName('_state')]
|
||||
#[Type('int')]
|
||||
private ?int $metaState;
|
||||
|
||||
#[SerializedName('_modified')]
|
||||
#[Type('DateTime<"U">')]
|
||||
private ?DateTime $metaModified;
|
||||
|
||||
#[SerializedName('_mby')]
|
||||
#[Type('string')]
|
||||
private ?string $metaMby;
|
||||
|
||||
#[SerializedName('_created')]
|
||||
#[Type('DateTime<"U">')]
|
||||
private ?DateTime $metaCreated;
|
||||
|
||||
#[SerializedName('_cby')]
|
||||
#[Type('string')]
|
||||
private ?string $metaCby;
|
||||
|
||||
#[SerializedName('_id')]
|
||||
#[Type('string')]
|
||||
private ?string $metaId;
|
||||
}
|
22
classes/Application/Models/Site.php
Normal file
22
classes/Application/Models/Site.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Application\Models;
|
||||
|
||||
use JMS\Serializer\Annotation\SerializedName;
|
||||
use JMS\Serializer\Annotation\Type;
|
||||
|
||||
class Site
|
||||
{
|
||||
use Meta;
|
||||
|
||||
#[SerializedName('title')]
|
||||
#[Type('string')]
|
||||
private ?string $title;
|
||||
|
||||
public function getSiteTitle(): string
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user