mirror of
https://github.com/friendica/friendica
synced 2024-11-17 19:43:40 +00:00
refactor of Friendica\Object\Api\Mastodon\Preferences class
This commit is contained in:
parent
0bb8e3af80
commit
979468e7fb
1 changed files with 45 additions and 15 deletions
|
@ -17,16 +17,30 @@ use Friendica\BaseDataTransferObject;
|
||||||
*/
|
*/
|
||||||
class Preferences extends BaseDataTransferObject
|
class Preferences extends BaseDataTransferObject
|
||||||
{
|
{
|
||||||
// /** @var string (Enumerable, oneOf) */
|
/**
|
||||||
// protected $posting_default_visibility;
|
* @var string (Enumerable, oneOf)
|
||||||
// /** @var bool */
|
*/
|
||||||
// protected $posting_default_sensitive;
|
private $visibility;
|
||||||
// /** @var string (ISO 639-1 language two-letter code), or null*/
|
|
||||||
// protected $posting_default_language;
|
/**
|
||||||
// /** @var string (Enumerable, oneOf) */
|
* @var bool
|
||||||
// protected $reading_expand_media;
|
*/
|
||||||
// /** @var bool */
|
private $sensitive;
|
||||||
// protected $reading_expand_spoilers;
|
|
||||||
|
/**
|
||||||
|
* @var string (ISO 639-1 language two-letter code), or null
|
||||||
|
*/
|
||||||
|
private $language;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string (Enumerable, oneOf)
|
||||||
|
*/
|
||||||
|
private $media;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
private $spoilers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a preferences record.
|
* Creates a preferences record.
|
||||||
|
@ -39,10 +53,26 @@ class Preferences extends BaseDataTransferObject
|
||||||
*/
|
*/
|
||||||
public function __construct(string $visibility, bool $sensitive, string $language, string $media, bool $spoilers)
|
public function __construct(string $visibility, bool $sensitive, string $language, string $media, bool $spoilers)
|
||||||
{
|
{
|
||||||
$this->{'posting:default:visibility'} = $visibility;
|
$this->visibility = $visibility;
|
||||||
$this->{'posting:default:sensitive'} = $sensitive;
|
$this->sensitive = $sensitive;
|
||||||
$this->{'posting:default:language'} = $language;
|
$this->language = $language;
|
||||||
$this->{'reading:expand:media'} = $media;
|
$this->media = $media;
|
||||||
$this->{'reading:expand:spoilers'} = $spoilers;
|
$this->spoilers = $spoilers;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the current entity as an array
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function toArray(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'posting:default:visibility' => $this->visibility,
|
||||||
|
'posting:default:sensitive' => $this->sensitive,
|
||||||
|
'posting:default:language' => $this->language,
|
||||||
|
'reading:expand:media' => $this->media,
|
||||||
|
'reading:expand:spoilers' => $this->spoilers,
|
||||||
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue