]> git.mxchange.org Git - friendica.git/blob - src/BaseEntity.php
Move Notify::TYPE_MAIL
[friendica.git] / src / BaseEntity.php
1 <?php
2
3 namespace Friendica;
4
5 /**
6  * The API entity classes are meant as data transfer objects. As such, their member should be protected.
7  * Then the JsonSerializable interface ensures the protected members will be included in a JSON encode situation.
8  *
9  * Constructors are supposed to take as arguments the Friendica dependencies/model/collection/data it needs to
10  * populate the class members.
11  */
12 abstract class BaseEntity implements \JsonSerializable
13 {
14         /**
15          * Returns the current entity as an json array
16          *
17          * @return array
18          */
19         public function jsonSerialize()
20         {
21                 return $this->toArray();
22         }
23
24         /**
25          * Returns the current entity as an array
26          *
27          * @return array
28          */
29         public function toArray()
30         {
31                 return get_object_vars($this);
32         }
33 }