From 0de8e4db080b5739d77d6394eb5c2904e5d1b66f Mon Sep 17 00:00:00 2001 From: Hypolite Petovan <hypolite@mrpetovan.com> Date: Mon, 27 Jan 2020 20:01:32 -0500 Subject: [PATCH] Move Mastodon API entities to src/Object --- src/{Api => }/BaseEntity.php | 2 +- src/Factory/Mastodon/Account.php | 4 ++-- src/Factory/Mastodon/FollowRequest.php | 4 ++-- src/Factory/Mastodon/Relationship.php | 2 +- src/Module/Api/Mastodon/FollowRequests.php | 4 ++-- src/Module/Api/Mastodon/Instance.php | 2 +- src/{Api/Entity => Object/Api}/Mastodon/Account.php | 4 ++-- src/{Api/Entity => Object/Api}/Mastodon/Emoji.php | 8 ++++---- src/{Api/Entity => Object/Api}/Mastodon/Field.php | 4 ++-- src/{Api/Entity => Object/Api}/Mastodon/FollowRequest.php | 3 +-- src/{Api/Entity => Object/Api}/Mastodon/Instance.php | 4 ++-- src/{Api/Entity => Object/Api}/Mastodon/Relationship.php | 4 ++-- src/{Api/Entity => Object/Api}/Mastodon/Stats.php | 4 ++-- 13 files changed, 24 insertions(+), 25 deletions(-) rename src/{Api => }/BaseEntity.php (95%) rename src/{Api/Entity => Object/Api}/Mastodon/Account.php (98%) rename src/{Api/Entity => Object/Api}/Mastodon/Emoji.php (68%) rename src/{Api/Entity => Object/Api}/Mastodon/Field.php (78%) rename src/{Api/Entity => Object/Api}/Mastodon/FollowRequest.php (93%) rename src/{Api/Entity => Object/Api}/Mastodon/Instance.php (97%) rename src/{Api/Entity => Object/Api}/Mastodon/Relationship.php (95%) rename src/{Api/Entity => Object/Api}/Mastodon/Stats.php (93%) diff --git a/src/Api/BaseEntity.php b/src/BaseEntity.php similarity index 95% rename from src/Api/BaseEntity.php rename to src/BaseEntity.php index 4bc15943df..9f0cb31f8e 100644 --- a/src/Api/BaseEntity.php +++ b/src/BaseEntity.php @@ -1,6 +1,6 @@ <?php -namespace Friendica\Api; +namespace Friendica; /** * The API entity classes are meant as data transfer objects. As such, their member should be protected. diff --git a/src/Factory/Mastodon/Account.php b/src/Factory/Mastodon/Account.php index e38654b295..e777e76fe9 100644 --- a/src/Factory/Mastodon/Account.php +++ b/src/Factory/Mastodon/Account.php @@ -24,7 +24,7 @@ class Account extends BaseFactory /** * @param int $contactId * @param int $uid User Id - * @return \Friendica\Api\Entity\Mastodon\Account + * @return \Friendica\Object\Api\Mastodon\Account * @throws HTTPException\InternalServerErrorException * @throws \ImagickException */ @@ -41,6 +41,6 @@ class Account extends BaseFactory $apcontact = APContact::getByURL($publicContact['url'], false); - return new \Friendica\Api\Entity\Mastodon\Account($this->baseUrl, $publicContact, $apcontact, $userContact); + return new \Friendica\Object\Api\Mastodon\Account($this->baseUrl, $publicContact, $apcontact, $userContact); } } diff --git a/src/Factory/Mastodon/FollowRequest.php b/src/Factory/Mastodon/FollowRequest.php index bbaa3135c9..3aabe413d6 100644 --- a/src/Factory/Mastodon/FollowRequest.php +++ b/src/Factory/Mastodon/FollowRequest.php @@ -24,7 +24,7 @@ class FollowRequest extends BaseFactory /** * @param Introduction $introduction - * @return \Friendica\Api\Entity\Mastodon\FollowRequest + * @return \Friendica\Object\Api\Mastodon\FollowRequest * @throws HTTPException\InternalServerErrorException * @throws \ImagickException */ @@ -42,6 +42,6 @@ class FollowRequest extends BaseFactory $apcontact = APContact::getByURL($publicContact['url'], false); - return new \Friendica\Api\Entity\Mastodon\FollowRequest($this->baseUrl, $introduction->id, $publicContact, $apcontact, $userContact); + return new \Friendica\Object\Api\Mastodon\FollowRequest($this->baseUrl, $introduction->id, $publicContact, $apcontact, $userContact); } } diff --git a/src/Factory/Mastodon/Relationship.php b/src/Factory/Mastodon/Relationship.php index 25c9d4c8ce..7a8b216d4e 100644 --- a/src/Factory/Mastodon/Relationship.php +++ b/src/Factory/Mastodon/Relationship.php @@ -2,7 +2,7 @@ namespace Friendica\Factory\Mastodon; -use Friendica\Api\Entity\Mastodon\Relationship as RelationshipEntity; +use Friendica\Object\Api\Mastodon\Relationship as RelationshipEntity; use Friendica\BaseFactory; use Friendica\Model\Contact; diff --git a/src/Module/Api/Mastodon/FollowRequests.php b/src/Module/Api/Mastodon/FollowRequests.php index fc384f7979..79fe487834 100644 --- a/src/Module/Api/Mastodon/FollowRequests.php +++ b/src/Module/Api/Mastodon/FollowRequests.php @@ -2,8 +2,8 @@ namespace Friendica\Module\Api\Mastodon; -use Friendica\Api\Entity\Mastodon; -use Friendica\Api\Entity\Mastodon\Relationship; +use Friendica\Object\Api\Mastodon; +use Friendica\Object\Api\Mastodon\Relationship; use Friendica\Core\System; use Friendica\DI; use Friendica\Model\Contact; diff --git a/src/Module/Api/Mastodon/Instance.php b/src/Module/Api/Mastodon/Instance.php index cc7639f460..c3d1b93ac0 100644 --- a/src/Module/Api/Mastodon/Instance.php +++ b/src/Module/Api/Mastodon/Instance.php @@ -2,7 +2,7 @@ namespace Friendica\Module\Api\Mastodon; -use Friendica\Api\Entity\Mastodon\Instance as InstanceEntity; +use Friendica\Object\Api\Mastodon\Instance as InstanceEntity; use Friendica\Core\System; use Friendica\Module\Base\Api; diff --git a/src/Api/Entity/Mastodon/Account.php b/src/Object/Api/Mastodon/Account.php similarity index 98% rename from src/Api/Entity/Mastodon/Account.php rename to src/Object/Api/Mastodon/Account.php index 8123cf595c..38eefee3df 100644 --- a/src/Api/Entity/Mastodon/Account.php +++ b/src/Object/Api/Mastodon/Account.php @@ -1,9 +1,9 @@ <?php -namespace Friendica\Api\Entity\Mastodon; +namespace Friendica\Object\Api\Mastodon; -use Friendica\Api\BaseEntity; use Friendica\App\BaseURL; +use Friendica\BaseEntity; use Friendica\Content\Text\BBCode; use Friendica\Database\DBA; use Friendica\Model\Contact; diff --git a/src/Api/Entity/Mastodon/Emoji.php b/src/Object/Api/Mastodon/Emoji.php similarity index 68% rename from src/Api/Entity/Mastodon/Emoji.php rename to src/Object/Api/Mastodon/Emoji.php index f3dbfa5e7d..725a72a68c 100644 --- a/src/Api/Entity/Mastodon/Emoji.php +++ b/src/Object/Api/Mastodon/Emoji.php @@ -1,8 +1,8 @@ <?php -namespace Friendica\Api\Entity\Mastodon; +namespace Friendica\Object\Api\Mastodon; -use Friendica\Api\BaseEntity; +use Friendica\BaseEntity; /** * Class Emoji @@ -13,9 +13,9 @@ class Emoji extends BaseEntity { /** @var string */ protected $shortcode; - /** @var string (URL)*/ + /** @var string (URL) */ protected $static_url; - /** @var string (URL)*/ + /** @var string (URL) */ protected $url; /** @var bool */ protected $visible_in_picker; diff --git a/src/Api/Entity/Mastodon/Field.php b/src/Object/Api/Mastodon/Field.php similarity index 78% rename from src/Api/Entity/Mastodon/Field.php rename to src/Object/Api/Mastodon/Field.php index f01128ad41..07cd2e501b 100644 --- a/src/Api/Entity/Mastodon/Field.php +++ b/src/Object/Api/Mastodon/Field.php @@ -1,8 +1,8 @@ <?php -namespace Friendica\Api\Entity\Mastodon; +namespace Friendica\Object\Api\Mastodon; -use Friendica\Api\BaseEntity; +use Friendica\BaseEntity; /** * Class Field diff --git a/src/Api/Entity/Mastodon/FollowRequest.php b/src/Object/Api/Mastodon/FollowRequest.php similarity index 93% rename from src/Api/Entity/Mastodon/FollowRequest.php rename to src/Object/Api/Mastodon/FollowRequest.php index a677a69626..ed72f07d54 100644 --- a/src/Api/Entity/Mastodon/FollowRequest.php +++ b/src/Object/Api/Mastodon/FollowRequest.php @@ -1,9 +1,8 @@ <?php -namespace Friendica\Api\Entity\Mastodon; +namespace Friendica\Object\Api\Mastodon; use Friendica\App\BaseURL; -use Friendica\Model\Introduction; /** * Virtual entity to separate Accounts from Follow Requests. diff --git a/src/Api/Entity/Mastodon/Instance.php b/src/Object/Api/Mastodon/Instance.php similarity index 97% rename from src/Api/Entity/Mastodon/Instance.php rename to src/Object/Api/Mastodon/Instance.php index b122f78359..63c8b2824f 100644 --- a/src/Api/Entity/Mastodon/Instance.php +++ b/src/Object/Api/Mastodon/Instance.php @@ -1,8 +1,8 @@ <?php -namespace Friendica\Api\Entity\Mastodon; +namespace Friendica\Object\Api\Mastodon; -use Friendica\Api\BaseEntity; +use Friendica\BaseEntity; use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\User; diff --git a/src/Api/Entity/Mastodon/Relationship.php b/src/Object/Api/Mastodon/Relationship.php similarity index 95% rename from src/Api/Entity/Mastodon/Relationship.php rename to src/Object/Api/Mastodon/Relationship.php index 44a7d70c40..146ad212b4 100644 --- a/src/Api/Entity/Mastodon/Relationship.php +++ b/src/Object/Api/Mastodon/Relationship.php @@ -1,8 +1,8 @@ <?php -namespace Friendica\Api\Entity\Mastodon; +namespace Friendica\Object\Api\Mastodon; -use Friendica\Api\BaseEntity; +use Friendica\BaseEntity; use Friendica\Model\Contact; use Friendica\Util\Network; diff --git a/src/Api/Entity/Mastodon/Stats.php b/src/Object/Api/Mastodon/Stats.php similarity index 93% rename from src/Api/Entity/Mastodon/Stats.php rename to src/Object/Api/Mastodon/Stats.php index 16c9893a3b..24e263685f 100644 --- a/src/Api/Entity/Mastodon/Stats.php +++ b/src/Object/Api/Mastodon/Stats.php @@ -1,8 +1,8 @@ <?php -namespace Friendica\Api\Entity\Mastodon; +namespace Friendica\Object\Api\Mastodon; -use Friendica\Api\BaseEntity; +use Friendica\BaseEntity; use Friendica\Core\Protocol; use Friendica\Database\DBA; use Friendica\DI; -- 2.39.5