for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
/*
* This file is part of the Seams-CMS Delivery SDK package.
*
* (c) Seams-CMS.com
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace SeamsCMS\Delivery\Model;
use SeamsCMS\Delivery\Exception\MissingFieldsException;
/**
* Class ContentType
* @package SeamsCMS\Delivery\Model
class ContentType
{
use HydratorTrait {
fromArray as private fromArrayTrait;
}
/** @var string */
private $id = "";
private $name = "";
private $description = "";
/** @var ContentTypeField[] */
private $fields = [];
* ContentType constructor.
final protected function __construct()
* @return string
public function getId(): string
return $this->id;
public function getName(): string
return $this->name;
public function getDescription(): string
return $this->description;
* @return ContentTypeField[]
public function getFields(): array
return $this->fields;
* @param array $data
* @return ContentType
public static function fromArray(array $data)
if (! isset($data['fields'])) {
throw MissingFieldsException::fieldsNotFound();
$data['fields'] = array_map(function ($item) {
return ContentTypeField::fromArray($item);
}, $data['fields']);
return self::fromArrayTrait($data);