From af9067a381430b520a155bd3803a338d44cfaace Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 7 Jan 2019 01:07:42 -0500 Subject: [PATCH] Update PHPDoc in mod/ --- mod/admin.php | 42 ++++++++++++++++++-- mod/dfrn_request.php | 3 ++ mod/fbrowser.php | 2 + mod/hovercard.php | 3 +- mod/item.php | 17 ++++---- mod/match.php | 3 ++ mod/network.php | 38 ++++++++++++------ mod/parse_url.php | 16 ++++---- mod/ping.php | 50 ++++++++++++------------ mod/receive.php | 4 +- mod/smilies.php | 3 +- mod/tagrm.php | 2 + mod/view.php | 3 +- src/Core/PConfig.php | 2 +- src/Core/Renderer.php | 2 +- src/Model/GContact.php | 2 +- src/Object/Image.php | 4 +- src/Protocol/ActivityPub/Transmitter.php | 7 ++-- 18 files changed, 134 insertions(+), 69 deletions(-) diff --git a/mod/admin.php b/mod/admin.php index 17e58940ea..e5df09d0ea 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -62,7 +62,8 @@ function admin_init(App $a) * return the HTML for the pages of the admin panel. * * @param App $a - * + * @throws ImagickException + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ function admin_post(App $a) { @@ -161,6 +162,7 @@ function admin_post(App $a) * * @param App $a * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ function admin_content(App $a) { @@ -312,6 +314,7 @@ function admin_content(App $a) * * @param App $a * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ function admin_page_tos(App $a) { @@ -334,6 +337,7 @@ function admin_page_tos(App $a) * @brief Process send data from Admin TOS Page * * @param App $a + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ function admin_page_tos_post(App $a) { @@ -366,6 +370,7 @@ function admin_page_tos_post(App $a) * * @param App $a * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ function admin_page_blocklist(App $a) { @@ -406,6 +411,7 @@ function admin_page_blocklist(App $a) * @brief Process send data from Admin Blocklist Page * * @param App $a + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ function admin_page_blocklist_post(App $a) { @@ -450,6 +456,8 @@ function admin_page_blocklist_post(App $a) * @brief Process data send by the contact block admin page * * @param App $a + * @throws ImagickException + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ function admin_page_contactblock_post(App $a) { @@ -482,6 +490,7 @@ function admin_page_contactblock_post(App $a) * * @param App $a * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ function admin_page_contactblock(App $a) { @@ -534,6 +543,7 @@ function admin_page_contactblock(App $a) * * @param App $a * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ function admin_page_deleteitem(App $a) { @@ -558,6 +568,7 @@ function admin_page_deleteitem(App $a) * URLs like the full /display URL to make the process more easy for the admin. * * @param App $a + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ function admin_page_deleteitem_post(App $a) { @@ -597,6 +608,7 @@ function admin_page_deleteitem_post(App $a) * * @param App $a * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ function admin_page_federation(App $a) { @@ -783,6 +795,7 @@ function admin_page_federation(App $a) * * @param App $a * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ function admin_page_queue(App $a) { @@ -825,7 +838,9 @@ function admin_page_queue(App $a) * The returned string holds the content of the page. * * @param App $a + * @param $deferred * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ function admin_page_workerqueue(App $a, $deferred) { @@ -875,6 +890,7 @@ function admin_page_workerqueue(App $a, $deferred) * * @param App $a * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ function admin_page_summary(App $a) { @@ -993,6 +1009,7 @@ function admin_page_summary(App $a) * @brief Process send data from Admin Site Page * * @param App $a + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ function admin_page_site_post(App $a) { @@ -1170,10 +1187,13 @@ function admin_page_site_post(App $a) $relay_server_tags = (!empty($_POST['relay_server_tags']) ? Strings::escapeTags(trim($_POST['relay_server_tags'])) : ''); $relay_user_tags = !empty($_POST['relay_user_tags']); $active_panel = (!empty($_POST['active_panel']) ? "#" . Strings::escapeTags(trim($_POST['active_panel'])) : ''); - + + /** + * @var $storagebackend \Friendica\Model\Storage\IStorage + */ $storagebackend = Strings::escapeTags(trim(defaults($_POST, 'storagebackend', ''))); StorageManager::setBackend($storagebackend); - + // save storage backend form if (!is_null($storagebackend) && $storagebackend != "") { $storage_opts = $storagebackend::getOptions(); @@ -1397,6 +1417,7 @@ function admin_page_site_post(App $a) * * @param App $a * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ function admin_page_site(App $a) { @@ -1518,6 +1539,9 @@ function admin_page_site(App $a) /* storage backend */ $storage_backends = StorageManager::listBackends(); + /** + * @var $storage_current_backend \Friendica\Model\Storage\IStorage + */ $storage_current_backend = StorageManager::getBackend(); $storage_backends_choices = [ @@ -1677,7 +1701,8 @@ function admin_page_site(App $a) * * @param App $a * @return string - * */ + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + */ function admin_page_dbsync(App $a) { $o = ''; @@ -1767,6 +1792,7 @@ function admin_page_dbsync(App $a) * @brief Process data send by Users admin page * * @param App $a + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ function admin_page_users_post(App $a) { @@ -1884,6 +1910,7 @@ function admin_page_users_post(App $a) * * @param App $a * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ function admin_page_users(App $a) { @@ -2082,6 +2109,7 @@ function admin_page_users(App $a) * @param App $a * @param array $addons_admin A list of admin addon names * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ function admin_page_addons(App $a, array $addons_admin) { @@ -2287,6 +2315,7 @@ function rebuild_theme_table($themes) * * @param App $a * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ function admin_page_themes(App $a) { @@ -2457,6 +2486,7 @@ function admin_page_themes(App $a) * @brief Prosesses data send by Logs admin page * * @param App $a + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ function admin_page_logs_post(App $a) { @@ -2492,6 +2522,7 @@ function admin_page_logs_post(App $a) * * @param App $a * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ function admin_page_logs(App $a) { @@ -2548,6 +2579,7 @@ function admin_page_logs(App $a) * * @param App $a * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ function admin_page_viewlogs(App $a) { @@ -2591,6 +2623,7 @@ function admin_page_viewlogs(App $a) * @brief Prosesses data send by the features admin page * * @param App $a + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ function admin_page_features_post(App $a) { @@ -2638,6 +2671,7 @@ function admin_page_features_post(App $a) * * @param App $a * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ function admin_page_features(App $a) { diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php index 0c7f4c2a6e..7b446b5ead 100644 --- a/mod/dfrn_request.php +++ b/mod/dfrn_request.php @@ -54,6 +54,9 @@ function dfrn_request_init(App $a) * in order to link our friend request with our own server cell. * After logging in, we click 'submit' to approve the linkage. * + * @param App $a + * @throws ImagickException + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ function dfrn_request_post(App $a) { diff --git a/mod/fbrowser.php b/mod/fbrowser.php index c6e669d022..3401359052 100644 --- a/mod/fbrowser.php +++ b/mod/fbrowser.php @@ -14,6 +14,8 @@ use Friendica\Object\Image; /** * @param App $a + * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ function fbrowser_content(App $a) { diff --git a/mod/hovercard.php b/mod/hovercard.php index 976d7c1832..f71977f074 100644 --- a/mod/hovercard.php +++ b/mod/hovercard.php @@ -127,9 +127,10 @@ function hovercard_content() * @brief Get the raw content of a template file * * @param string $template The name of the template - * @param string $root Directory of the template + * @param string $root Directory of the template * * @return string|bool Output the raw content if existent, otherwise false + * @throws Exception */ function get_template_content($template, $root = '') { diff --git a/mod/item.php b/mod/item.php index 1c8525528b..5210f4ae8c 100644 --- a/mod/item.php +++ b/mod/item.php @@ -910,17 +910,18 @@ function item_content(App $a) /** * This function removes the tag $tag from the text $body and replaces it with - * the appropiate link. + * the appropriate link. * - * @param App $a Application instance @TODO is unused in this function's scope (excluding included files) - * @param string $body the text to replace the tag in - * @param string $inform a comma-seperated string containing everybody to inform - * @param string $str_tags string to add the tag to + * @param string $body the text to replace the tag in + * @param string $inform a comma-seperated string containing everybody to inform + * @param string $str_tags string to add the tag to * @param integer $profile_uid - * @param string $tag the tag to replace - * @param string $network The network of the post + * @param string $tag the tag to replace + * @param string $network The network of the post * - * @return boolean true if replaced, false if not replaced + * @return array|bool ['replaced' => $replaced, 'contact' => $contact]; + * @throws ImagickException + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ function handle_tag(App $a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $network = "") { diff --git a/mod/match.php b/mod/match.php index 451821f9f1..57e05226db 100644 --- a/mod/match.php +++ b/mod/match.php @@ -25,6 +25,9 @@ use Friendica\Util\Proxy as ProxyUtils; * @param App $a App * * @return string + * @throws ImagickException + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws Exception */ function match_content(App $a) { diff --git a/mod/network.php b/mod/network.php index 015be2b17c..626fb1149b 100644 --- a/mod/network.php +++ b/mod/network.php @@ -200,15 +200,16 @@ function saved_searches($search) * Return selected tab from query * * urls -> returns - * '/network' => $no_active = 'active' - * '/network?f=&order=comment' => $comment_active = 'active' - * '/network?f=&order=post' => $postord_active = 'active' - * '/network?f=&conv=1', => $conv_active = 'active' - * '/network/new', => $new_active = 'active' - * '/network?f=&star=1', => $starred_active = 'active' - * '/network?f=&bmark=1', => $bookmarked_active = 'active' + * '/network' => $no_active = 'active' + * '/network?f=&order=comment' => $comment_active = 'active' + * '/network?f=&order=post' => $postord_active = 'active' + * '/network?f=&conv=1', => $conv_active = 'active' + * '/network/new', => $new_active = 'active' + * '/network?f=&star=1', => $starred_active = 'active' + * '/network?f=&bmark=1', => $bookmarked_active = 'active' * - * @return Array ($no_active, $comment_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active); + * @param App $a + * @return array ($no_active, $comment_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active); */ function network_query_get_sel_tab(App $a) { @@ -264,9 +265,11 @@ function network_query_get_sel_group(App $a) /** * @brief Sets the pager data and returns SQL * - * @param App $a The global App + * @param App $a The global App + * @param Pager $pager * @param integer $update Used for the automatic reloading * @return string SQL with the appropriate LIMIT clause + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ function networkPager(App $a, Pager $pager, $update) { @@ -300,6 +303,7 @@ function networkPager(App $a, Pager $pager, $update) * @brief Sets items as seen * * @param array $condition The array with the SQL condition + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ function networkSetSeen($condition) { @@ -319,9 +323,12 @@ function networkSetSeen($condition) * * @param App $a The global App * @param array $items Items of the conversation + * @param Pager $pager * @param string $mode Display mode for the conversation * @param integer $update Used for the automatic reloading + * @param string $ordering * @return string HTML of the conversation + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ function networkConversation(App $a, $items, Pager $pager, $mode, $update, $ordering = '') { @@ -386,10 +393,11 @@ function network_content(App $a, $update = 0, $parent = 0) /** * @brief Get the network content in flat view * - * @param Pager $pager * @param App $a The global App * @param integer $update Used for the automatic reloading * @return string HTML of the network content in flat view + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @global Pager $pager */ function networkFlatView(App $a, $update = 0) { @@ -477,11 +485,12 @@ function networkFlatView(App $a, $update = 0) /** * @brief Get the network content in threaded view * - * @global Pager $pager * @param App $a The global App * @param integer $update Used for the automatic reloading * @param integer $parent * @return string HTML of the network content in flat view + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @global Pager $pager */ function networkThreadedView(App $a, $update, $parent) { @@ -1039,13 +1048,16 @@ function network_tabs(App $a) * of the page to make the correct asynchronous call. This is obtained through the Pager that was instantiated in * networkThreadedView or networkFlatView. * - * @global Pager $pager - * @param App $a * @param string $htmlhead The head tag HTML string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @global Pager $pager */ function network_infinite_scroll_head(App $a, &$htmlhead) { /// @TODO this will have to be converted to a static property of the converted Module\Network class + /** + * @var $pager Pager + */ global $pager; if (PConfig::get(local_user(), 'system', 'infinite_scroll') diff --git a/mod/parse_url.php b/mod/parse_url.php index 14ec4d42ce..b982ccf084 100644 --- a/mod/parse_url.php +++ b/mod/parse_url.php @@ -144,18 +144,18 @@ function parse_url_content(App $a) * Note: We have moved the function to ParseUrl.php. This function is only for * legacy support and will be remove in the future * - * @param type $url The url of the page which should be scraped - * @param type $no_guessing If true the parse doens't search for - * preview pictures - * @param type $do_oembed The false option is used by the function fetch_oembed() - * to avoid endless loops + * @param string $url The url of the page which should be scraped + * @param bool $no_guessing If true the parse doens't search for + * preview pictures + * @param bool $do_oembed The false option is used by the function fetch_oembed() + * to avoid endless loops * * @return array which contains needed data for embedding * - * @see ParseUrl::getSiteinfoCached() + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @see ParseUrl::getSiteinfoCached() * - * @todo Remove this function after all Addons has been changed to use - * ParseUrl::getSiteinfoCached + * @deprecated since version 3.6 use ParseUrl::getSiteinfoCached instead */ function parseurl_getsiteinfo_cached($url, $no_guessing = false, $do_oembed = true) { diff --git a/mod/ping.php b/mod/ping.php index 872e9f935b..8b50b78c83 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -30,30 +30,31 @@ use Friendica\Util\XML; * * Expected JSON structure: * { - * "result": { - * "intro": 0, - * "mail": 0, - * "net": 0, - * "home": 0, - * "register": 0, - * "all-events": 0, - * "all-events-today": 0, - * "events": 0, - * "events-today": 0, - * "birthdays": 0, - * "birthdays-today": 0, - * "groups": [ ], - * "forums": [ ], - * "notify": 0, - * "notifications": [ ], - * "sysmsgs": { - * "notice": [ ], - * "info": [ ] - * } - * } - * } + * "result": { + * "intro": 0, + * "mail": 0, + * "net": 0, + * "home": 0, + * "register": 0, + * "all-events": 0, + * "all-events-today": 0, + * "events": 0, + * "events-today": 0, + * "birthdays": 0, + * "birthdays-today": 0, + * "groups": [ ], + * "forums": [ ], + * "notify": 0, + * "notifications": [ ], + * "sysmsgs": { + * "notice": [ ], + * "info": [ ] + * } + * } + * } * * @param App $a The Friendica App instance + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ function ping_init(App $a) { @@ -393,6 +394,7 @@ function ping_init(App $a) * * @param int $uid User id * @return array Associative array of notifications + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ function ping_get_notifications($uid) { @@ -479,8 +481,8 @@ function ping_get_notifications($uid) * @param array $notifs Complete list of notification * @param array $sysmsgs List of system notice messages * @param array $sysmsgs_info List of system info messages - * @param array $groups_unseen List of unseen group messages - * @param array $forums_unseen List of unseen forum messages + * @param array $groups_unseen List of unseen group items + * @param array $forums_unseen List of unseen forum items * * @return array XML-transform ready data array */ diff --git a/mod/receive.php b/mod/receive.php index 690abea159..b0258acbd7 100644 --- a/mod/receive.php +++ b/mod/receive.php @@ -12,8 +12,10 @@ use Friendica\Database\DBA; use Friendica\Protocol\Diaspora; /** - * @param object $a App + * @param App $a App * @return void + * @throws ImagickException + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ function receive_post(App $a) { diff --git a/mod/smilies.php b/mod/smilies.php index ecea3400e2..bbb7de2e2e 100644 --- a/mod/smilies.php +++ b/mod/smilies.php @@ -7,8 +7,9 @@ use Friendica\Content\Smilies; use Friendica\Core\System; /** - * @param object $a App + * @param App $a App * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ function smilies_content(App $a) { diff --git a/mod/tagrm.php b/mod/tagrm.php index 24a41be95c..f6f2a9a29e 100644 --- a/mod/tagrm.php +++ b/mod/tagrm.php @@ -36,8 +36,10 @@ function tagrm_post(App $a) /** * Updates tags from an item + * * @param $item_id * @param $tags array + * @throws Exception */ function update_tags($item_id, $tags){ if (empty($item_id) || empty($tags)){ diff --git a/mod/view.php b/mod/view.php index ce260db185..1b2e379a93 100644 --- a/mod/view.php +++ b/mod/view.php @@ -1,8 +1,9 @@