mirror of
https://github.com/friendica/friendica
synced 2024-12-22 22:40:16 +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
|
||||
{
|
||||
// /** @var string (Enumerable, oneOf) */
|
||||
// protected $posting_default_visibility;
|
||||
// /** @var bool */
|
||||
// protected $posting_default_sensitive;
|
||||
// /** @var string (ISO 639-1 language two-letter code), or null*/
|
||||
// protected $posting_default_language;
|
||||
// /** @var string (Enumerable, oneOf) */
|
||||
// protected $reading_expand_media;
|
||||
// /** @var bool */
|
||||
// protected $reading_expand_spoilers;
|
||||
/**
|
||||
* @var string (Enumerable, oneOf)
|
||||
*/
|
||||
private $visibility;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $sensitive;
|
||||
|
||||
/**
|
||||
* @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.
|
||||
|
@ -39,10 +53,26 @@ class Preferences extends BaseDataTransferObject
|
|||
*/
|
||||
public function __construct(string $visibility, bool $sensitive, string $language, string $media, bool $spoilers)
|
||||
{
|
||||
$this->{'posting:default:visibility'} = $visibility;
|
||||
$this->{'posting:default:sensitive'} = $sensitive;
|
||||
$this->{'posting:default:language'} = $language;
|
||||
$this->{'reading:expand:media'} = $media;
|
||||
$this->{'reading:expand:spoilers'} = $spoilers;
|
||||
$this->visibility = $visibility;
|
||||
$this->sensitive = $sensitive;
|
||||
$this->language = $language;
|
||||
$this->media = $media;
|
||||
$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