]> git.mxchange.org Git - friendica.git/blob - src/Object/Api/Mastodon/Emoji.php
Add custom emojis Mastodon API endpoint
[friendica.git] / src / Object / Api / Mastodon / Emoji.php
1 <?php
2
3 namespace Friendica\Object\Api\Mastodon;
4
5 use Friendica\BaseEntity;
6
7 /**
8  * Class Emoji
9  *
10  * @see https://docs.joinmastodon.org/entities/emoji/
11  */
12 class Emoji extends BaseEntity
13 {
14         //Required attributes
15         /** @var string */
16         protected $shortcode;
17         /** @var string (URL)*/
18         protected $static_url;
19         /** @var string (URL)*/
20         protected $url;
21         /**
22          * Unsupported
23          * @var bool
24          */
25         protected $visible_in_picker = true;
26
27         // Optional attributes
28         /**
29          * Unsupported
30          * @var string
31          */
32         //protected $category;
33
34         public function __construct(string $shortcode, string $url)
35         {
36                 $this->shortcode = $shortcode;
37                 $this->url = $url;
38                 $this->static_url = $url;
39         }
40
41         /**
42          * @param Emoji  $prototype
43          * @param string $shortcode
44          * @param string $url
45          * @return Emoji
46          */
47         public static function createFromPrototype(Emoji $prototype, string $shortcode, string $url)
48         {
49                 $emoji = clone $prototype;
50                 $emoji->shortcode = $shortcode;
51                 $emoji->url = $url;
52                 $emoji->static_url = $url;
53
54                 return $emoji;
55         }
56 }