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 -SeamsCMSDeliverySdk 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;
/**
* Class Asset
* @package SeamsCMS\Delivery\Model
class Asset
{
use HydratorTrait {
fromArray as private fromArrayTrait;
}
/** @var string */
private $link;
/** @var string|null */
private $thumbnailLink;
/** @var int */
private $size;
private $path;
private $title;
private $mimetype;
private $workspace;
/** @var AssetMeta */
private $meta;
* Asset constructor.
protected function __construct() {
* @return string
public function getLink(): string
return $this->link;
* @return string|null
public function getThumbnailLink()
return $this->thumbnailLink;
* @return int
public function getSize(): int
return $this->size;
public function getPath(): string
return $this->path;
public function getTitle(): string
return $this->title;
public function getMimetype(): string
return $this->mimetype;
public function getWorkspace(): string
return $this->workspace;
* @return AssetMeta
public function getMeta(): AssetMeta
return $this->meta;
* @param array $data
* @return Asset
public static function fromArray(array $data)
if (! isset($data['meta']) || ! isset($data['asset'])) {
throw new \InvalidArgumentException("Need both 'meta' and 'asset'");
$meta = AssetMeta::fromArray($data['meta']);
$data = $data['asset'];
$data['meta'] = $meta;
return self::fromArrayTrait($data);