diff --git a/src/Model/Attach.php b/src/Model/Attach.php index bd78fcd80e..1fe619f79a 100644 --- a/src/Model/Attach.php +++ b/src/Model/Attach.php @@ -12,11 +12,11 @@ use Friendica\Database\DBA; use Friendica\DI; use Friendica\Core\Storage\Exception\InvalidClassStorageException; use Friendica\Core\Storage\Exception\ReferenceStorageException; +use Friendica\Network\HTTPException\InternalServerErrorException; use Friendica\Object\Image; use Friendica\Util\DateTimeFormat; use Friendica\Util\Mimetype; use Friendica\Security\Security; -use Friendica\Util\Network; /** * Class to handle attach database table @@ -183,7 +183,7 @@ class Attach * @param string $deny_gid Permissions, denied circle. optional, default = '' * * @return boolean|integer Row id on success, False on errors - * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws InternalServerErrorException */ public static function store(string $data, int $uid, string $filename, string $filetype = '', int $filesize = null, string $allow_cid = '', string $allow_gid = '', string $deny_cid = '', string $deny_gid = '') { @@ -237,7 +237,7 @@ class Attach * @param string $deny_cid * @param string $deny_gid * @return boolean|int Insert id or false on failure - * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws InternalServerErrorException */ public static function storeFile(string $src, int $uid, string $filename = '', string $filetype = '', string $allow_cid = '', string $allow_gid = '', string $deny_cid = '', string $deny_gid = '') { @@ -257,11 +257,11 @@ class Attach * @param array $fields Contains the fields that are updated * @param array $conditions Condition array with the key values * @param Image $img Image data to update. Optional, default null. - * @param array|boolean $old_fields Array with the old field values that are about to be replaced (true = update on duplicate) + * @param array $old_fields Array with the old field values that are about to be replaced (true = update on duplicate) * * @return boolean Was the update successful? * - * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws InternalServerErrorException * @see \Friendica\Database\DBA::update */ public static function update(array $fields, array $conditions, Image $img = null, array $old_fields = []): bool @@ -287,12 +287,10 @@ class Attach return DBA::update('attach', $fields, $conditions, $old_fields); } - /** * Delete info from table and data from storage * * @param array $conditions Field condition(s) - * @param array $options Options array, Optional * * @return boolean * diff --git a/src/Model/Contact.php b/src/Model/Contact.php index e007afc2d8..1c3186cf7e 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -7,10 +7,10 @@ namespace Friendica\Model; +use Exception; use Friendica\Contact\Avatar; use Friendica\Contact\Header; use Friendica\Contact\Introduction\Exception\IntroductionNotFoundException; -use Friendica\Contact\LocalRelationship\Entity\LocalRelationship; use Friendica\Content\Conversation as ConversationContent; use Friendica\Content\Pager; use Friendica\Content\Text\HTML; @@ -25,7 +25,8 @@ use Friendica\Database\DBA; use Friendica\DI; use Friendica\Network\HTTPClient\Client\HttpClientAccept; use Friendica\Network\HTTPClient\Client\HttpClientOptions; -use Friendica\Network\HTTPException; +use Friendica\Network\HTTPException\NotFoundException; +use Friendica\Network\HTTPException\InternalServerErrorException; use Friendica\Network\Probe; use Friendica\Object\Image; use Friendica\Protocol\Activity; @@ -104,7 +105,7 @@ class Contact * @param array $condition Array of fields for condition * @param array $params Array of several parameters * @return array - * @throws \Exception + * @throws Exception */ public static function selectToArray(array $fields = [], array $condition = [], array $params = []): array { @@ -116,7 +117,7 @@ class Contact * @param array $condition Array of fields for condition * @param array $params Array of several parameters * @return array|bool - * @throws \Exception + * @throws Exception */ public static function selectFirst(array $fields = [], array $condition = [], array $params = []) { @@ -130,7 +131,7 @@ class Contact * @param array $condition Array of fields for condition * @param array $params Array of several parameters * @return array - * @throws \Exception + * @throws Exception */ public static function selectAccountToArray(array $fields = [], array $condition = [], array $params = []): array { @@ -142,7 +143,7 @@ class Contact * @param array $condition Array of fields for condition * @param array $params Array of several parameters * @return array|bool - * @throws \Exception + * @throws Exception */ public static function selectFirstAccount(array $fields = [], array $condition = [], array $params = []) { @@ -162,7 +163,7 @@ class Contact * @param int $duplicate_mode Do an update on a duplicate entry * * @return int id of the created contact - * @throws \Exception + * @throws Exception */ public static function insert(array $fields, int $duplicate_mode = Database::INSERT_DEFAULT): int { @@ -233,7 +234,7 @@ class Contact * @param array|boolean $old_fields array with the old field values that are about to be replaced (true = update on duplicate, false = don't update identical fields) * * @return boolean was the update successful? - * @throws \Exception + * @throws Exception * @todo Let's get rid of boolean type of $old_fields */ public static function update(array $fields, array $condition, $old_fields = []): bool @@ -249,7 +250,7 @@ class Contact * @param integer $id Contact ID * @param array $fields Array of selected fields, empty for all * @return array|boolean Contact record if it exists, false otherwise - * @throws \Exception + * @throws Exception */ public static function getAccountById(int $id, array $fields = []) { @@ -260,7 +261,7 @@ class Contact * @param integer $id Contact ID * @param array $fields Array of selected fields, empty for all * @return array|boolean Contact record if it exists, false otherwise - * @throws \Exception + * @throws Exception */ public static function getById(int $id, array $fields = []) { @@ -273,7 +274,7 @@ class Contact * @param integer $uri_id uri-id of the contact * @param array $fields Array of selected fields, empty for all * @return array|boolean Contact record if it exists, false otherwise - * @throws \Exception + * @throws Exception */ public static function getByUriId(int $uri_id, array $fields = []) { @@ -288,7 +289,7 @@ class Contact * * @return array all remote contacts * - * @throws \Exception + * @throws Exception */ public static function getVisitorByUrl(string $url, array $fields = ['id', 'uid']): array { @@ -432,7 +433,7 @@ class Contact * @param bool $strict If "true" then contact mustn't be set to pending or readonly * * @return boolean is the contact id a follower? - * @throws HTTPException\InternalServerErrorException + * @throws InternalServerErrorException * @throws \ImagickException */ public static function isFollower(int $cid, int $uid, bool $strict = false): bool @@ -461,7 +462,7 @@ class Contact * @param bool $strict If "true" then contact mustn't be set to pending or readonly * * @return boolean is the contact id a follower? - * @throws HTTPException\InternalServerErrorException + * @throws InternalServerErrorException * @throws \ImagickException */ public static function isFollowerByURL(string $url, int $uid, bool $strict = false): bool @@ -483,7 +484,7 @@ class Contact * @param bool $strict If "true" then contact mustn't be set to pending or readonly * * @return boolean is the contact sharing with given user? - * @throws HTTPException\InternalServerErrorException + * @throws InternalServerErrorException * @throws \ImagickException */ public static function isSharing(int $cid, int $uid, bool $strict = false): bool @@ -512,7 +513,7 @@ class Contact * @param bool $strict If "true" then contact mustn't be set to pending or readonly * * @return boolean is the contact url being followed? - * @throws HTTPException\InternalServerErrorException + * @throws InternalServerErrorException * @throws \ImagickException */ public static function isSharingByURL(string $url, int $uid, bool $strict = false): bool @@ -544,7 +545,7 @@ class Contact * @param boolean $dont_update Don't update the contact * * @return string basepath - * @throws HTTPException\InternalServerErrorException + * @throws InternalServerErrorException * @throws \ImagickException */ public static function getBasepath(string $url, bool $dont_update = false): string @@ -594,7 +595,7 @@ class Contact /** * Check if the given contact ID is on the same server * - * @param string $url The contact link + * @param int $cid The contact link * @return boolean Is it the same server? */ public static function isLocalById(int $cid): bool @@ -619,7 +620,7 @@ class Contact * @param integer $uid User ID * * @return integer|boolean Public contact id for given user id - * @throws \Exception + * @throws Exception */ public static function getPublicIdByUserId(int $uid) { @@ -634,7 +635,7 @@ class Contact * @param int $uid User ID * * @return array with public and user's contact id - * @throws HTTPException\InternalServerErrorException + * @throws InternalServerErrorException * @throws \ImagickException */ public static function getPublicAndUserContactID(int $cid, int $uid): array @@ -700,7 +701,7 @@ class Contact * @param int $cid Either public contact id or user's contact id * @param int $uid User ID * @return array with public and user's contact id - * @throws HTTPException\InternalServerErrorException + * @throws InternalServerErrorException * @throws \ImagickException */ private static function legacyGetPublicAndUserContactID(int $cid, int $uid): array @@ -741,7 +742,7 @@ class Contact * @param array $fields The selected fields for the contact * @return array The contact details * - * @throws \Exception + * @throws Exception */ public static function getContactForUser(int $cid, int $uid, array $fields = []): array { @@ -759,7 +760,7 @@ class Contact * * @param int $uid * @return bool Operation success - * @throws HTTPException\InternalServerErrorException + * @throws InternalServerErrorException */ public static function createSelfFromUserId(int $uid): bool { @@ -822,7 +823,7 @@ class Contact * @param int $uid * @param bool $update_avatar Force the avatar update * @return bool "true" if updated - * @throws \Exception + * @throws Exception */ public static function updateSelfFromUserID(int $uid, bool $update_avatar = false): bool { @@ -943,7 +944,7 @@ class Contact * * @param int $id contact id * @return void - * @throws HTTPException\InternalServerErrorException + * @throws InternalServerErrorException */ public static function remove(int $id) { @@ -973,7 +974,7 @@ class Contact * * @param array $contact Target user-specific contact (uid != 0) array * @return void - * @throws HTTPException\InternalServerErrorException + * @throws InternalServerErrorException * @throws \ImagickException */ public static function unfollow(array $contact): void @@ -1003,7 +1004,7 @@ class Contact * * @param array $contact User-specific contact array (uid != 0) to revoke the follow from * @return void - * @throws HTTPException\InternalServerErrorException + * @throws InternalServerErrorException * @throws \ImagickException */ public static function revokeFollow(array $contact): void @@ -1031,7 +1032,7 @@ class Contact * * @param array $contact User-specific contact (uid != 0) array * @return void - * @throws HTTPException\InternalServerErrorException + * @throws InternalServerErrorException * @throws \ImagickException */ public static function terminateFriendship(array $contact) @@ -1078,7 +1079,7 @@ class Contact * * @param array $contact contact to mark for archival * @return void - * @throws HTTPException\InternalServerErrorException + * @throws InternalServerErrorException */ public static function markForArchival(array $contact) { @@ -1129,7 +1130,7 @@ class Contact * * @param array $contact contact to be unmarked for archival * @return void - * @throws \Exception + * @throws Exception */ public static function unmarkForArchival(array $contact) { @@ -1169,7 +1170,7 @@ class Contact * @param array $contact contact * @param int $uid Visitor user id * @return array - * @throws HTTPException\InternalServerErrorException + * @throws InternalServerErrorException * @throws \ImagickException */ public static function photoMenu(array $contact, int $uid): array @@ -1301,7 +1302,7 @@ class Contact * @param array $default Default value for creating the contact when everything else fails * * @return integer Contact ID - * @throws HTTPException\InternalServerErrorException + * @throws InternalServerErrorException * @throws \ImagickException */ public static function getIdForURL(string $url = null, int $uid = 0, $update = null, array $default = []): int @@ -1442,7 +1443,7 @@ class Contact if ($data['network'] == Protocol::DIASPORA) { try { DI::dsprContact()->updateFromProbeArray($data); - } catch (HTTPException\NotFoundException $e) { + } catch (NotFoundException $e) { Logger::notice($e->getMessage(), ['url' => $url, 'data' => $data]); } catch (\InvalidArgumentException $e) { Logger::notice($e->getMessage(), ['url' => $url, 'data' => $data]); @@ -1450,7 +1451,7 @@ class Contact } elseif (!empty($data['networks'][Protocol::DIASPORA])) { try { DI::dsprContact()->updateFromProbeArray($data['networks'][Protocol::DIASPORA]); - } catch (HTTPException\NotFoundException $e) { + } catch (NotFoundException $e) { Logger::notice($e->getMessage(), ['url' => $url, 'data' => $data['networks'][Protocol::DIASPORA]]); } catch (\InvalidArgumentException $e) { Logger::notice($e->getMessage(), ['url' => $url, 'data' => $data['networks'][Protocol::DIASPORA]]); @@ -1475,7 +1476,7 @@ class Contact * @param int $cid contact id * * @return boolean Is the contact archived? - * @throws HTTPException\InternalServerErrorException + * @throws InternalServerErrorException */ public static function isArchived(int $cid): bool { @@ -1518,7 +1519,7 @@ class Contact * * @param int $cid contact id * @return boolean Is the contact blocked? - * @throws HTTPException\InternalServerErrorException + * @throws InternalServerErrorException */ public static function isBlocked(int $cid): bool { @@ -1543,7 +1544,7 @@ class Contact * * @param int $cid contact id * @return boolean Is the contact hidden? - * @throws \Exception + * @throws Exception */ public static function isHidden(int $cid): bool { @@ -1566,7 +1567,7 @@ class Contact * @param bool $only_media Only display media content * @param string $last_created Newest creation date, used for paging * @return string posts in HTML - * @throws \Exception + * @throws Exception */ public static function getPostsFromUrl(string $contact_url, int $uid, bool $only_media = false, string $last_created = null): string { @@ -1581,7 +1582,7 @@ class Contact * @param bool $only_media Only display media content * @param string $last_created Newest creation date, used for paging * @return string posts in HTML - * @throws \Exception + * @throws Exception */ public static function getPostsFromId(int $cid, int $uid, bool $only_media = false, string $last_created = null): string { @@ -1653,7 +1654,7 @@ class Contact * @param int $update Update mode * @param int $parent Item parent ID for the update mode * @return string posts in HTML - * @throws \Exception + * @throws Exception */ public static function getThreadsFromId(int $cid, int $uid, int $update = 0, int $parent = 0, string $last_created = ''): string { @@ -2286,8 +2287,8 @@ class Contact * @param bool $create_cache Enforces the creation of cached avatar fields * * @return void - * @throws HTTPException\InternalServerErrorException - * @throws HTTPException\NotFoundException + * @throws InternalServerErrorException + * @throws NotFoundException * @throws \ImagickException */ public static function updateAvatar(int $cid, string $avatar, bool $force = false, bool $create_cache = false) @@ -2486,7 +2487,7 @@ class Contact * @param integer $id contact id * @param string $url The new URL to use for polling * - * @throws \Exception + * @throws Exception */ public static function updatePollUrl(int $id, string $url) { @@ -2502,7 +2503,7 @@ class Contact * @param string $url The profile URL of the contact * @param array $fields The fields that are updated * - * @throws \Exception + * @throws Exception */ private static function updateContact(int $id, int $uid, int $uri_id, string $url, array $fields) { @@ -2595,7 +2596,7 @@ class Contact * @param string $nurl Normalised contact url * @param integer $uid User id * @return boolean - * @throws \Exception + * @throws Exception */ public static function removeDuplicates(string $nurl, int $uid) { @@ -2673,7 +2674,7 @@ class Contact * @param integer $id contact id * @param string $network Optional network we are probing for * @return boolean - * @throws HTTPException\InternalServerErrorException + * @throws InternalServerErrorException * @throws \ImagickException */ public static function updateFromProbe(int $id, string $network = ''): bool @@ -2696,7 +2697,7 @@ class Contact if ($data['network'] == Protocol::DIASPORA) { try { DI::dsprContact()->updateFromProbeArray($data); - } catch (HTTPException\NotFoundException $e) { + } catch (NotFoundException $e) { Logger::notice($e->getMessage(), ['id' => $id, 'network' => $network, 'contact' => $contact, 'data' => $data]); } catch (\InvalidArgumentException $e) { Logger::notice($e->getMessage(), ['id' => $id, 'network' => $network, 'contact' => $contact, 'data' => $data]); @@ -2704,7 +2705,7 @@ class Contact } elseif (!empty($data['networks'][Protocol::DIASPORA])) { try { DI::dsprContact()->updateFromProbeArray($data['networks'][Protocol::DIASPORA]); - } catch (HTTPException\NotFoundException $e) { + } catch (NotFoundException $e) { Logger::notice($e->getMessage(), ['id' => $id, 'network' => $network, 'contact' => $contact, 'data' => $data]); } catch (\InvalidArgumentException $e) { Logger::notice($e->getMessage(), ['id' => $id, 'network' => $network, 'contact' => $contact, 'data' => $data]); @@ -2760,7 +2761,7 @@ class Contact * @param integer $id contact id * @param array $ret Probed data * @return boolean - * @throws HTTPException\InternalServerErrorException + * @throws InternalServerErrorException * @throws \ImagickException */ private static function updateFromProbeArray(int $id, array $ret): bool @@ -3012,9 +3013,9 @@ class Contact /** * Updates contact record by provided URL * - * @param integer $url contact url - * @return integer Contact id - * @throws HTTPException\InternalServerErrorException + * @param string $url contact url + * @return int Contact id + * @throws InternalServerErrorException * @throws \ImagickException */ public static function updateFromProbeByURL(string $url): int @@ -3069,8 +3070,8 @@ class Contact * @param string $url The profile URL of the contact * @param string $network * @return array - * @throws HTTPException\InternalServerErrorException - * @throws HTTPException\NotFoundException + * @throws InternalServerErrorException + * @throws NotFoundException * @throws \ImagickException */ public static function createFromProbeForUser(int $uid, string $url, string $network = ''): array @@ -3258,7 +3259,7 @@ class Contact * @param bool $sharing True: Contact is now sharing with Owner; False: Contact is now following Owner (default) * @param string $note Introduction additional message * @return bool|null True: follow request is accepted; False: relationship is rejected; Null: relationship is pending - * @throws HTTPException\InternalServerErrorException + * @throws InternalServerErrorException * @throws \ImagickException */ public static function addRelationship(array $importer, array $contact, array $datarray, bool $sharing = false, string $note = '') @@ -3415,7 +3416,7 @@ class Contact * @param array $contact User-specific contact (uid != 0) array * @param bool $delete Delete if set, otherwise set relation to "nothing" when contact had been a follower * @return void - * @throws HTTPException\InternalServerErrorException + * @throws InternalServerErrorException * @throws \ImagickException */ public static function removeFollower(array $contact, bool $delete = true) @@ -3449,7 +3450,7 @@ class Contact * * @param array $contact User-specific contact (uid != 0) array * @param bool $delete Delete if set, otherwise set relation to "nothing" when contact had been a sharer - * @throws HTTPException\InternalServerErrorException + * @throws InternalServerErrorException */ public static function removeSharer(array $contact, bool $delete = true) { @@ -3512,7 +3513,7 @@ class Contact * * @param array $contact_ids Contact id list * @return array - * @throws \Exception + * @throws Exception */ public static function pruneUnavailable(array $contact_ids): array { @@ -3554,7 +3555,7 @@ class Contact * @param string $url An url that we will be redirected to after the authentication * * @return string with "redir" link - * @throws HTTPException\InternalServerErrorException + * @throws InternalServerErrorException * @throws \ImagickException */ public static function magicLink(string $contact_url, string $url = ''): string @@ -3581,7 +3582,7 @@ class Contact * @param string $url An url that we will be redirected to after the authentication * * @return string with "redir" link - * @throws HTTPException\InternalServerErrorException + * @throws InternalServerErrorException * @throws \ImagickException */ public static function magicLinkById(int $cid, string $url = ''): string @@ -3605,7 +3606,7 @@ class Contact * @param string $url An url that we will be redirected to after the authentication * * @return string with "redir" link - * @throws HTTPException\InternalServerErrorException + * @throws InternalServerErrorException * @throws \ImagickException */ public static function magicLinkByContact(array $contact, string $url = ''): string @@ -3810,7 +3811,7 @@ class Contact * @param array $condition * * @return bool - * @throws \Exception + * @throws Exception */ public static function exists(array $condition): bool { diff --git a/src/Model/Contact/User.php b/src/Model/Contact/User.php index 66a3721193..8e0f033fe6 100644 --- a/src/Model/Contact/User.php +++ b/src/Model/Contact/User.php @@ -15,6 +15,7 @@ use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\Contact; use Friendica\Model\ItemURI; +use Friendica\Network\HTTPException\InternalServerErrorException; use PDOException; /** @@ -130,7 +131,7 @@ class User * @param boolean $blocked Is the contact blocked or unblocked? * @param boolean $only_set Only set the block flag, don't execute any block transmission * @return void - * @throws \Exception + * @throws Exception */ public static function setBlocked(int $cid, int $uid, bool $blocked, bool $only_set = false) { @@ -171,7 +172,7 @@ class User * @param int $uid User ID * * @return boolean is the contact id blocked for the given user? - * @throws \Exception + * @throws Exception */ public static function isBlocked(int $cid, int $uid): bool { @@ -212,7 +213,7 @@ class User * @param int $uid User ID * @param boolean $ignored Is the contact ignored or unignored? * @return void - * @throws \Exception + * @throws Exception */ public static function setIgnored(int $cid, int $uid, bool $ignored) { @@ -234,7 +235,7 @@ class User * @param int $cid Either public contact id or user's contact id * @param int $uid User ID * @return boolean is the contact id ignored for the given user? - * @throws \Exception + * @throws Exception */ public static function isIgnored(int $cid, int $uid): bool { @@ -275,7 +276,7 @@ class User * @param int $uid User ID * @param boolean $collapsed are the contact's posts collapsed or uncollapsed? * @return void - * @throws \Exception + * @throws Exception */ public static function setCollapsed(int $cid, int $uid, bool $collapsed) { @@ -293,7 +294,7 @@ class User * @param int $cid Either public contact id or user's contact id * @param int $uid User ID * @return boolean is the contact id blocked for the given user? - * @throws HTTPException\InternalServerErrorException + * @throws InternalServerErrorException * @throws \ImagickException */ public static function isCollapsed(int $cid, int $uid): bool @@ -314,7 +315,7 @@ class User * @param int $uid User ID * @param int $frequency Type of post frequency in channels * @return void - * @throws \Exception + * @throws Exception */ public static function setChannelFrequency(int $cid, int $uid, int $frequency) { @@ -332,7 +333,7 @@ class User * @param int $cid Either public contact id or user's contact id * @param int $uid User ID * @return int Type of post frequency in channels - * @throws HTTPException\InternalServerErrorException + * @throws InternalServerErrorException * @throws \ImagickException */ public static function getChannelFrequency(int $cid, int $uid): int @@ -349,11 +350,11 @@ class User /** * Set the channel only value for contact id and user id * - * @param int $cid Either public contact id or user's contact id - * @param int $uid User ID - * @param int $isChannelOnly Is channel only + * @param int $cid Either public contact id or user's contact id + * @param int $uid User ID + * @param bool $isChannelOnly Is channel only * @return void - * @throws \Exception + * @throws Exception */ public static function setChannelOnly(int $cid, int $uid, bool $isChannelOnly) { @@ -371,7 +372,7 @@ class User * @param int $cid Either public contact id or user's contact id * @param int $uid User ID * @return bool Contact is channel only - * @throws HTTPException\InternalServerErrorException + * @throws InternalServerErrorException * @throws \ImagickException */ public static function getChannelOnly(int $cid, int $uid): bool @@ -392,7 +393,7 @@ class User * @param int $uid User ID * @param boolean $blocked Is the user blocked or unblocked by the contact? * @return void - * @throws \Exception + * @throws Exception */ public static function setIsBlocked(int $cid, int $uid, bool $blocked) { @@ -410,7 +411,7 @@ class User * @param int $cid Either public contact id or user's contact id * @param int $uid User ID * @return boolean Is the user blocked or unblocked by the contact? - * @throws \Exception + * @throws Exception */ public static function isIsBlocked(int $cid, int $uid): bool { diff --git a/src/Model/Event.php b/src/Model/Event.php index 210f601691..f98c8cdd0c 100644 --- a/src/Model/Event.php +++ b/src/Model/Event.php @@ -15,7 +15,9 @@ use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\DI; -use Friendica\Network\HTTPException; +use Friendica\Network\HTTPException\InternalServerErrorException; +use Friendica\Network\HTTPException\NotFoundException; +use Friendica\Network\HTTPException\UnauthorizedException; use Friendica\Protocol\Activity; use Friendica\Util\DateTimeFormat; use Friendica\Util\Map; @@ -487,23 +489,23 @@ class Event * @param string $nickname * * @return array the owner array - * @throws HTTPException\InternalServerErrorException - * @throws HTTPException\NotFoundException The given nickname does not exist - * @throws HTTPException\UnauthorizedException The access for the given nickname is restricted + * @throws InternalServerErrorException + * @throws NotFoundException The given nickname does not exist + * @throws UnauthorizedException The access for the given nickname is restricted */ public static function getOwnerForNickname(string $nickname): array { $owner = User::getOwnerDataByNick($nickname); if (empty($owner) || $owner['account_removed'] || $owner['account_expired']) { - throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.')); + throw new NotFoundException(DI::l10n()->t('User not found.')); } if (!DI::userSession()->isAuthenticated() && $owner['hidewall']) { - throw new HTTPException\UnauthorizedException(DI::l10n()->t('Access to this profile has been restricted.')); + throw new UnauthorizedException(DI::l10n()->t('Access to this profile has been restricted.')); } if (!DI::userSession()->isAuthenticated() && !Feature::isEnabled($owner['uid'], Feature::PUBLIC_CALENDAR)) { - throw new HTTPException\UnauthorizedException(DI::l10n()->t('Permission denied.')); + throw new UnauthorizedException(DI::l10n()->t('Permission denied.')); } return $owner; @@ -514,7 +516,6 @@ class Event * * @param int $owner_uid The User ID of the owner of the event * @param int $event_id The ID of the event in the event table - * @param string|null $nickname a possible nickname to search for instead of the owner uid * @return array Query result * @throws \Exception */ @@ -541,7 +542,7 @@ class Event $owner_uid )); if (empty($events)) { - throw new HTTPException\NotFoundException(DI::l10n()->t('Event not found.')); + throw new NotFoundException(DI::l10n()->t('Event not found.')); } return $events[0]; @@ -556,8 +557,8 @@ class Event * @param bool|null $ignore Filters ignored events (false: unignored events, true: ignored events, null: all events) * * @return array Query results. - * @throws HTTPException\NotFoundException - * @throws HTTPException\UnauthorizedException + * @throws NotFoundException + * @throws UnauthorizedException */ public static function getListByDate(int $owner_uid, string $start = null, string $finish = null, ?bool $ignore = false): array { diff --git a/src/Model/GServer.php b/src/Model/GServer.php index 5e8cd33310..c458e379b4 100644 --- a/src/Model/GServer.php +++ b/src/Model/GServer.php @@ -163,9 +163,6 @@ class GServer /** * Checks if the given server array is unreachable for a long time now - * - * @param integer $gsid - * @return boolean */ private static function isDefunct(array $gserver): bool { @@ -506,7 +503,7 @@ class GServer * * @param UriInterface $dirtyUri * - * @return UriInterface cleaned URI + * @return string cleaned URI * @throws Exception */ public static function cleanUri(UriInterface $dirtyUri): string @@ -1349,8 +1346,6 @@ class GServer * * @see https://github.com/jaywink/nodeinfo2 * - * @param string $nodeinfo_url address of the nodeinfo path - * * @return array Server data * * @throws \Friendica\Network\HTTPException\InternalServerErrorException @@ -1539,7 +1534,6 @@ class GServer /** * Fetches server data via an ActivityPub account with url of that server * - * @param string $url URL of the given server * @param array $serverdata array with server data * * @return array server data diff --git a/src/Model/Item.php b/src/Model/Item.php index b42f89729a..7a62c3677d 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -445,7 +445,7 @@ class Item * Get guid from given item record * * @param array $item Item record - * @param bool Whether to notify (?) + * @param bool $notify Whether to notify (?) * @return string Guid */ public static function guid(array $item, bool $notify): string @@ -2123,7 +2123,6 @@ class Item * * @param array $item * @return string detected language - * @throws \Text_LanguageDetect_Exception */ private static function getLanguage(array $item): ?string { @@ -3571,7 +3570,7 @@ class Item } $xpath = new \DOMXPath($dom); - /** @var DOMElement $element */ + /** @var \DOMElement $element */ foreach ($xpath->query("//img[@class='network-svg']") as $element) { $src = $element->getAttributeNode('src')->nodeValue; if ($src == $svg) {