50 lines
896 B
PHP
50 lines
896 B
PHP
<?php
|
|
namespace ContentNation\ActivityPub\Common;
|
|
|
|
class Image extends APObject {
|
|
|
|
/**
|
|
* url
|
|
* @var string
|
|
*/
|
|
private $url = '';
|
|
|
|
/**
|
|
* media type
|
|
* @var string
|
|
*/
|
|
private $mediaType = '';
|
|
|
|
public function __construct() {
|
|
parent::__construct("Image");
|
|
}
|
|
|
|
|
|
/**
|
|
* set media type
|
|
* @param string $mediaType media type
|
|
* @return Image current instance
|
|
*/
|
|
public function setMediaType(string $mediaType) : Image {
|
|
$this->mediaType = $mediaType;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* create object from json
|
|
* @param mixed $json input
|
|
*/
|
|
public function fromJson($json) : bool {
|
|
if (!parent::fromJson($json)) {
|
|
return false;
|
|
}
|
|
if (array_key_exists('url', $json)) {
|
|
$this->url = $json['url'];
|
|
}
|
|
if (array_key_exists('mediaType', $json)) {
|
|
$this->mediaType = $json['mediaType'];
|
|
}
|
|
return true;
|
|
}
|
|
}
|