diff --git a/src/App.php b/src/App.php index f5dba13dc0..e30cc92120 100644 --- a/src/App.php +++ b/src/App.php @@ -121,6 +121,7 @@ class App * @see initHead() * * @param string $path + * @throws InternalServerErrorException */ public function registerStylesheet($path) { @@ -137,6 +138,7 @@ class App * @see initFooter() * * @param string $path + * @throws InternalServerErrorException */ public function registerFooterScript($path) { @@ -617,6 +619,7 @@ class App * finally for PWD * * @return string + * @throws InternalServerErrorException */ public function getBasePath() { @@ -676,6 +679,7 @@ class App * * @param bool $ssl Whether to append http or https under SSL_POLICY_SELFSIGN * @return string Friendica server base URL + * @throws InternalServerErrorException */ public function getBaseURL($ssl = false) { @@ -709,6 +713,7 @@ class App * Clears the baseurl cache to prevent inconsistencies * * @param string $url + * @throws InternalServerErrorException */ public function setBaseURL($url) { @@ -882,6 +887,7 @@ class App * @param string $origURL * * @return string The cleaned url + * @throws InternalServerErrorException */ public function removeBaseURL($origURL) { @@ -935,6 +941,7 @@ class App * Returns the current UserAgent as a String * * @return string the UserAgent as a String + * @throws InternalServerErrorException */ public function getUserAgent() { @@ -1058,6 +1065,7 @@ class App * @brief Checks if the minimal memory is reached * * @return bool Is the memory limit reached? + * @throws InternalServerErrorException */ public function isMinMemoryReached() { @@ -1102,6 +1110,7 @@ class App * @brief Checks if the maximum load is reached * * @return bool Is the load reached? + * @throws InternalServerErrorException */ public function isMaxLoadReached() { @@ -1134,6 +1143,7 @@ class App * * @param string $command The command to execute * @param array $args Arguments to pass to the command ( [ 'key' => value, 'key2' => value2, ... ] + * @throws InternalServerErrorException */ public function proc_run($command, $args) { @@ -1190,7 +1200,10 @@ class App /** * @brief Checks if a given directory is usable for the system * + * @param $directory + * @param bool $check_writable * @return boolean the directory is usable + * @throws Exception */ public static function isDirectoryUsable($directory, $check_writable = true) { @@ -1368,6 +1381,7 @@ class App * Generates the site's default sender email address * * @return string + * @throws InternalServerErrorException */ public function getSenderEmailAddress() { @@ -1388,6 +1402,7 @@ class App * Returns the current theme name. * * @return string the name of the current theme + * @throws InternalServerErrorException */ public function getCurrentTheme() { @@ -1469,6 +1484,7 @@ class App * Provide a sane default if nothing is chosen or the specified theme does not exist. * * @return string + * @throws InternalServerErrorException */ public function getCurrentThemeStylesheetPath() { @@ -1930,7 +1946,7 @@ class App * Should only be used if it isn't clear if the URL is either internal or external * * @param string $toUrl The target URL - * + * @throws InternalServerErrorException */ public function redirect($toUrl) { diff --git a/src/App/Mode.php b/src/App/Mode.php index fdfb2ce6e0..8d82ffc0b4 100644 --- a/src/App/Mode.php +++ b/src/App/Mode.php @@ -42,7 +42,7 @@ class Mode * - App::MODE_NORMAL : Normal run with all features enabled * * @param string $basepath the Basepath of the Application - * + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public function determine($basepath = null) { diff --git a/src/BaseObject.php b/src/BaseObject.php index 39f98a38fd..84ff193823 100644 --- a/src/BaseObject.php +++ b/src/BaseObject.php @@ -23,6 +23,7 @@ class BaseObject * Same as get_app from boot.php * * @return App + * @throws \Exception */ public static function getApp() { diff --git a/src/Content/ContactSelector.php b/src/Content/ContactSelector.php index 4ba579b514..4705903884 100644 --- a/src/Content/ContactSelector.php +++ b/src/Content/ContactSelector.php @@ -19,6 +19,8 @@ class ContactSelector /** * @param string $current current * @param string $foreign_net network + * @return string + * @throws \Exception */ public static function profileAssign($current, $foreign_net) { @@ -73,6 +75,7 @@ class ContactSelector * @param string $network network * @param string $profile optional, default empty * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function networkToName($network, $profile = "") { @@ -141,6 +144,7 @@ class ContactSelector * @param string $current optional, default empty * @param string $suffix optionsl, default empty * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function gender($current = "", $suffix = "") { @@ -180,6 +184,7 @@ class ContactSelector * @param string $current optional, default empty * @param string $suffix optionsl, default empty * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function sexualPreference($current = "", $suffix = "") { @@ -217,6 +222,7 @@ class ContactSelector /** * @param string $current optional, default empty * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function maritalStatus($current = "") { diff --git a/src/Content/Feature.php b/src/Content/Feature.php index 7493965509..db0a70e2fb 100644 --- a/src/Content/Feature.php +++ b/src/Content/Feature.php @@ -18,6 +18,7 @@ class Feature * @param integer $uid user id * @param string $feature feature * @return boolean + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function isEnabled($uid, $feature) { @@ -45,6 +46,7 @@ class Feature * * @param string $feature feature * @return boolean + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function getDefault($feature) { @@ -69,6 +71,7 @@ class Feature * @param bool $filtered True removes any locked features * * @return array + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function get($filtered = true) { diff --git a/src/Content/ForumManager.php b/src/Content/ForumManager.php index ac745c50ff..88c22c5676 100644 --- a/src/Content/ForumManager.php +++ b/src/Content/ForumManager.php @@ -29,11 +29,12 @@ class ForumManager * @param boolean $showprivate Show private groups * * @return array - * 'url' => forum url - * 'name' => forum name - * 'id' => number of the key from the array - * 'micro' => contact photo in format micro - * 'thumb' => contact photo in format thumb + * 'url' => forum url + * 'name' => forum name + * 'id' => number of the key from the array + * 'micro' => contact photo in format micro + * 'thumb' => contact photo in format thumb + * @throws \Exception */ public static function getList($uid, $lastitem, $showhidden = true, $showprivate = false) { @@ -88,6 +89,8 @@ class ForumManager * @param int $uid The ID of the User * @param int $cid The contact id which is used to mark a forum as "selected" * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function widget($uid, $cid = 0) { @@ -143,6 +146,8 @@ class ForumManager * * @param int $uid The ID of the User * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function profileAdvanced($uid) { diff --git a/src/Content/Nav.php b/src/Content/Nav.php index 2f516652de..51cee03bf8 100644 --- a/src/Content/Nav.php +++ b/src/Content/Nav.php @@ -42,6 +42,8 @@ class Nav /** * Set a menu item in navbar as selected + * + * @param string $item */ public static function setSelected($item) { @@ -50,6 +52,10 @@ class Nav /** * Build page header and site navigation bars + * + * @param App $a + * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function build(App $a) { @@ -114,12 +120,13 @@ class Nav * Prepares a list of navigation links * * @brief Prepares a list of navigation links - * @param App $a + * @param App $a * @return array Navigation links - * string 'sitelocation' => The webbie (username@site.com) - * array 'nav' => Array of links used in the nav menu - * string 'banner' => Formatted html link with banner image - * array 'userinfo' => Array of user information (name, icon) + * string 'sitelocation' => The webbie (username@site.com) + * array 'nav' => Array of links used in the nav menu + * string 'banner' => Formatted html link with banner image + * array 'userinfo' => Array of user information (name, icon) + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function getInfo(App $a) { diff --git a/src/Content/OEmbed.php b/src/Content/OEmbed.php index 866a6ef31d..144ac4ca53 100644 --- a/src/Content/OEmbed.php +++ b/src/Content/OEmbed.php @@ -51,6 +51,7 @@ class OEmbed * @param bool $no_rich_type If set to true rich type content won't be fetched. * * @return \Friendica\Object\OEmbed + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function fetchURL($embedurl, $no_rich_type = false) { @@ -260,6 +261,9 @@ class OEmbed /** * Find .... * and replace it with [embed]url[/embed] + * + * @param $text + * @return string */ public static function HTML2BBCode($text) { @@ -298,6 +302,7 @@ class OEmbed * @brief Determines if rich content OEmbed is allowed for the provided URL * @param string $url * @return boolean + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function isAllowedURL($url) { @@ -353,14 +358,15 @@ class OEmbed * Since the iframe is automatically resized on load, there are no need for ugly * and impractical scrollbars. * - * @todo This function is currently unused until someoneā„¢ adds support for a separate OEmbed domain + * @todo This function is currently unused until someoneā„¢ adds support for a separate OEmbed domain * * @param string $src Original remote URL to embed * @param string $width * @param string $height * @return string formatted HTML * - * @see oembed_format_object() + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @see oembed_format_object() */ private static function iframe($src, $width, $height) { diff --git a/src/Content/Pager.php b/src/Content/Pager.php index 4045ac8443..c9acb63f23 100644 --- a/src/Content/Pager.php +++ b/src/Content/Pager.php @@ -65,7 +65,7 @@ class Pager /** * Returns the current page number * - * @return type + * @return int */ public function getPage() { @@ -140,6 +140,7 @@ class Pager * * @param integer $itemCount The number of displayed items on the page * @return string HTML string of the pager + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public function renderMinimal($itemCount) { @@ -182,6 +183,7 @@ class Pager * * @param integer $itemCount The total number of items including those note displayed on the page * @return string HTML string of the pager + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public function renderFull($itemCount) { diff --git a/src/Content/Smilies.php b/src/Content/Smilies.php index 2bc7fffd61..9023959978 100644 --- a/src/Content/Smilies.php +++ b/src/Content/Smilies.php @@ -55,10 +55,11 @@ class Smilies * Get an array of all smilies, both internal and from addons. * * @return array - * 'texts' => smilie shortcut - * 'icons' => icon in html + * 'texts' => smilie shortcut + * 'icons' => icon in html * - * @hook smilie ('texts' => smilies texts array, 'icons' => smilies html array) + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @hook smilie ('texts' => smilies texts array, 'icons' => smilies html array) */ public static function getList() { @@ -182,6 +183,7 @@ class Smilies * @param boolean $no_images Only replace emoticons without images * * @return string HTML Output of the Smilie + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function replace($s, $no_images = false) { @@ -201,6 +203,7 @@ class Smilies * @param array $smilies An string replacement array with the following structure: ['texts' => [], 'icons' => []] * @param bool $no_images Only replace shortcodes without image replacement (e.g. Unicode characters) * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function replaceFromArray($text, array $smilies, $no_images = false) { @@ -248,6 +251,7 @@ class Smilies * @param string $m string * * @return string base64 decoded string + * @throws \Exception */ private static function decode($m) { @@ -262,7 +266,8 @@ class Smilies * * @return string HTML Output * - * @todo: Rework because it doesn't work correctly + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @todo : Rework because it doesn't work correctly */ private static function pregHeart($x) { diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php index a3ca999897..b77923013b 100644 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@ -37,13 +37,14 @@ class BBCode extends BaseObject * * @param string $body Message body * @return array - * 'type' -> Message type ("link", "video", "photo") - * 'text' -> Text before the shared message - * 'after' -> Text after the shared message - * 'image' -> Preview image of the message - * 'url' -> Url to the attached message - * 'title' -> Title of the attachment - * 'description' -> Description of the attachment + * 'type' -> Message type ("link", "video", "photo") + * 'text' -> Text before the shared message + * 'after' -> Text after the shared message + * 'image' -> Preview image of the message + * 'url' -> Url to the attached message + * 'title' -> Title of the attachment + * 'description' -> Description of the attachment + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function getOldAttachmentData($body) { @@ -108,13 +109,14 @@ class BBCode extends BaseObject * * @param string $body Message body * @return array - * 'type' -> Message type ("link", "video", "photo") - * 'text' -> Text before the shared message - * 'after' -> Text after the shared message - * 'image' -> Preview image of the message - * 'url' -> Url to the attached message - * 'title' -> Title of the attachment - * 'description' -> Description of the attachment + * 'type' -> Message type ("link", "video", "photo") + * 'text' -> Text before the shared message + * 'after' -> Text after the shared message + * 'image' -> Preview image of the message + * 'url' -> Url to the attached message + * 'title' -> Title of the attachment + * 'description' -> Description of the attachment + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function getAttachmentData($body) { @@ -345,6 +347,7 @@ class BBCode extends BaseObject /** * @brief Converts a BBCode text into plaintext * + * @param $text * @param bool $keep_urls Whether to keep URLs in the resulting plaintext * * @return string @@ -446,6 +449,7 @@ class BBCode extends BaseObject * @brief Truncates imported message body string length to max_import_size * @param string $body * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function limitBodySize($body) { @@ -532,10 +536,11 @@ class BBCode extends BaseObject * Note: Can produce a [bookmark] tag in the returned string * * @brief Processes [attachment] tags - * @param string $return + * @param string $return * @param bool|int $simplehtml - * @param bool $tryoembed + * @param bool $tryoembed * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function convertAttachment($return, $simplehtml = false, $tryoembed = true) { @@ -777,10 +782,10 @@ class BBCode extends BaseObject /** * Performs a preg_replace within the boundaries of all named BBCode tags in a text * - * @param type $pattern Preg pattern string - * @param type $replace Preg replace string - * @param type $name BBCode tag name - * @param type $text Text to search + * @param string $pattern Preg pattern string + * @param string $replace Preg replace string + * @param string $name BBCode tag name + * @param string $text Text to search * @return string */ public static function pregReplaceInTag($pattern, $replace, $name, $text) @@ -930,6 +935,7 @@ class BBCode extends BaseObject * @param boolean $is_quote_share Whether there is content before the [share] block * @param integer $simplehtml Mysterious integer value depending on the target network/formatting style * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function convertShareCallback(array $attributes, array $author_contact, $content, $is_quote_share, $simplehtml) { @@ -1142,6 +1148,7 @@ class BBCode extends BaseObject * @param int $simple_html * @param bool $for_plaintext * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function convert($text, $try_oembed = true, $simple_html = false, $for_plaintext = false) { @@ -1813,6 +1820,8 @@ class BBCode extends BaseObject * [2] = Name * [3] = Address * @return string Replaced mention + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function bbCodeMention2DiasporaCallback($match) { @@ -1839,6 +1848,7 @@ class BBCode extends BaseObject * @param string $text * @param bool $for_diaspora Diaspora requires more changes than Libertree * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function toMarkdown($text, $for_diaspora = true) { diff --git a/src/Content/Text/HTML.php b/src/Content/Text/HTML.php index 80aac9c114..8c32498a3f 100644 --- a/src/Content/Text/HTML.php +++ b/src/Content/Text/HTML.php @@ -117,12 +117,13 @@ class HTML /** * Made by: ike@piratenpartei.de * Originally made for the syncom project: http://wiki.piratenpartei.de/Syncom - * https://github.com/annando/Syncom + * https://github.com/annando/Syncom * * @brief Converter for HTML to BBCode * @param string $message * @param string $basepath * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function toBBCode($message, $basepath = '') { @@ -713,6 +714,7 @@ class HTML * @brief Convert video HTML to BBCode tags * * @param string $s + * @return string */ public static function toBBCodeVideo($s) { @@ -789,7 +791,9 @@ class HTML /** * Loader for infinite scrolling + * * @return string html for loader + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function scrollLoader() { @@ -804,8 +808,10 @@ class HTML * Get html for contact block. * * @template contact_block.tpl - * @hook contact_block_end (contacts=>array, output=>string) + * @hook contact_block_end (contacts=>array, output=>string) * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function contactBlock() { @@ -890,22 +896,23 @@ class HTML /** * @brief Format contacts as picture links or as text links * - * @param array $contact Array with contacts which contains an array with - * int 'id' => The ID of the contact - * int 'uid' => The user ID of the user who owns this data - * string 'name' => The name of the contact - * string 'url' => The url to the profile page of the contact - * string 'addr' => The webbie of the contact (e.g.) username@friendica.com - * string 'network' => The network to which the contact belongs to - * string 'thumb' => The contact picture - * string 'click' => js code which is performed when clicking on the contact - * @param boolean $redirect If true try to use the redir url if it's possible - * @param string $class CSS class for the - * @param boolean $textmode If true display the contacts as text links - * if false display the contacts as picture links - - * @return string Formatted html - */ + * @param array $contact Array with contacts which contains an array with + * int 'id' => The ID of the contact + * int 'uid' => The user ID of the user who owns this data + * string 'name' => The name of the contact + * string 'url' => The url to the profile page of the contact + * string 'addr' => The webbie of the contact (e.g.) username@friendica.com + * string 'network' => The network to which the contact belongs to + * string 'thumb' => The contact picture + * string 'click' => js code which is performed when clicking on the contact + * @param boolean $redirect If true try to use the redir url if it's possible + * @param string $class CSS class for the + * @param boolean $textmode If true display the contacts as text links + * if false display the contacts as picture links + * @return string Formatted html + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException + */ public static function micropro($contact, $redirect = false, $class = '', $textmode = false) { // Use the contact URL if no address is available @@ -947,10 +954,10 @@ class HTML * @param string $s Search query. * @param string $id HTML id * @param string $url Search url. - * @param bool $save Show save search button. * @param bool $aside Display the search widgit aside. * * @return string Formatted HTML. + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function search($s, $id = 'search-box', $url = 'search', $aside = true) { @@ -990,6 +997,7 @@ class HTML * Replace naked text hyperlink with HTML formatted hyperlink * * @param string $s + * @return string */ public static function toLink($s) { @@ -1006,6 +1014,7 @@ class HTML * @param string $html * @param array $reasons * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function applyContentFilter($html, array $reasons) { diff --git a/src/Content/Text/Markdown.php b/src/Content/Text/Markdown.php index 994d968334..bf95e1a934 100644 --- a/src/Content/Text/Markdown.php +++ b/src/Content/Text/Markdown.php @@ -26,6 +26,7 @@ class Markdown extends BaseObject * @param string $text * @param bool $hardwrap * @return string + * @throws \Exception */ public static function convert($text, $hardwrap = true) { $stamp1 = microtime(true); @@ -48,6 +49,8 @@ class Markdown extends BaseObject * [2] = name (optional) * [3] = address * @return string Replaced mention + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function diasporaMention2BBCodeCallback($match) { diff --git a/src/Content/Text/Plaintext.php b/src/Content/Text/Plaintext.php index 3b692fd965..2ec76ba13b 100644 --- a/src/Content/Text/Plaintext.php +++ b/src/Content/Text/Plaintext.php @@ -9,9 +9,9 @@ class Plaintext /** * Shortens message * - * @param type $msg - * @param type $limit - * @return type + * @param string $msg + * @param int $limit + * @return string * * @todo For Twitter URLs aren't shortened, but they have to be calculated as if. */ diff --git a/src/Content/Widget.php b/src/Content/Widget.php index adf6545b43..3c3af4f6ac 100644 --- a/src/Content/Widget.php +++ b/src/Content/Widget.php @@ -28,6 +28,8 @@ class Widget * Return the follow widget * * @param string $value optional, default empty + * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function follow($value = "") { @@ -125,6 +127,8 @@ class Widget * * @param string $baseurl baseurl * @param string $selected optional, default empty + * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function networks($baseurl, $selected = '') { @@ -167,6 +171,8 @@ class Widget * * @param string $baseurl baseurl * @param string $selected optional, default empty + * @return string|void + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function fileAs($baseurl, $selected = '') { @@ -205,6 +211,8 @@ class Widget * * @param string $baseurl baseurl * @param string $selected optional, default empty + * @return string|void + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function categories($baseurl, $selected = '') { @@ -244,6 +252,8 @@ class Widget * Return common friends visitor widget * * @param string $profile_uid uid + * @return string|void + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function commonFriendsVisitor($profile_uid) { @@ -327,8 +337,10 @@ class Widget * Insert a tag cloud widget for the present profile. * * @brief Insert a tag cloud widget for the present profile. - * @param int $limit Max number of displayed tags. + * @param int $limit Max number of displayed tags. * @return string HTML formatted output. + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function tagCloud($limit = 50) { diff --git a/src/Content/Widget/CalendarExport.php b/src/Content/Widget/CalendarExport.php index 8d9309a5bd..120af99d00 100644 --- a/src/Content/Widget/CalendarExport.php +++ b/src/Content/Widget/CalendarExport.php @@ -21,6 +21,7 @@ class CalendarExport * @brief Get the events widget. * * @return string Formated HTML of the calendar widget. + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function getHTML() { $a = \get_app(); diff --git a/src/Content/Widget/TagCloud.php b/src/Content/Widget/TagCloud.php index f214ba7999..e1ce921c04 100644 --- a/src/Content/Widget/TagCloud.php +++ b/src/Content/Widget/TagCloud.php @@ -24,13 +24,14 @@ class TagCloud * Construct a tag/term cloud block for an user. * * @brief Construct a tag/term cloud block for an user. - * @param int $uid The user ID. - * @param int $count Max number of displayed tags/terms. - * @param int $owner_id The contact ID of the owner of the tagged items. - * @param string $flags Special item flags. - * @param int $type The tag/term type. + * @param int $uid The user ID. + * @param int $count Max number of displayed tags/terms. + * @param int $owner_id The contact ID of the owner of the tagged items. + * @param string $flags Special item flags. + * @param int $type The tag/term type. * * @return string HTML formatted output. + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function getHTML($uid, $count = 0, $owner_id = 0, $flags = '', $type = TERM_HASHTAG) { @@ -63,13 +64,14 @@ class TagCloud * * @brief Get alphabetical sorted array of used tags/terms of an user including * a weighting by frequency of use. - * @param int $uid The user ID. - * @param int $count Max number of displayed tags/terms. - * @param int $owner_id The contact id of the owner of the tagged items. - * @param string $flags Special item flags. - * @param int $type The tag/term type. + * @param int $uid The user ID. + * @param int $count Max number of displayed tags/terms. + * @param int $owner_id The contact id of the owner of the tagged items. + * @param string $flags Special item flags. + * @param int $type The tag/term type. * - * @return arr Alphabetical sorted array of used tags of an user. + * @return array Alphabetical sorted array of used tags of an user. + * @throws \Exception */ private static function tagadelic($uid, $count = 0, $owner_id = 0, $flags = '', $type = TERM_HASHTAG) { @@ -146,8 +148,8 @@ class TagCloud * Compare function to sort tags/terms alphabetically. * * @brief Compare function to sort tags/terms alphabetically. - * @param type $a - * @param type $b + * @param string $a + * @param string $b * * @return int */ diff --git a/src/Core/ACL.php b/src/Core/ACL.php index 5cb2459570..b693a28bf9 100644 --- a/src/Core/ACL.php +++ b/src/Core/ACL.php @@ -23,15 +23,16 @@ class ACL extends BaseObject /** * Returns a select input tag with all the contact of the local user * - * @param string $selname Name attribute of the select input tag - * @param string $selclass Class attribute of the select input tag - * @param array $options Available options: - * - size: length of the select box - * - mutual_friends: Only used for the hook - * - single: Only used for the hook - * - exclude: Only used for the hook - * @param array $preselected Contact ID that should be already selected + * @param string $selname Name attribute of the select input tag + * @param string $selclass Class attribute of the select input tag + * @param array $options Available options: + * - size: length of the select box + * - mutual_friends: Only used for the hook + * - single: Only used for the hook + * - exclude: Only used for the hook + * @param array $preselected Contact ID that should be already selected * @return string + * @throws \Exception */ public static function getSuggestContactSelectHTML($selname, $selclass, array $options = [], array $preselected = []) { @@ -141,6 +142,7 @@ class ACL extends BaseObject * @param int $size Length of the select box * @param int $tabindex Select input tag tabindex attribute * @return string + * @throws \Exception */ public static function getMessageContactSelectHTML($selname, $selclass, array $preselected = [], $size = 4, $tabindex = null) { @@ -215,6 +217,7 @@ class ACL extends BaseObject * * @param array $user * @return array Hash of contact id lists + * @throws \Exception */ public static function getDefaultUserPermissions(array $user = null) { @@ -251,9 +254,10 @@ class ACL extends BaseObject * Return the full jot ACL selector HTML * * @param array $user User array - * @param array $default_permissions Static defaults permission array: ['allow_cid' => '', 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => ''] * @param bool $show_jotnets + * @param array $default_permissions Static defaults permission array: ['allow_cid' => '', 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => ''] * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function getFullSelectorHTML(array $user, $show_jotnets = false, array $default_permissions = []) { @@ -320,6 +324,7 @@ class ACL extends BaseObject * @param string $search Name or part of a name or nick * @param string $mode Search mode (e.g. "community") * @return array with the search results + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function contactAutocomplete($search, $mode) { diff --git a/src/Core/Addon.php b/src/Core/Addon.php index ee89f4d772..1118280a53 100644 --- a/src/Core/Addon.php +++ b/src/Core/Addon.php @@ -70,7 +70,8 @@ class Addon extends BaseObject * @brief uninstalls an addon. * * @param string $addon name of the addon - * @return boolean + * @return void + * @throws \Exception */ public static function uninstall($addon) { @@ -91,6 +92,7 @@ class Addon extends BaseObject * * @param string $addon name of the addon * @return bool + * @throws \Exception */ public static function install($addon) { @@ -190,6 +192,7 @@ class Addon extends BaseObject * *\endcode * @param string $addon the name of the addon * @return array with the addon information + * @throws \Exception */ public static function getInfo($addon) { @@ -269,6 +272,7 @@ class Addon extends BaseObject * Saves the current enabled addon list in the system.addon config key * * @return boolean + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function saveEnabledList() { @@ -279,6 +283,7 @@ class Addon extends BaseObject * Returns the list of non-hidden enabled addon names * * @return array + * @throws \Exception */ public static function getVisibleList() { @@ -296,13 +301,14 @@ class Addon extends BaseObject /** * Shim of Hook::register left for backward compatibility purpose. * - * @see Hook::register + * @see Hook::register * @deprecated since version 2018.12 * @param string $hook the name of the hook * @param string $file the name of the file that hooks into * @param string $function the name of the function that the hook will call * @param int $priority A priority (defaults to 0) * @return mixed|bool + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function registerHook($hook, $file, $function, $priority = 0) { @@ -312,12 +318,13 @@ class Addon extends BaseObject /** * Shim of Hook::unregister left for backward compatibility purpose. * - * @see Hook::unregister + * @see Hook::unregister * @deprecated since version 2018.12 * @param string $hook the name of the hook * @param string $file the name of the file that hooks into * @param string $function the name of the function that the hook called * @return boolean + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function unregisterHook($hook, $file, $function) { @@ -327,10 +334,11 @@ class Addon extends BaseObject /** * Shim of Hook::callAll left for backward-compatibility purpose. * - * @see Hook::callAll + * @see Hook::callAll * @deprecated since version 2018.12 - * @param string $name of the hook to call + * @param string $name of the hook to call * @param string|array &$data to transmit to the callback handler + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function callHooks($name, &$data = null) { diff --git a/src/Core/Authentication.php b/src/Core/Authentication.php index 235b99f8f7..106ba2a602 100644 --- a/src/Core/Authentication.php +++ b/src/Core/Authentication.php @@ -21,6 +21,7 @@ class Authentication extends BaseObject * @param array $user Record from "user" table * * @return string Hashed data + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function getCookieHashForUser($user) { @@ -32,8 +33,9 @@ class Authentication extends BaseObject /** * @brief Set the "Friendica" cookie * - * @param int $time + * @param int $time * @param array $user Record from "user" table + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function setCookie($time, $user = []) { @@ -55,12 +57,13 @@ class Authentication extends BaseObject /** * @brief Sets the provided user's authenticated session * - * @todo Should be moved to Friendica\Core\Session once it's created + * @todo Should be moved to Friendica\Core\Session once it's created * - * @param type $user_record - * @param type $login_initial - * @param type $interactive - * @param type $login_refresh + * @param array $user_record + * @param bool $login_initial + * @param bool $interactive + * @param bool $login_refresh + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function setAuthenticatedSessionForUser($user_record, $login_initial = false, $interactive = false, $login_refresh = false) { diff --git a/src/Core/Cache.php b/src/Core/Cache.php index e7277fd702..39c29566d3 100644 --- a/src/Core/Cache.php +++ b/src/Core/Cache.php @@ -55,6 +55,7 @@ class Cache extends \Friendica\BaseObject * @param string $prefix Prefix of the keys (optional) * * @return array Empty if the driver doesn't support this feature + * @throws \Exception */ public static function getAllKeys($prefix = null) { @@ -73,6 +74,7 @@ class Cache extends \Friendica\BaseObject * @param string $key The key to the cached data * * @return mixed Cached $value or "null" if not found + * @throws \Exception */ public static function get($key) { @@ -95,6 +97,7 @@ class Cache extends \Friendica\BaseObject * @param integer $duration The cache lifespan * * @return bool + * @throws \Exception */ public static function set($key, $value, $duration = self::MONTH) { @@ -113,6 +116,7 @@ class Cache extends \Friendica\BaseObject * @param string $key The key to the cached data * * @return bool + * @throws \Exception */ public static function delete($key) { @@ -130,7 +134,7 @@ class Cache extends \Friendica\BaseObject * * @param boolean $outdated just remove outdated values * - * @return void + * @return bool */ public static function clear($outdated = true) { diff --git a/src/Core/Cache/AbstractCacheDriver.php b/src/Core/Cache/AbstractCacheDriver.php index c2628551ef..13993385ad 100644 --- a/src/Core/Cache/AbstractCacheDriver.php +++ b/src/Core/Cache/AbstractCacheDriver.php @@ -14,8 +14,9 @@ use Friendica\BaseObject; abstract class AbstractCacheDriver extends BaseObject { /** - * @param string $key The original key - * @return string The cache key used for the cache + * @param string $key The original key + * @return string The cache key used for the cache + * @throws \Exception */ protected function getCacheKey($key) { diff --git a/src/Core/Config.php b/src/Core/Config.php index f191c10a0e..fad50c0cb4 100644 --- a/src/Core/Config.php +++ b/src/Core/Config.php @@ -22,7 +22,7 @@ use Friendica\Core\Config; class Config extends BaseObject { /** - * @var Friendica\Core\Config\IConfigAdapter + * @var \Friendica\Core\Config\IConfigAdapter */ private static $adapter = null; @@ -49,6 +49,7 @@ class Config extends BaseObject * @param string $family The category of the configuration value * * @return void + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function load($family = "config") { @@ -82,6 +83,7 @@ class Config extends BaseObject * @param boolean $refresh optional, If true the config is loaded from the db and not from the cache (default: false) * * @return mixed Stored value or null if it does not exist + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function get($family, $key, $default_value = null, $refresh = false) { @@ -110,6 +112,7 @@ class Config extends BaseObject * @param mixed $value The value to store * * @return bool Operation success + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function set($family, $key, $value) { @@ -135,6 +138,7 @@ class Config extends BaseObject * @param string $key The configuration key to delete * * @return mixed + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function delete($family, $key) { diff --git a/src/Core/Config/IConfigAdapter.php b/src/Core/Config/IConfigAdapter.php index f9af253c0b..9d8eefd777 100644 --- a/src/Core/Config/IConfigAdapter.php +++ b/src/Core/Config/IConfigAdapter.php @@ -49,9 +49,9 @@ interface IConfigAdapter * * Note: Please do not store booleans - convert to 0/1 integer values! * - * @param string $family The category of the configuration value - * @param string $key The configuration key to set - * @param mixed $value The value to store + * @param string $cat The category of the configuration value + * @param string $k The configuration key to set + * @param mixed $value The value to store * * @return bool Operation success */ diff --git a/src/Core/Console/AutomaticInstallation.php b/src/Core/Console/AutomaticInstallation.php index c2f9df383b..7db2cc3e70 100644 --- a/src/Core/Console/AutomaticInstallation.php +++ b/src/Core/Console/AutomaticInstallation.php @@ -185,6 +185,7 @@ HELP; * @param Installer $installer the Installer instance * * @return bool true if checks were successfully, otherwise false + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private function runBasicChecks(Installer $installer) { diff --git a/src/Core/Console/PhpToPo.php b/src/Core/Console/PhpToPo.php index a5b04e949a..93d8274877 100644 --- a/src/Core/Console/PhpToPo.php +++ b/src/Core/Console/PhpToPo.php @@ -206,6 +206,9 @@ HELP; * - replace " with \" * - replace tab char with \t * - manage multiline strings + * + * @param string $str + * @return string */ private function massageString($str) { diff --git a/src/Core/Hook.php b/src/Core/Hook.php index 2d6c945067..7f0c015b3d 100644 --- a/src/Core/Hook.php +++ b/src/Core/Hook.php @@ -48,9 +48,9 @@ class Hook extends BaseObject * * This function is meant to be called by modules on each page load as it works after loadHooks has been called. * - * @param type $hook - * @param type $file - * @param type $function + * @param string $hook + * @param string $file + * @param string $function */ public static function add($hook, $file, $function) { @@ -70,6 +70,7 @@ class Hook extends BaseObject * @param string $function the name of the function that the hook will call * @param int $priority A priority (defaults to 0) * @return mixed|bool + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function register($hook, $file, $function, $priority = 0) { @@ -92,6 +93,7 @@ class Hook extends BaseObject * @param string $file the name of the file that hooks into * @param string $function the name of the function that the hook called * @return boolean + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function unregister($hook, $file, $function) { @@ -131,6 +133,7 @@ class Hook extends BaseObject * @param integer $priority of the hook * @param string $name of the hook to call * @param mixed $data to transmit to the callback handler + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function fork($priority, $name, $data = null) { @@ -163,8 +166,9 @@ class Hook extends BaseObject * Use this function when you want to be able to allow a hook to manipulate * the provided data. * - * @param string $name of the hook to call + * @param string $name of the hook to call * @param string|array &$data to transmit to the callback handler + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function callAll($name, &$data = null) { @@ -178,10 +182,11 @@ class Hook extends BaseObject /** * @brief Calls a single hook. * - * @param App $a - * @param string $name of the hook to call - * @param array $hook Hook data + * @param App $a + * @param string $name of the hook to call + * @param array $hook Hook data * @param string|array &$data to transmit to the callback handler + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function callSingle(App $a, $name, $hook, &$data = null) { diff --git a/src/Core/Installer.php b/src/Core/Installer.php index 15bcb76f49..6ea3d553cf 100644 --- a/src/Core/Installer.php +++ b/src/Core/Installer.php @@ -47,6 +47,7 @@ class Installer * Returns the PHP path * * @return string the PHP Path + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public function getPHPPath() { @@ -79,10 +80,11 @@ class Installer /** * Checks the current installation environment. There are optional and mandatory checks. * - * @param string $baseurl The baseurl of Friendica - * @param string $phpath Optional path to the PHP binary + * @param string $baseurl The baseurl of Friendica + * @param string $phpath Optional path to the PHP binary * * @return bool if the check succeed + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public function checkEnvironment($baseurl, $phpath = null) { @@ -126,18 +128,19 @@ class Installer * - Creates `config/local.config.php` * - Installs Database Structure * - * @param string $phppath Path to the PHP-Binary (optional, if not set e.g. 'php' or '/usr/bin/php') - * @param string $urlpath Path based on the URL of Friendica (e.g. '/friendica') - * @param string $dbhost Hostname/IP of the Friendica Database - * @param string $dbuser Username of the Database connection credentials - * @param string $dbpass Password of the Database connection credentials - * @param string $dbdata Name of the Database - * @param string $timezone Timezone of the Friendica Installaton (e.g. 'Europe/Berlin') - * @param string $language 2-letter ISO 639-1 code (eg. 'en') - * @param string $adminmail Mail-Adress of the administrator - * @param string $basepath The basepath of Friendica + * @param string $phppath Path to the PHP-Binary (optional, if not set e.g. 'php' or '/usr/bin/php') + * @param string $urlpath Path based on the URL of Friendica (e.g. '/friendica') + * @param string $dbhost Hostname/IP of the Friendica Database + * @param string $dbuser Username of the Database connection credentials + * @param string $dbpass Password of the Database connection credentials + * @param string $dbdata Name of the Database + * @param string $timezone Timezone of the Friendica Installaton (e.g. 'Europe/Berlin') + * @param string $language 2-letter ISO 639-1 code (eg. 'en') + * @param string $adminmail Mail-Adress of the administrator + * @param string $basepath The basepath of Friendica * * @return bool true if the config was created, otherwise false + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public function createConfig($phppath, $urlpath, $dbhost, $dbuser, $dbpass, $dbdata, $timezone, $language, $adminmail, $basepath) { @@ -167,6 +170,7 @@ class Installer * Installs the DB-Scheme for Friendica * * @return bool true if the installation was successful, otherwise false + * @throws Exception */ public function installDatabase() { @@ -212,11 +216,12 @@ class Installer * - Checks if a PHP binary is available * - Checks if it is the CLI version * - Checks if "register_argc_argv" is enabled - * - * @param string $phppath Optional. The Path to the PHP-Binary + * + * @param string $phppath Optional. The Path to the PHP-Binary * @param bool $required Optional. If set to true, the PHP-Binary has to exist (Default false) * * @return bool false if something required failed + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public function checkPHP($phppath = null, $required = false) { @@ -507,8 +512,9 @@ class Installer * * Checks, if "url_rewrite" is enabled in the ".htaccess" file * - * @param string $baseurl The baseurl of the app + * @param string $baseurl The baseurl of the app * @return bool false if something required failed + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public function checkHtAccess($baseurl) { @@ -576,12 +582,13 @@ class Installer /** * Checking the Database connection and if it is available for the current installation * - * @param string $dbhost Hostname/IP of the Friendica Database - * @param string $dbuser Username of the Database connection credentials - * @param string $dbpass Password of the Database connection credentials - * @param string $dbdata Name of the Database + * @param string $dbhost Hostname/IP of the Friendica Database + * @param string $dbuser Username of the Database connection credentials + * @param string $dbpass Password of the Database connection credentials + * @param string $dbdata Name of the Database * * @return bool true if the check was successful, otherwise false + * @throws Exception */ public function checkDB($dbhost, $dbuser, $dbpass, $dbdata) { diff --git a/src/Core/L10n.php b/src/Core/L10n.php index dfeeeb041b..f7ed9918ce 100644 --- a/src/Core/L10n.php +++ b/src/Core/L10n.php @@ -90,6 +90,7 @@ class L10n extends BaseObject /** * @brief Returns the preferred language from the HTTP_ACCEPT_LANGUAGE header * @return string The two-letter language code + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function detectLanguage() { @@ -141,9 +142,10 @@ class L10n extends BaseObject * * If called repeatedly, it won't save the translation strings again, just load the new ones. * - * @see popLang() + * @see popLang() * @brief Stores the current language strings and load a different language. * @param string $lang Language code + * @throws \Exception */ public static function pushLang($lang) { @@ -187,6 +189,7 @@ class L10n extends BaseObject * Uses an App object shim since all the strings files refer to $a->strings * * @param string $lang language code to load + * @throws \Exception */ private static function loadTranslationTable($lang) { @@ -269,8 +272,9 @@ class L10n extends BaseObject * * @param string $singular * @param string $plural - * @param int $count + * @param int $count * @return string + * @throws \Exception */ public static function tt($singular, $plural, $count) { @@ -314,6 +318,9 @@ class L10n extends BaseObject /** * Provide a fallback which will not collide with a function defined in any language file + * + * @param int $n + * @return bool */ private static function stringPluralSelectDefault($n) { @@ -391,7 +398,8 @@ class L10n extends BaseObject * Load poke verbs * * @return array index is present tense verb - * value is array containing past tense verb, translation of present, translation of past + * value is array containing past tense verb, translation of present, translation of past + * @throws \Friendica\Network\HTTPException\InternalServerErrorException * @hook poke_verbs pokes array */ public static function getPokeVerbs() diff --git a/src/Core/Logger.php b/src/Core/Logger.php index 1aaea665e2..16fb138628 100644 --- a/src/Core/Logger.php +++ b/src/Core/Logger.php @@ -140,13 +140,14 @@ class Logger extends BaseObject /** * System is unusable. + * * @see LoggerInterface::emergency() * * @param string $message * @param array $context * * @return void - * + * @throws \Exception */ public static function emergency($message, $context = []) { @@ -170,7 +171,7 @@ class Logger extends BaseObject * @param array $context * * @return void - * + * @throws \Exception */ public static function alert($message, $context = []) { @@ -193,7 +194,7 @@ class Logger extends BaseObject * @param array $context * * @return void - * + * @throws \Exception */ public static function critical($message, $context = []) { @@ -215,7 +216,7 @@ class Logger extends BaseObject * @param array $context * * @return void - * + * @throws \Exception */ public static function error($message, $context = []) { @@ -240,7 +241,7 @@ class Logger extends BaseObject * @param array $context * * @return void - * + * @throws \Exception */ public static function warning($message, $context = []) { @@ -261,7 +262,7 @@ class Logger extends BaseObject * @param array $context * * @return void - * + * @throws \Exception */ public static function notice($message, $context = []) { @@ -284,7 +285,7 @@ class Logger extends BaseObject * @param array $context * * @return void - * + * @throws \Exception */ public static function info($message, $context = []) { @@ -305,6 +306,7 @@ class Logger extends BaseObject * @param array $context * * @return void + * @throws \Exception */ public static function debug($message, $context = []) { @@ -317,14 +319,15 @@ class Logger extends BaseObject self::getApp()->saveTimestamp($stamp1, 'file'); } - /** - * @brief Logs the given message at the given log level - * - * @param string $msg - * @param int $level + /** + * @brief Logs the given message at the given log level * + * @param string $msg + * @param string $level + * + * @throws \Exception * @deprecated since 2019.03 Use Logger::debug() Logger::info() , ... instead - */ + */ public static function log($msg, $level = LogLevel::NOTICE) { if (!isset(self::$logger)) { @@ -336,15 +339,16 @@ class Logger extends BaseObject self::getApp()->saveTimestamp($stamp1, "file"); } - /** - * @brief An alternative logger for development. - * Works largely as log() but allows developers - * to isolate particular elements they are targetting - * personally without background noise - * - * @param string $msg + /** + * @brief An alternative logger for development. + * Works largely as log() but allows developers + * to isolate particular elements they are targetting + * personally without background noise + * + * @param string $msg * @param string $level - */ + * @throws \Exception + */ public static function devLog($msg, $level = LogLevel::DEBUG) { if (!isset(self::$logger)) { diff --git a/src/Core/NotificationsManager.php b/src/Core/NotificationsManager.php index 5a2efe297b..2687719472 100644 --- a/src/Core/NotificationsManager.php +++ b/src/Core/NotificationsManager.php @@ -36,6 +36,7 @@ class NotificationsManager extends BaseObject * - date_rel : relative date string * - msg_html: message as html string * - msg_plain: message as plain text string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private function _set_extra($notes) { @@ -61,6 +62,7 @@ class NotificationsManager extends BaseObject * @param string $limit optional Query limits * * @return array of results or false on errors + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public function getAll($filter = [], $order = "-date", $limit = "") { @@ -109,6 +111,7 @@ class NotificationsManager extends BaseObject * * @param int $id identity * @return array note values or null if not found + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public function getByID($id) { @@ -161,6 +164,7 @@ class NotificationsManager extends BaseObject * @brief List of pages for the Notifications TabBar * * @return array with with notifications TabBar data + * @throws \Exception */ public function getTabs() { @@ -213,14 +217,15 @@ class NotificationsManager extends BaseObject * @param array $notifs The array from the db query * @param string $ident The notifications identifier (e.g. network) * @return array - * string 'label' => The type of the notification - * string 'link' => URL to the source - * string 'image' => The avatar image - * string 'url' => The profile url of the contact - * string 'text' => The notification text - * string 'when' => The date of the notification - * string 'ago' => T relative date of the notification - * bool 'seen' => Is the notification marked as "seen" + * string 'label' => The type of the notification + * string 'link' => URL to the source + * string 'image' => The avatar image + * string 'url' => The profile url of the contact + * string 'text' => The notification text + * string 'when' => The date of the notification + * string 'ago' => T relative date of the notification + * bool 'seen' => Is the notification marked as "seen" + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private function formatNotifs(array $notifs, $ident = "") { @@ -398,14 +403,15 @@ class NotificationsManager extends BaseObject /** * @brief Get network notifications * - * @param int|string $seen If 0 only include notifications into the query - * which aren't marked as "seen" - * @param int $start Start the query at this point - * @param int $limit Maximum number of query results + * @param int|string $seen If 0 only include notifications into the query + * which aren't marked as "seen" + * @param int $start Start the query at this point + * @param int $limit Maximum number of query results * * @return array with - * string 'ident' => Notification identifier - * array 'notifications' => Network notifications + * string 'ident' => Notification identifier + * array 'notifications' => Network notifications + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public function networkNotifs($seen = 0, $start = 0, $limit = 80) { @@ -439,14 +445,15 @@ class NotificationsManager extends BaseObject /** * @brief Get system notifications * - * @param int|string $seen If 0 only include notifications into the query - * which aren't marked as "seen" - * @param int $start Start the query at this point - * @param int $limit Maximum number of query results + * @param int|string $seen If 0 only include notifications into the query + * which aren't marked as "seen" + * @param int $start Start the query at this point + * @param int $limit Maximum number of query results * * @return array with - * string 'ident' => Notification identifier - * array 'notifications' => System notifications + * string 'ident' => Notification identifier + * array 'notifications' => System notifications + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public function systemNotifs($seen = 0, $start = 0, $limit = 80) { @@ -481,14 +488,15 @@ class NotificationsManager extends BaseObject /** * @brief Get personal notifications * - * @param int|string $seen If 0 only include notifications into the query - * which aren't marked as "seen" - * @param int $start Start the query at this point - * @param int $limit Maximum number of query results + * @param int|string $seen If 0 only include notifications into the query + * which aren't marked as "seen" + * @param int $start Start the query at this point + * @param int $limit Maximum number of query results * * @return array with - * string 'ident' => Notification identifier - * array 'notifications' => Personal notifications + * string 'ident' => Notification identifier + * array 'notifications' => Personal notifications + * @throws \Exception */ public function personalNotifs($seen = 0, $start = 0, $limit = 80) { @@ -526,14 +534,15 @@ class NotificationsManager extends BaseObject /** * @brief Get home notifications * - * @param int|string $seen If 0 only include notifications into the query - * which aren't marked as "seen" - * @param int $start Start the query at this point - * @param int $limit Maximum number of query results + * @param int|string $seen If 0 only include notifications into the query + * which aren't marked as "seen" + * @param int $start Start the query at this point + * @param int $limit Maximum number of query results * * @return array with - * string 'ident' => Notification identifier - * array 'notifications' => Home notifications + * string 'ident' => Notification identifier + * array 'notifications' => Home notifications + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public function homeNotifs($seen = 0, $start = 0, $limit = 80) { @@ -566,14 +575,16 @@ class NotificationsManager extends BaseObject /** * @brief Get introductions * - * @param bool $all If false only include introductions into the query - * which aren't marked as ignored - * @param int $start Start the query at this point - * @param int $limit Maximum number of query results + * @param bool $all If false only include introductions into the query + * which aren't marked as ignored + * @param int $start Start the query at this point + * @param int $limit Maximum number of query results * * @return array with - * string 'ident' => Notification identifier - * array 'notifications' => Introductions + * string 'ident' => Notification identifier + * array 'notifications' => Introductions + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public function introNotifs($all = false, $start = 0, $limit = 80) { @@ -620,6 +631,8 @@ class NotificationsManager extends BaseObject * * @param array $intros The array from the db query * @return array with the introductions + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private function formatIntros($intros) { @@ -703,6 +716,7 @@ class NotificationsManager extends BaseObject * @param array $arr The input array with the intro data * * @return array The array with the intro data + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private function getMissingIntroData($arr) { diff --git a/src/Core/PConfig.php b/src/Core/PConfig.php index 752d919199..a4e9fa389b 100644 --- a/src/Core/PConfig.php +++ b/src/Core/PConfig.php @@ -21,7 +21,7 @@ use Friendica\BaseObject; class PConfig extends BaseObject { /** - * @var Friendica\Core\Config\IPConfigAdapter + * @var \Friendica\Core\Config\IPConfigAdapter */ private static $adapter = null; @@ -51,6 +51,7 @@ class PConfig extends BaseObject * @param string $family The category of the configuration value * * @return void + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function load($uid, $family) { @@ -80,6 +81,7 @@ class PConfig extends BaseObject * @param boolean $refresh optional, If true the config is loaded from the db and not from the cache (default: false) * * @return mixed Stored value or null if it does not exist + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function get($uid, $family, $key, $default_value = null, $refresh = false) { @@ -101,7 +103,7 @@ class PConfig extends BaseObject * Stores a config value ($value) in the category ($family) under the key ($key) * for the user_id $uid. * - * @note Please do not store booleans - convert to 0/1 integer values! + * @note Please do not store booleans - convert to 0/1 integer values! * * @param string $uid The user_id * @param string $family The category of the configuration value @@ -109,6 +111,7 @@ class PConfig extends BaseObject * @param string $value The value to store * * @return bool Operation success + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function set($uid, $family, $key, $value) { @@ -135,6 +138,7 @@ class PConfig extends BaseObject * @param string $key The configuration key to delete * * @return mixed + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function delete($uid, $family, $key) { diff --git a/src/Core/Protocol.php b/src/Core/Protocol.php index 00552bf787..0038b505a5 100644 --- a/src/Core/Protocol.php +++ b/src/Core/Protocol.php @@ -50,7 +50,7 @@ class Protocol * * @param string $profile_url * @return string - * @throws Exception + * @throws \Exception */ public static function getAddrFromProfileUrl($profile_url) { @@ -69,8 +69,9 @@ class Protocol * Guesses the network from a profile URL * * @param string $profile_url - * @param array $matches preg_match return array: [0] => Full match [1] => hostname [2] => username - * @return type + * @param array $matches preg_match return array: [0] => Full match [1] => hostname [2] => username + * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function matchByProfileUrl($profile_url, &$matches = []) { @@ -131,6 +132,7 @@ class Protocol * @param string $profile_url * @param string $display_name * @return string + * @throws \Exception */ public static function formatMention($profile_url, $display_name) { diff --git a/src/Core/Renderer.php b/src/Core/Renderer.php index 29b1606349..c5cffea67d 100644 --- a/src/Core/Renderer.php +++ b/src/Core/Renderer.php @@ -56,6 +56,7 @@ class Renderer extends BaseObject * @param array $vars key value pairs (search => replace) * * @return string substituted string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function replaceMacros($s, $vars) { @@ -78,14 +79,15 @@ class Renderer extends BaseObject return $output; } - /** - * @brief Load a given template $s - * - * @param string $s Template to load. - * @param string $root Optional. - * - * @return string template. - */ + /** + * @brief Load a given template $s + * + * @param string $s Template to load. + * @param string $root Optional. + * + * @return string template. + * @throws Exception + */ public static function getMarkupTemplate($s, $root = '') { $stamp1 = microtime(true); diff --git a/src/Core/Session/CacheSessionHandler.php b/src/Core/Session/CacheSessionHandler.php index 08490818ce..c0a5896f42 100644 --- a/src/Core/Session/CacheSessionHandler.php +++ b/src/Core/Session/CacheSessionHandler.php @@ -45,6 +45,7 @@ class CacheSessionHandler extends BaseObject implements SessionHandlerInterface * @param string $session_id Session ID with format: [a-z0-9]{26} * @param string $session_data Serialized session data * @return boolean Returns false if parameters are missing, true otherwise + * @throws \Exception */ public function write($session_id, $session_data) { diff --git a/src/Core/Session/DatabaseSessionHandler.php b/src/Core/Session/DatabaseSessionHandler.php index 1c3da6eb3a..9bb1180ec1 100644 --- a/src/Core/Session/DatabaseSessionHandler.php +++ b/src/Core/Session/DatabaseSessionHandler.php @@ -46,6 +46,7 @@ class DatabaseSessionHandler extends BaseObject implements SessionHandlerInterfa * @param string $session_id Session ID with format: [a-z0-9]{26} * @param string $session_data Serialized session data * @return boolean Returns false if parameters are missing, true otherwise + * @throws \Exception */ public function write($session_id, $session_data) { diff --git a/src/Core/StorageManager.php b/src/Core/StorageManager.php index 43a72650cc..f46740ec63 100644 --- a/src/Core/StorageManager.php +++ b/src/Core/StorageManager.php @@ -33,6 +33,7 @@ class StorageManager /** * @brief Return current storage backend class * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function getBackend() { @@ -54,7 +55,8 @@ class StorageManager /** * @brief Set current storage backend class * - * @param string $class Backend class name + * @param string $class Backend class name + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function setBackend($class) { @@ -74,12 +76,12 @@ class StorageManager } - /** * @brief Register a storage backend class * - * @param string $name User readable backend name - * @param string $class Backend class name + * @param string $name User readable backend name + * @param string $class Backend class name + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function register($name, $class) { @@ -93,7 +95,8 @@ class StorageManager /** * @brief Unregister a storage backend class * - * @param string $name User readable backend name + * @param string $name User readable backend name + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function unregister($name) { @@ -112,7 +115,8 @@ class StorageManager * @param string $dest Destination storage class name * @param array $tables Tables to look in for resources. Optional, defaults to ['photo', 'attach'] * - * @retur int Number of moved resources + * @throws \Exception + * @return int Number of moved resources */ public static function move($dest, $tables = null) { diff --git a/src/Core/System.php b/src/Core/System.php index 14631b5e9d..44419ad179 100644 --- a/src/Core/System.php +++ b/src/Core/System.php @@ -27,6 +27,7 @@ class System extends BaseObject * * @param bool $ssl Whether to append http or https under SSL_POLICY_SELFSIGN * @return string Friendica server base URL + * @throws InternalServerErrorException */ public static function baseUrl($ssl = false) { @@ -39,6 +40,7 @@ class System extends BaseObject * @param string $orig_url The url to be cleaned * * @return string The cleaned url + * @throws \Exception */ public static function removedBaseUrl($orig_url) { @@ -92,6 +94,10 @@ class System extends BaseObject * Generic XML return * Outputs a basic dfrn XML status structure to STDOUT, with a variable * of $st and an optional text of $message and terminates the current process. + * + * @param $st + * @param string $message + * @throws \Exception */ public static function xmlExit($st, $message = '') { @@ -121,6 +127,7 @@ class System extends BaseObject * @param array $description optional message * 'title' => header title * 'description' => optional message + * @throws InternalServerErrorException */ public static function httpExit($val, $description = []) { @@ -191,8 +198,9 @@ class System extends BaseObject /** * Generates a random string in the UUID format * - * @param bool|string $prefix A given prefix (default is empty) + * @param bool|string $prefix A given prefix (default is empty) * @return string a generated UUID + * @throws \Exception */ public static function createUUID($prefix = '') { @@ -203,9 +211,10 @@ class System extends BaseObject /** * Generates a GUID with the given parameters * - * @param int $size The size of the GUID (default is 16) - * @param bool|string $prefix A given prefix (default is empty) + * @param int $size The size of the GUID (default is 16) + * @param bool|string $prefix A given prefix (default is empty) * @return string a generated GUID + * @throws \Exception */ public static function createGUID($size = 16, $prefix = '') { diff --git a/src/Core/Theme.php b/src/Core/Theme.php index de8cd496a4..4ceff23232 100644 --- a/src/Core/Theme.php +++ b/src/Core/Theme.php @@ -90,8 +90,9 @@ class Theme * * The screenshot is expected as view/theme/$theme/screenshot.[png|jpg]. * - * @param sring $theme The name of the theme + * @param string $theme The name of the theme * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function getScreenshot($theme) { @@ -148,6 +149,7 @@ class Theme * @param string $file Filename * @param string $root Full root path * @return string Path to the file or empty string if the file isn't found + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function getPathForFile($file, $root = '') { diff --git a/src/Core/Update.php b/src/Core/Update.php index 7b2624cb9c..368f5f55cc 100644 --- a/src/Core/Update.php +++ b/src/Core/Update.php @@ -15,6 +15,7 @@ class Update * @brief Function to check if the Database structure needs an update. * * @param boolean $via_worker boolean Is the check run via the worker? + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function check($via_worker) { @@ -45,11 +46,12 @@ class Update /** * Automatic database updates * - * @param bool $force Force the Update-Check even if the lock is set - * @param bool $verbose Run the Update-Check verbose + * @param bool $force Force the Update-Check even if the lock is set + * @param bool $verbose Run the Update-Check verbose * @param bool $sendMail Sends a Mail to the administrator in case of success/failure * * @return string Empty string if the update is successful, error messages otherwise + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function run($force = false, $verbose = false, $sendMail = true) { @@ -132,10 +134,11 @@ class Update /** * Executes a specific update function * - * @param int $x the DB version number of the function + * @param int $x the DB version number of the function * @param string $prefix the prefix of the function (update, pre_update) * * @return bool true, if the update function worked + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function runUpdateFunction($x, $prefix) { @@ -195,8 +198,9 @@ class Update /** * send the email and do what is needed to do on update fails * - * @param int $update_id number of failed update - * @param string $error_message error message + * @param int $update_id number of failed update + * @param string $error_message error message + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function updateFailed($update_id, $error_message) { //send the administrators an e-mail diff --git a/src/Core/UserImport.php b/src/Core/UserImport.php index 59ab7af4aa..6cefae556f 100644 --- a/src/Core/UserImport.php +++ b/src/Core/UserImport.php @@ -33,7 +33,8 @@ class UserImport * Remove columns from array $arr that aren't in table $table * * @param string $table Table name - * @param array &$arr Column=>Value array from json (by ref) + * @param array &$arr Column=>Value array from json (by ref) + * @throws \Exception */ private static function checkCols($table, &$arr) { @@ -57,7 +58,9 @@ class UserImport * Import data into table $table * * @param string $table Table name - * @param array $arr Column=>Value array from json + * @param array $arr Column=>Value array from json + * @return array|bool + * @throws \Exception */ private static function dbImportAssoc($table, $arr) { @@ -81,8 +84,10 @@ class UserImport /** * @brief Import account file exported from mod/uexport * - * @param App $a Friendica App Class + * @param App $a Friendica App Class * @param array $file array from $_FILES + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function importAccount(App $a, $file) { diff --git a/src/Core/Worker.php b/src/Core/Worker.php index aae3e85d08..00b22c7885 100644 --- a/src/Core/Worker.php +++ b/src/Core/Worker.php @@ -31,6 +31,7 @@ class Worker * * @param boolean $run_cron Should the cron processes be executed? * @return void + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function processQueue($run_cron = true) { @@ -148,6 +149,7 @@ class Worker * @brief Returns the number of deferred entries in the worker queue * * @return integer Number of deferred entries in the worker queue + * @throws \Exception */ private static function deferredEntries() { @@ -159,6 +161,7 @@ class Worker * @brief Returns the number of non executed entries in the worker queue * * @return integer Number of non executed entries in the worker queue + * @throws \Exception */ private static function totalEntries() { @@ -170,6 +173,7 @@ class Worker * @brief Returns the highest priority in the worker queue that isn't executed * * @return integer Number of active worker processes + * @throws \Exception */ private static function highestPriority() { @@ -188,6 +192,7 @@ class Worker * @param integer $priority The priority that should be checked * * @return integer Is there a process running with that priority? + * @throws \Exception */ private static function processWithPriorityActive($priority) { @@ -202,6 +207,7 @@ class Worker * @param array $queue Workerqueue entry * * @return boolean "true" if further processing should be stopped + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function execute($queue) { @@ -315,6 +321,7 @@ class Worker * @param array $argv Array of values to be passed to the function * @param boolean $method_call boolean * @return void + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function execFunction($queue, $funcname, $argv, $method_call) { @@ -481,6 +488,7 @@ class Worker * @brief Checks if the number of database connections has reached a critical limit. * * @return bool Are more than 3/4 of the maximum connections used? + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function maxConnectionsReached() { @@ -558,6 +566,7 @@ class Worker /** * @brief fix the queue entry if the worker process died * @return void + * @throws \Exception */ private static function killStaleWorkers() { @@ -622,6 +631,7 @@ class Worker * @brief Checks if the number of active workers exceeds the given limits * * @return bool Are there too much workers running? + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function tooMuchWorkers() { @@ -726,6 +736,7 @@ class Worker * @brief Returns the number of active worker processes * * @return integer Number of active worker processes + * @throws \Exception */ private static function activeWorkers() { @@ -740,6 +751,7 @@ class Worker * * @param string $highest_priority Returns the currently highest priority * @return bool We let pass a slower process than $highest_priority + * @throws \Exception */ private static function passingSlow(&$highest_priority) { @@ -792,6 +804,7 @@ class Worker * * @param boolean $passing_slow Returns if we had passed low priority processes * @return boolean Have we found something? + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function findWorkerProcesses(&$passing_slow) { @@ -886,6 +899,7 @@ class Worker * * @param boolean $passing_slow Returns if we had passed low priority processes * @return string SQL statement + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function workerProcess(&$passing_slow) { @@ -921,6 +935,7 @@ class Worker /** * @brief Removes a workerqueue entry from the current process * @return void + * @throws \Exception */ public static function unclaimProcess() { @@ -932,6 +947,7 @@ class Worker /** * @brief Call the front end worker * @return void + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function callWorker() { @@ -946,6 +962,7 @@ class Worker /** * @brief Call the front end worker if there aren't any active * @return void + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function executeIfIdle() { @@ -996,6 +1013,7 @@ class Worker /** * @brief Removes long running worker processes * @return void + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function clearProcesses() { @@ -1010,6 +1028,7 @@ class Worker /** * @brief Runs the cron processes * @return void + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function runCron() { @@ -1027,7 +1046,9 @@ class Worker /** * @brief Spawns a new worker + * @param bool $do_cron * @return void + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function spawnWorker($do_cron = false) { @@ -1052,12 +1073,13 @@ class Worker * or: Worker::add(PRIORITY_HIGH, "Notifier", "drop", $drop_id); * or: Worker::add(array('priority' => PRIORITY_HIGH, 'dont_fork' => true), "CreateShadowEntry", $post_id); * + * @return boolean "false" if proc_run couldn't be executed + * @throws \Friendica\Network\HTTPException\InternalServerErrorException * @note $cmd and string args are surrounded with "" * * @hooks 'proc_run' - * array $arr + * array $arr * - * @return boolean "false" if proc_run couldn't be executed */ public static function add($cmd) { @@ -1186,6 +1208,7 @@ class Worker * * @brief Remove the active process from the "process" table * @return bool + * @throws \Exception */ public static function endProcess() { @@ -1197,6 +1220,7 @@ class Worker * * @brief Set the flag if some job is waiting * @param boolean $jobs Is there a waiting job? + * @throws \Exception */ public static function IPCSetJobState($jobs) { @@ -1208,6 +1232,7 @@ class Worker * * @brief Checks if some worker job waits to be executed * @return bool + * @throws \Exception */ public static function IPCJobsExists() { diff --git a/src/Database/DBA.php b/src/Database/DBA.php index 6064e587a6..7838a99ef5 100644 --- a/src/Database/DBA.php +++ b/src/Database/DBA.php @@ -195,6 +195,7 @@ class DBA * @brief Returns the selected database name * * @return string + * @throws \Exception */ public static function databaseName() { $ret = self::p("SELECT DATABASE() AS `db`"); @@ -206,6 +207,7 @@ class DBA * @brief Analyze a database query and log this if some conditions are met. * * @param string $query The database query that will be analyzed + * @throws \Exception */ private static function logIndex($query) { $a = \get_app(); @@ -386,6 +388,7 @@ class DBA * * @param string $sql SQL statement * @return bool|object statement object or result object + * @throws \Exception */ public static function p($sql) { $a = \get_app(); @@ -604,6 +607,7 @@ class DBA * * @param string $sql SQL statement * @return boolean Was the query successfull? False is returned only if an error occurred + * @throws \Exception */ public static function e($sql) { $a = \get_app(); @@ -657,10 +661,11 @@ class DBA /** * @brief Check if data exists * - * @param string $table Table name - * @param array $condition array of fields for condition + * @param string $table Table name + * @param array $condition array of fields for condition * * @return boolean Are there rows for that condition? + * @throws \Exception */ public static function exists($table, $condition) { if (empty($table)) { @@ -700,6 +705,7 @@ class DBA * @brief Fetches the first row * @param string $sql SQL statement * @return array first row of query + * @throws \Exception */ public static function fetchFirst($sql) { $params = self::getParam(func_get_args()); @@ -825,11 +831,12 @@ class DBA /** * @brief Insert a row into a table * - * @param string $table Table name - * @param array $param parameter array - * @param bool $on_duplicate_update Do an update on a duplicate entry + * @param string $table Table name + * @param array $param parameter array + * @param bool $on_duplicate_update Do an update on a duplicate entry * * @return boolean was the insert successful? + * @throws \Exception */ public static function insert($table, $param, $on_duplicate_update = false) { @@ -876,6 +883,7 @@ class DBA * @param string $table Table name * * @return boolean was the lock successful? + * @throws \Exception */ public static function lock($table) { // See here: https://dev.mysql.com/doc/refman/5.7/en/lock-tables-and-transactions.html @@ -908,6 +916,7 @@ class DBA * @brief Unlocks all locked tables * * @return boolean was the unlock successful? + * @throws \Exception */ public static function unlock() { // See here: https://dev.mysql.com/doc/refman/5.7/en/lock-tables-and-transactions.html @@ -1037,14 +1046,15 @@ class DBA /** * @brief Delete a row from a table * - * @param string $table Table name - * @param array $conditions Field condition(s) - * @param array $options - * - cascade: If true we delete records in other tables that depend on the one we're deleting through + * @param string $table Table name + * @param array $conditions Field condition(s) + * @param array $options + * - cascade: If true we delete records in other tables that depend on the one we're deleting through * relations (default: true) - * @param array $callstack Internal use: prevent endless loops + * @param array $callstack Internal use: prevent endless loops * * @return boolean was the delete successful? + * @throws \Exception */ public static function delete($table, array $conditions, array $options = [], array &$callstack = []) { @@ -1203,12 +1213,13 @@ class DBA * Only set $old_fields to a boolean value when you are sure that you will update a single row. * When you set $old_fields to "true" then $fields must contain all relevant fields! * - * @param string $table Table name - * @param array $fields contains the fields that are updated - * @param array $condition condition array with the key values + * @param string $table Table name + * @param array $fields contains the fields that are updated + * @param array $condition condition array with the key values * @param array|boolean $old_fields array with the old field values that are about to be replaced (true = update on duplicate) * * @return boolean was the update successfull? + * @throws \Exception */ public static function update($table, $fields, $condition, $old_fields = []) { @@ -1270,7 +1281,8 @@ class DBA * @param array $condition * @param array $params * @return bool|array - * @see self::select + * @throws \Exception + * @see self::select */ public static function selectFirst($table, array $fields = [], array $condition = [], $params = []) { @@ -1307,6 +1319,7 @@ class DBA * $params = array("order" => array("id", "received" => true), "limit" => 10); * * $data = DBA::select($table, $fields, $condition, $params); + * @throws \Exception */ public static function select($table, array $fields = [], array $condition = [], array $params = []) { @@ -1336,8 +1349,8 @@ class DBA /** * @brief Counts the rows from a table satisfying the provided condition * - * @param string $table Table name - * @param array $condition array of fields for condition + * @param string $table Table name + * @param array $condition array of fields for condition * * @return int * @@ -1349,6 +1362,7 @@ class DBA * $condition = ["`uid` = ? AND `network` IN (?, ?)", 1, 'dfrn', 'dspr']; * * $count = DBA::count($table, $condition); + * @throws \Exception */ public static function count($table, array $condition = []) { @@ -1476,6 +1490,7 @@ class DBA * @brief Fills an array with data from a query * * @param object $stmt statement object + * @param bool $do_close * @return array Data array */ public static function toArray($stmt, $do_close = true) { @@ -1557,6 +1572,7 @@ class DBA * @return array * 'list' => List of processes, separated in their different states * 'amount' => Number of concurrent database processes + * @throws \Exception */ public static function processlist() { diff --git a/src/Database/DBStructure.php b/src/Database/DBStructure.php index 3043ae1322..39252beadf 100644 --- a/src/Database/DBStructure.php +++ b/src/Database/DBStructure.php @@ -251,6 +251,7 @@ class DBStructure * @param array $tables An array of the database tables * @param array $definition An array of the definition tables * @return string Empty string if the update is successful, error messages otherwise + * @throws Exception */ public static function update($verbose, $action, $install = false, array $tables = null, array $definition = null) { @@ -715,7 +716,7 @@ class DBStructure * @param int $type The type of renaming (Default is Column) * * @return boolean Was the renaming successful? - * + * @throws Exception */ public static function rename($table, $columns, $type = self::RENAME_COLUMN) { @@ -775,6 +776,7 @@ class DBStructure * @param array $columns Columns to check ( Syntax: [ $col1, $col2, .. ] ) * * @return boolean Does the table exist? + * @throws Exception */ public static function existsColumn($table, $columns = []) { @@ -815,6 +817,7 @@ class DBStructure * @param string $table Table name * * @return boolean Does the table exist? + * @throws Exception */ public static function existsTable($table) { diff --git a/src/Database/PostUpdate.php b/src/Database/PostUpdate.php index 9329e31cac..a5bdcdeadd 100644 --- a/src/Database/PostUpdate.php +++ b/src/Database/PostUpdate.php @@ -43,6 +43,7 @@ class PostUpdate * @brief Updates the "global" field in the item table * * @return bool "true" when the job is done + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function update1194() { @@ -113,6 +114,7 @@ class PostUpdate * This field avoids cost intensive calls in the admin panel and in "nodeinfo" * * @return bool "true" when the job is done + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function update1206() { @@ -145,6 +147,8 @@ class PostUpdate * @brief update the item related tables * * @return bool "true" when the job is done + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function update1279() { @@ -295,6 +299,7 @@ class PostUpdate * @brief update item-uri data. Prerequisite for the next item structure update. * * @return bool "true" when the job is done + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function update1281() { diff --git a/src/LegacyModule.php b/src/LegacyModule.php index 5ef2a0ee61..209dc8f3e1 100644 --- a/src/LegacyModule.php +++ b/src/LegacyModule.php @@ -22,6 +22,7 @@ class LegacyModule extends BaseModule * The only method that needs to be called, with the module/addon file name. * * @param string $file_path + * @throws \Exception */ public static function setModuleFile($file_path) { @@ -59,6 +60,7 @@ class LegacyModule extends BaseModule * * @param string $function_suffix * @return string + * @throws \Exception */ private static function runModuleFunction($function_suffix) { diff --git a/src/Model/APContact.php b/src/Model/APContact.php index 71f3cfae47..c606e3107e 100644 --- a/src/Model/APContact.php +++ b/src/Model/APContact.php @@ -23,6 +23,7 @@ class APContact extends BaseObject * * @param string $addr profile address (user@domain.tld) * @return string url + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function addrToUrl($addr) { @@ -63,6 +64,8 @@ class APContact extends BaseObject * @param string $url profile url * @param boolean $update true = always update, false = never update, null = update when not found or outdated * @return array profile array + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function getByURL($url, $update = null) { diff --git a/src/Model/Attach.php b/src/Model/Attach.php index 92c76d3d0a..c74209d6a1 100644 --- a/src/Model/Attach.php +++ b/src/Model/Attach.php @@ -25,6 +25,7 @@ class Attach extends BaseObject * @brief Return a list of fields that are associated with the attach table * * @return array field list + * @throws \Exception */ private static function getFields() { @@ -37,13 +38,14 @@ class Attach extends BaseObject /** * @brief Select rows from the attach table * - * @param array $fields Array of selected fields, empty for all - * @param array $conditions Array of fields for conditions - * @param array $params Array of several parameters + * @param array $fields Array of selected fields, empty for all + * @param array $conditions Array of fields for conditions + * @param array $params Array of several parameters * * @return boolean|array * - * @see \Friendica\Database\DBA::select + * @throws \Exception + * @see \Friendica\Database\DBA::select */ public static function select(array $fields = [], array $conditions = [], array $params = []) { @@ -58,13 +60,14 @@ class Attach extends BaseObject /** * @brief Retrieve a single record from the attach table * - * @param array $fields Array of selected fields, empty for all - * @param array $conditions Array of fields for conditions - * @param array $params Array of several parameters + * @param array $fields Array of selected fields, empty for all + * @param array $conditions Array of fields for conditions + * @param array $params Array of several parameters * * @return bool|array * - * @see \Friendica\Database\DBA::select + * @throws \Exception + * @see \Friendica\Database\DBA::select */ public static function selectFirst(array $fields = [], array $conditions = [], array $params = []) { @@ -78,9 +81,10 @@ class Attach extends BaseObject /** * @brief Check if attachment with given conditions exists * - * @param array $conditions Array of extra conditions + * @param array $conditions Array of extra conditions * * @return boolean + * @throws \Exception */ public static function exists(array $conditions) { @@ -89,12 +93,13 @@ class Attach extends BaseObject /** * @brief Retrive a single record given the ID - * - * @param int $id Row id of the record - * + * + * @param int $id Row id of the record + * * @return bool|array * - * @see \Friendica\Database\DBA::select + * @throws \Exception + * @see \Friendica\Database\DBA::select */ public static function getById($id) { @@ -102,13 +107,14 @@ class Attach extends BaseObject } /** - * @brief Retrive a single record given the ID - * - * @param int $id Row id of the record - * + * @brief Retrive a single record given the ID + * + * @param int $id Row id of the record + * * @return bool|array * - * @see \Friendica\Database\DBA::select + * @throws \Exception + * @see \Friendica\Database\DBA::select */ public static function getByIdWithPermission($id) { @@ -131,10 +137,11 @@ class Attach extends BaseObject /** * @brief Get file data for given row id. null if row id does not exist - * - * @param array $item Attachment data. Needs at least 'id', 'backend-class', 'backend-ref' - * + * + * @param array $item Attachment data. Needs at least 'id', 'backend-class', 'backend-ref' + * * @return string file data + * @throws \Exception */ public static function getData($item) { @@ -155,7 +162,7 @@ class Attach extends BaseObject /** * @brief Store new file metadata in db and binary in default backend * - * @param string $data Binary data + * @param string $data Binary data * @param integer $uid User ID * @param string $filename Filename * @param string $filetype Mimetype. optional, default = '' @@ -166,6 +173,7 @@ class Attach extends BaseObject * @param string $deny_gid Permissions, denied greoup.optional, default = '' * * @return boolean/integer Row id on success, False on errors + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public function store($data, $uid, $filename, $filetype = '' , $filesize = null, $allow_cid = '', $allow_gid = '', $deny_cid = '', $deny_gid = '') { @@ -214,7 +222,15 @@ class Attach extends BaseObject /** * @brief Store new file metadata in db and binary in default backend from existing file * + * @param $src + * @param $uid + * @param string $filename + * @param string $allow_cid + * @param string $allow_gid + * @param string $deny_cid + * @param string $deny_gid * @return boolean True on success + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public function storeFile($src, $uid, $filename = '', $allow_cid = '', $allow_gid = '', $deny_cid = '', $deny_gid = '') { @@ -233,12 +249,13 @@ class Attach extends BaseObject * * @param array $fields Contains the fields that are updated * @param array $conditions Condition array with the key values - * @param string $data File data to update. Optional, default null. + * @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) * - * @return boolean Was the update successfull? + * @return boolean Was the update successful? * - * @see \Friendica\Database\DBA::update + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @see \Friendica\Database\DBA::update */ public static function update($fields, $conditions, $img = null, array $old_fields = []) { @@ -265,12 +282,13 @@ class Attach extends BaseObject /** * @brief Delete info from table and data from storage * - * @param array $conditions Field condition(s) - * @param array $options Options array, Optional + * @param array $conditions Field condition(s) + * @param array $options Options array, Optional * * @return boolean * - * @see \Friendica\Database\DBA::delete + * @throws \Exception + * @see \Friendica\Database\DBA::delete */ public static function delete(array $conditions, array $options = []) { diff --git a/src/Model/Contact.php b/src/Model/Contact.php index 3c9071b9fe..ea4a006ef9 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -32,7 +32,7 @@ use Friendica\Util\Strings; class Contact extends BaseObject { /** - * @name page/profile types + * Page/profile types * * PAGE_NORMAL is a typical personal profile account * PAGE_SOAPBOX automatically approves all friend requests as Contact::SHARING, (readonly) @@ -81,7 +81,7 @@ class Contact extends BaseObject */ /** - * @name Contact_is + * Contact_is * * Relationship types * @{ @@ -100,6 +100,8 @@ class Contact extends BaseObject * @param int $uid User ID * * @return boolean is the contact id a follower? + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function isFollower($cid, $uid) { @@ -118,11 +120,13 @@ class Contact extends BaseObject /** * @brief Get the basepath for a given contact link - * @todo Add functionality to store this value in the contact table + * @todo Add functionality to store this value in the contact table * * @param string $url The contact link * * @return string basepath + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function getBasepath($url) { @@ -142,6 +146,8 @@ class Contact extends BaseObject * @param int $uid User ID * * @return array with public and user's contact id + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function getPublicAndUserContacID($cid, $uid) { @@ -179,6 +185,7 @@ class Contact extends BaseObject * @param int $cid Either public contact id or user's contact id * @param int $uid User ID * @param boolean $blocked Is the contact blocked or unblocked? + * @throws \Exception */ public static function setBlockedForUser($cid, $uid, $blocked) { @@ -201,6 +208,7 @@ class Contact extends BaseObject * @param int $uid User ID * * @return boolean is the contact id blocked for the given user? + * @throws \Exception */ public static function isBlockedByUser($cid, $uid) { @@ -240,6 +248,7 @@ class Contact extends BaseObject * @param int $cid Either public contact id or user's contact id * @param int $uid User ID * @param boolean $ignored Is the contact ignored or unignored? + * @throws \Exception */ public static function setIgnoredForUser($cid, $uid, $ignored) { @@ -262,6 +271,7 @@ class Contact extends BaseObject * @param int $uid User ID * * @return boolean is the contact id ignored for the given user? + * @throws \Exception */ public static function isIgnoredByUser($cid, $uid) { @@ -301,6 +311,7 @@ class Contact extends BaseObject * @param int $cid Either public contact id or user's contact id * @param int $uid User ID * @param boolean $collapsed are the contact's posts collapsed or uncollapsed? + * @throws \Exception */ public static function setCollapsedForUser($cid, $uid, $collapsed) { @@ -319,6 +330,8 @@ class Contact extends BaseObject * @param int $uid User ID * * @return boolean is the contact id blocked for the given user? + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function isCollapsedByUser($cid, $uid) { @@ -344,6 +357,7 @@ class Contact extends BaseObject * * @param int $gid * @return array + * @throws \Exception */ public static function getByGroupId($gid) { @@ -378,6 +392,7 @@ class Contact extends BaseObject * * @param int $gid * @return int + * @throws \Exception */ public static function getOStatusCountByGroupId($gid) { @@ -406,6 +421,7 @@ class Contact extends BaseObject * * @param int $uid * @return bool Operation success + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function createSelfFromUserId($uid) { @@ -450,8 +466,9 @@ class Contact extends BaseObject /** * Updates the self-contact for the provided user id * - * @param int $uid + * @param int $uid * @param boolean $update_avatar Force the avatar update + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function updateSelfFromUserID($uid, $update_avatar = false) { @@ -552,6 +569,7 @@ class Contact extends BaseObject * * @param int $id contact id * @return null + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function remove($id) { @@ -575,6 +593,8 @@ class Contact extends BaseObject * @param array $contact Contact unfriended * @param boolean $dissolve Remove the contact on the remote side * @return void + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function terminateFriendship(array $user, array $contact, $dissolve = false) { @@ -620,6 +640,7 @@ class Contact extends BaseObject * * @param array $contact contact to mark for archival * @return null + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function markForArchival(array $contact) { @@ -668,10 +689,11 @@ class Contact extends BaseObject /** * @brief Cancels the archival countdown * - * @see Contact::markForArchival() + * @see Contact::markForArchival() * * @param array $contact contact to be unmarked for archival * @return null + * @throws \Exception */ public static function unmarkForArchival(array $contact) { @@ -715,6 +737,7 @@ class Contact extends BaseObject * @param array $default If not data was found take this data as default value * * @return array Contact data + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function getDetailsByURL($url, $uid = -1, array $default = []) { @@ -857,6 +880,8 @@ class Contact extends BaseObject * @param int $uid User id * * @return array Contact data + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function getDetailsByAddr($addr, $uid = -1) { @@ -912,6 +937,8 @@ class Contact extends BaseObject * @param array $contact contact * @param int $uid optional, default 0 * @return array + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function photoMenu(array $contact, $uid = 0) { @@ -1025,10 +1052,7 @@ class Contact extends BaseObject * Returns either the total number of ungrouped contacts for the given user * id or a paginated list of ungrouped contacts. * - * @param int $uid uid - * @param int $start optional, default 0 - * @param int $count optional, default 0 - * + * @param int $uid uid * @return array */ public static function getUngroupedList($uid) @@ -1073,6 +1097,8 @@ class Contact extends BaseObject * @param boolean $in_loop Internally used variable to prevent an endless loop * * @return integer Contact ID + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function getIdForURL($url, $uid = 0, $no_update = false, $default = [], $in_loop = false) { @@ -1330,6 +1356,7 @@ class Contact extends BaseObject * @param int $cid contact id * * @return boolean Is the contact blocked? + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function isBlocked($cid) { @@ -1355,6 +1382,7 @@ class Contact extends BaseObject * @param int $cid contact id * * @return boolean Is the contact hidden? + * @throws \Exception */ public static function isHidden($cid) { @@ -1374,7 +1402,10 @@ class Contact extends BaseObject * * @param string $contact_url Contact URL * + * @param bool $thread_mode + * @param int $update * @return string posts in HTML + * @throws \Exception */ public static function getPostsFromUrl($contact_url, $thread_mode = false, $update = 0) { @@ -1489,6 +1520,7 @@ class Contact extends BaseObject * * @param int $uid * @return bool + * @throws \Exception */ public static function block($uid) { @@ -1502,6 +1534,7 @@ class Contact extends BaseObject * * @param int $uid * @return bool + * @throws \Exception */ public static function unblock($uid) { @@ -1519,6 +1552,8 @@ class Contact extends BaseObject * @param bool $force force picture update * * @return array Returns array of the different avatar sizes + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function updateAvatar($avatar, $uid, $cid, $force = false) { @@ -1558,6 +1593,8 @@ class Contact extends BaseObject * @param integer $id contact id * @param string $network Optional network we are probing for * @return boolean + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function updateFromProbe($id, $network = '') { @@ -1633,7 +1670,9 @@ class Contact extends BaseObject * @param string $url * @param bool $interactive * @param string $network - * @return boolean|string + * @return array + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function createFromProbe($uid, $url, $interactive = false, $network = '') { @@ -1848,10 +1887,11 @@ class Contact extends BaseObject /** * @brief Updated contact's SSL policy * - * @param array $contact Contact array + * @param array $contact Contact array * @param string $new_policy New policy, valid: self,full * * @return array Contact array with updated values + * @throws \Exception */ public static function updateSslPolicy(array $contact, $new_policy) { @@ -2055,6 +2095,7 @@ class Contact extends BaseObject * Remove the unavailable contact ids from the provided list * * @param array $contact_ids Contact id list + * @throws \Exception */ public static function pruneUnavailable(array &$contact_ids) { @@ -2079,12 +2120,14 @@ class Contact extends BaseObject /** * @brief Returns a magic link to authenticate remote visitors * - * @todo check if the return is either a fully qualified URL or a relative path to Friendica basedir + * @todo check if the return is either a fully qualified URL or a relative path to Friendica basedir * * @param string $contact_url The address of the target contact profile - * @param string $url An url that we will be redirected to after the authentication + * @param string $url An url that we will be redirected to after the authentication * * @return string with "redir" link + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function magicLink($contact_url, $url = '') { @@ -2104,9 +2147,11 @@ class Contact extends BaseObject * @brief Returns a magic link to authenticate remote visitors * * @param integer $cid The contact id of the target contact profile - * @param integer $url An url that we will be redirected to after the authentication + * @param string $url An url that we will be redirected to after the authentication * * @return string with "redir" link + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function magicLinkbyId($cid, $url = '') { @@ -2118,10 +2163,12 @@ class Contact extends BaseObject /** * @brief Returns a magic link to authenticate remote visitors * - * @param array $contact The contact array with "uid", "network" and "url" - * @param string $url An url that we will be redirected to after the authentication + * @param array $contact The contact array with "uid", "network" and "url" + * @param string $url An url that we will be redirected to after the authentication * * @return string with "redir" link + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function magicLinkbyContact($contact, $url = '') { diff --git a/src/Model/Conversation.php b/src/Model/Conversation.php index b8e55e5b96..90c70a9be5 100644 --- a/src/Model/Conversation.php +++ b/src/Model/Conversation.php @@ -35,6 +35,7 @@ class Conversation * * @param array $arr Item array with conversation data * @return array Item array with removed conversation data + * @throws \Exception */ public static function insert(array $arr) { diff --git a/src/Model/Event.php b/src/Model/Event.php index 5f0238aad2..e7509c48e1 100644 --- a/src/Model/Event.php +++ b/src/Model/Event.php @@ -148,6 +148,7 @@ class Event extends BaseObject * @brief Extract bbcode formatted event data from a string. * * @params: string $s The string which should be parsed for event data. + * @param $text * @return array The array with the event information. */ public static function fromBBCode($text) @@ -215,6 +216,7 @@ class Event extends BaseObject * * @param int $event_id Event ID. * @return void + * @throws \Exception */ public static function delete($event_id) { @@ -233,6 +235,7 @@ class Event extends BaseObject * * @param array $arr Array with event data. * @return int The new event id. + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function store($arr) { @@ -371,6 +374,7 @@ class Event extends BaseObject * @brief Create an array with translation strings used for events. * * @return array Array with translations strings. + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function getStrings() { @@ -546,6 +550,8 @@ class Event extends BaseObject * * @param array $event_result Event query array. * @return array Event array for the template. + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function prepareListForTemplate(array $event_result) { @@ -629,7 +635,6 @@ class Event extends BaseObject * * @param array $events Query result for events. * @param string $format The output format (ical/csv). - * @param string $timezone The timezone of the user (not implemented yet). * * @return string Content according to selected export format. * @@ -741,6 +746,7 @@ class Event extends BaseObject * @param int $uid The user ID. * * @return array Query results. + * @throws \Exception */ private static function getListByUserId($uid = 0) { @@ -771,14 +777,15 @@ class Event extends BaseObject /** * - * @param int $uid The user ID. + * @param int $uid The user ID. * @param string $format Output format (ical/csv). * @return array With the results: - * bool 'success' => True if the processing was successful,
- * string 'format' => The output format,
- * string 'extension' => The file extension of the output format,
- * string 'content' => The formatted output content.
+ * bool 'success' => True if the processing was successful,
+ * string 'format' => The output format,
+ * string 'extension' => The file extension of the output format,
+ * string 'content' => The formatted output content.
* + * @throws \Exception * @todo Respect authenticated users with events_by_uid(). */ public static function exportListByUserId($uid, $format = 'ical') @@ -831,6 +838,8 @@ class Event extends BaseObject * * @param array $item Array with item and event data. * @return string HTML output. + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function getItemHTML(array $item) { $same_date = false; @@ -989,6 +998,7 @@ class Event extends BaseObject * @param array $contact Contact array, expects: id, uid, url, name * @param string $birthday Birthday of the contact * @return bool + * @throws \Exception */ public static function createBirthday($contact, $birthday) { diff --git a/src/Model/FileTag.php b/src/Model/FileTag.php index 4ba4e3ca7c..aba819c287 100644 --- a/src/Model/FileTag.php +++ b/src/Model/FileTag.php @@ -134,16 +134,17 @@ class FileTag return $list; } - /** - * @brief Update file tags in PConfig - * - * @param int $uid Unique Identity. - * @param string $file_old Categories previously associated with an item - * @param string $file_new New list of categories for an item - * @param string $type Optional file type. - * - * @return boolean A value indicating success or failure. - */ + /** + * @brief Update file tags in PConfig + * + * @param int $uid Unique Identity. + * @param string $file_old Categories previously associated with an item + * @param string $file_new New list of categories for an item + * @param string $type Optional file type. + * + * @return boolean A value indicating success or failure. + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + */ public static function updatePconfig($uid, $file_old, $file_new, $type = 'file') { if (!intval($uid)) { @@ -220,15 +221,16 @@ class FileTag return true; } - /** - * @brief Add tag to file - * - * @param int $uid Unique identity. - * @param int $item_id Item identity. - * @param string $file File tag. - * - * @return boolean A value indicating success or failure. - */ + /** + * @brief Add tag to file + * + * @param int $uid Unique identity. + * @param int $item_id Item identity. + * @param string $file File tag. + * + * @return boolean A value indicating success or failure. + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + */ public static function saveFile($uid, $item_id, $file) { if (!intval($uid)) @@ -258,16 +260,17 @@ class FileTag return true; } - /** - * @brief Remove tag from file - * - * @param int $uid Unique identity. - * @param int $item_id Item identity. - * @param string $file File tag. - * @param boolean $cat Optional value indicating the term type (i.e. Category or File) - * - * @return boolean A value indicating success or failure. - */ + /** + * @brief Remove tag from file + * + * @param int $uid Unique identity. + * @param int $item_id Item identity. + * @param string $file File tag. + * @param boolean $cat Optional value indicating the term type (i.e. Category or File) + * + * @return boolean A value indicating success or failure. + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + */ public static function unsaveFile($uid, $item_id, $file, $cat = false) { if (!intval($uid)) diff --git a/src/Model/GContact.php b/src/Model/GContact.php index 337a938a74..651019e801 100644 --- a/src/Model/GContact.php +++ b/src/Model/GContact.php @@ -31,6 +31,7 @@ class GContact * @param string $mode Search mode (e.g. "community") * * @return array with search results + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function searchByName($search, $mode = '') { @@ -91,6 +92,7 @@ class GContact * @param integer $cid Contact ID * @param integer $zcid Global Contact ID * @return void + * @throws Exception */ public static function link($gcid, $uid = 0, $cid = 0, $zcid = 0) { @@ -105,16 +107,16 @@ class GContact /** * @brief Sanitize the given gcontact data * - * @param array $gcontact array with gcontact data - * @throw Exception - * * Generation: * 0: No definition * 1: Profiles on this server * 2: Contacts of profiles on this server * 3: Contacts of contacts of profiles on this server * 4: ... + * + * @param array $gcontact array with gcontact data * @return array $gcontact + * @throws Exception */ public static function sanitize($gcontact) { @@ -412,6 +414,7 @@ class GContact * @param integer $start optional, default 0 * @param integer $limit optional, default 80 * @return array + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function suggestionQuery($uid, $start = 0, $limit = 80) { @@ -515,6 +518,7 @@ class GContact /** * @return void + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function updateSuggestions() { @@ -568,6 +572,7 @@ class GContact * @param string $url Contact url * * @return string Contact url with the wanted parts + * @throws Exception */ public static function cleanContactUrl($url) { @@ -599,6 +604,8 @@ class GContact * * @param array $contact contact array (called by reference) * @return void + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function fixAlternateContactAddress(&$contact) { @@ -620,6 +627,8 @@ class GContact * @param array $contact contact array * * @return bool|int Returns false if not found, integer if contact was found + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function getId($contact) { @@ -715,6 +724,8 @@ class GContact * @param array $contact contact array * * @return bool|int Returns false if not found, integer if contact was found + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function update($contact) { @@ -879,6 +890,8 @@ class GContact * * @param string $url profile link * @return void + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function updateFromProbe($url) { @@ -898,7 +911,9 @@ class GContact * @brief Update the gcontact entry for a given user id * * @param int $uid User ID - * @return void + * @return bool + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function updateForUser($uid) { @@ -949,7 +964,9 @@ class GContact * If the "Statistics" addon is enabled (See http://gstools.org/ for details) we query user data with this. * * @param string $server Server address - * @return void + * @return bool + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function fetchGsUsers($server) { @@ -1009,6 +1026,8 @@ class GContact /** * @brief Asking GNU Social server on a regular base for their user data * @return void + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function discoverGsUsers() { diff --git a/src/Model/Group.php b/src/Model/Group.php index 8981e2c647..1660126e78 100644 --- a/src/Model/Group.php +++ b/src/Model/Group.php @@ -22,9 +22,10 @@ class Group extends BaseObject * * Note: If we found a deleted group with the same name, we restore it * - * @param int $uid + * @param int $uid * @param string $name * @return boolean + * @throws \Exception */ public static function create($uid, $name) { @@ -56,10 +57,11 @@ class Group extends BaseObject /** * Update group information. * - * @param int $id Group ID + * @param int $id Group ID * @param string $name Group name * * @return bool Was the update successful? + * @throws \Exception */ public static function update($id, $name) { @@ -71,6 +73,7 @@ class Group extends BaseObject * * @param int $cid * @return array + * @throws \Exception */ public static function getIdsByContactId($cid) { @@ -92,9 +95,10 @@ class Group extends BaseObject * Count unread items of each groups of the local user * * @return array - * 'id' => group id - * 'name' => group name - * 'count' => counted unseen group items + * 'id' => group id + * 'name' => group name + * 'count' => counted unseen group items + * @throws \Exception */ public static function countUnseen() { @@ -121,9 +125,10 @@ class Group extends BaseObject * * Returns false if no group has been found. * - * @param int $uid + * @param int $uid * @param string $name * @return int|boolean + * @throws \Exception */ public static function getIdByName($uid, $name) { @@ -144,6 +149,7 @@ class Group extends BaseObject * * @param int $gid * @return boolean + * @throws \Exception */ public static function remove($gid) { if (! $gid) { @@ -188,13 +194,14 @@ class Group extends BaseObject } /** - * @brief Mark a group as deleted based on its name + * @brief Mark a group as deleted based on its name * * @deprecated Use Group::remove instead * - * @param int $uid + * @param int $uid * @param string $name * @return bool + * @throws \Exception */ public static function removeByName($uid, $name) { $return = false; @@ -213,6 +220,7 @@ class Group extends BaseObject * @param int $gid * @param int $cid * @return boolean + * @throws \Exception */ public static function addMember($gid, $cid) { @@ -237,6 +245,7 @@ class Group extends BaseObject * @param int $gid * @param int $cid * @return boolean + * @throws \Exception */ public static function removeMember($gid, $cid) { @@ -250,14 +259,15 @@ class Group extends BaseObject } /** - * @brief Removes a contact from a group based on its name + * @brief Removes a contact from a group based on its name * * @deprecated Use Group::removeMember instead * - * @param int $uid + * @param int $uid * @param string $name - * @param int $cid + * @param int $cid * @return boolean + * @throws \Exception */ public static function removeMemberByName($uid, $name, $cid) { @@ -271,9 +281,10 @@ class Group extends BaseObject /** * @brief Returns the combined list of contact ids from a group id list * - * @param array $group_ids + * @param array $group_ids * @param boolean $check_dead * @return array + * @throws \Exception */ public static function expand($group_ids, $check_dead = false) { @@ -298,10 +309,11 @@ class Group extends BaseObject /** * @brief Returns a templated group selection list * - * @param int $uid - * @param int $gid An optional pre-selected group + * @param int $uid + * @param int $gid An optional pre-selected group * @param string $label An optional label of the list * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function displayGroupSelection($uid, $gid = 0, $label = '') { @@ -342,12 +354,13 @@ class Group extends BaseObject * @param string $every * @param string $each * @param string $editmode - * 'standard' => include link 'Edit groups' - * 'extended' => include link 'Create new group' - * 'full' => include link 'Create new group' and provide for each group a link to edit this group - * @param int $group_id - * @param int $cid + * 'standard' => include link 'Edit groups' + * 'extended' => include link 'Create new group' + * 'full' => include link 'Create new group' and provide for each group a link to edit this group + * @param string $group_id + * @param int $cid * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function sidebarWidget($every = 'contact', $each = 'group', $editmode = 'standard', $group_id = '', $cid = 0) { diff --git a/src/Model/Item.php b/src/Model/Item.php index b71db999d0..6c071bfc7f 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -263,6 +263,7 @@ class Item extends BaseObject * @brief Fills an array with data from an item query * * @param object $stmt statement object + * @param bool $do_close * @return array Data array */ public static function inArray($stmt, $do_close = true) { @@ -286,6 +287,7 @@ class Item extends BaseObject * @param array $condition array of fields for condition * * @return boolean Are there rows for that condition? + * @throws \Exception */ public static function exists($condition) { $stmt = self::select(['id'], $condition, ['limit' => 1]); @@ -306,11 +308,12 @@ class Item extends BaseObject * * @brief Retrieve a single record from a table * @param integer $uid User ID - * @param array $fields - * @param array $condition - * @param array $params + * @param array $selected + * @param array $condition + * @param array $params * @return bool|array - * @see DBA::select + * @throws \Exception + * @see DBA::select */ public static function selectFirstForUser($uid, array $selected = [], array $condition = [], $params = []) { @@ -326,12 +329,13 @@ class Item extends BaseObject /** * @brief Select rows from the item table for a given user * - * @param integer $uid User ID - * @param array $selected Array of selected fields, empty for all - * @param array $condition Array of fields for condition - * @param array $params Array of several parameters + * @param integer $uid User ID + * @param array $selected Array of selected fields, empty for all + * @param array $condition Array of fields for condition + * @param array $params Array of several parameters * * @return boolean|object + * @throws \Exception */ public static function selectForUser($uid, array $selected = [], array $condition = [], $params = []) { @@ -348,11 +352,12 @@ class Item extends BaseObject * Retrieve a single record from the item table and returns it in an associative array * * @brief Retrieve a single record from a table - * @param array $fields - * @param array $condition - * @param array $params + * @param array $fields + * @param array $condition + * @param array $params * @return bool|array - * @see DBA::select + * @throws \Exception + * @see DBA::select */ public static function selectFirst(array $fields = [], array $condition = [], $params = []) { @@ -372,11 +377,12 @@ class Item extends BaseObject /** * @brief Select rows from the item table * - * @param array $selected Array of selected fields, empty for all - * @param array $condition Array of fields for condition - * @param array $params Array of several parameters + * @param array $selected Array of selected fields, empty for all + * @param array $condition Array of fields for condition + * @param array $params Array of several parameters * * @return boolean|object + * @throws \Exception */ public static function select(array $selected = [], array $condition = [], $params = []) { @@ -412,12 +418,13 @@ class Item extends BaseObject /** * @brief Select rows from the starting post in the item table * - * @param integer $uid User ID - * @param array $fields Array of selected fields, empty for all - * @param array $condition Array of fields for condition - * @param array $params Array of several parameters + * @param integer $uid User ID + * @param array $selected + * @param array $condition Array of fields for condition + * @param array $params Array of several parameters * * @return boolean|object + * @throws \Exception */ public static function selectThreadForUser($uid, array $selected = [], array $condition = [], $params = []) { @@ -435,11 +442,12 @@ class Item extends BaseObject * * @brief Retrieve a single record from a table * @param integer $uid User ID - * @param array $selected - * @param array $condition - * @param array $params + * @param array $selected + * @param array $condition + * @param array $params * @return bool|array - * @see DBA::select + * @throws \Exception + * @see DBA::select */ public static function selectFirstThreadForUser($uid, array $selected = [], array $condition = [], $params = []) { @@ -456,11 +464,12 @@ class Item extends BaseObject * Retrieve a single record from the starting post in the item table and returns it in an associative array * * @brief Retrieve a single record from a table - * @param array $fields - * @param array $condition - * @param array $params + * @param array $fields + * @param array $condition + * @param array $params * @return bool|array - * @see DBA::select + * @throws \Exception + * @see DBA::select */ public static function selectFirstThread(array $fields = [], array $condition = [], $params = []) { @@ -479,11 +488,12 @@ class Item extends BaseObject /** * @brief Select rows from the starting post in the item table * - * @param array $selected Array of selected fields, empty for all - * @param array $condition Array of fields for condition - * @param array $params Array of several parameters + * @param array $selected Array of selected fields, empty for all + * @param array $condition Array of fields for condition + * @param array $params Array of several parameters * * @return boolean|object + * @throws \Exception */ public static function selectThread(array $selected = [], array $condition = [], $params = []) { @@ -529,6 +539,7 @@ class Item extends BaseObject /** * @brief Returns a list of fields that are associated with the item table * + * @param $usermode * @return array field list */ private static function fieldlist($usermode) @@ -611,10 +622,11 @@ class Item extends BaseObject /** * @brief Returns all needed "JOIN" commands for the "select" functions * - * @param integer $uid User ID - * @param string $sql_commands The parts of the built SQL commands in the "select" functions - * @param boolean $thread_mode Called for the items (false) or for the threads (true) + * @param integer $uid User ID + * @param string $sql_commands The parts of the built SQL commands in the "select" functions + * @param boolean $thread_mode Called for the items (false) or for the threads (true) * + * @param $user_mode * @return string The SQL joins for the "select" functions */ private static function constructJoins($uid, $sql_commands, $thread_mode, $user_mode) @@ -777,7 +789,7 @@ class Item extends BaseObject /** * @brief Update existing item entries * - * @param array $fields The fields that are to be changed + * @param array $fields The fields that are to be changed * @param array $condition The condition for finding the item entries * * In the future we may have to change permissions as well. @@ -786,6 +798,7 @@ class Item extends BaseObject * A return value of "0" doesn't mean an error - but that 0 rows had been changed. * * @return integer|boolean number of affected rows - or "false" if there was an error + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function update(array $fields, array $condition) { @@ -932,8 +945,9 @@ class Item extends BaseObject /** * @brief Delete an item and notify others about it - if it was ours * - * @param array $condition The condition for finding the item entries - * @param integer $priority Priority for the notification + * @param array $condition The condition for finding the item entries + * @param integer $priority Priority for the notification + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function delete($condition, $priority = PRIORITY_HIGH) { @@ -947,8 +961,9 @@ class Item extends BaseObject /** * @brief Delete an item for an user and notify others about it - if it was ours * - * @param array $condition The condition for finding the item entries - * @param integer $uid User who wants to delete this item + * @param array $condition The condition for finding the item entries + * @param integer $uid User who wants to delete this item + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function deleteForUser($condition, $uid) { @@ -973,10 +988,11 @@ class Item extends BaseObject /** * @brief Delete an item and notify others about it - if it was ours * - * @param integer $item_id Item ID that should be delete + * @param integer $item_id Item ID that should be delete * @param integer $priority Priority for the notification * * @return boolean success + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function deleteById($item_id, $priority = PRIORITY_HIGH) { @@ -1850,6 +1866,7 @@ class Item extends BaseObject * * @param array $item The item fields that are to be inserted * @return bool + * @throws \Exception */ private static function insertActivity(&$item) { @@ -1896,6 +1913,7 @@ class Item extends BaseObject * @brief Insert a new item content entry * * @param array $item The item fields that are to be inserted + * @throws \Exception */ private static function insertContent(&$item) { @@ -1934,8 +1952,10 @@ class Item extends BaseObject /** * @brief Update existing item content entries * - * @param array $item The item fields that are to be changed + * @param array $item The item fields that are to be changed * @param array $condition The condition for finding the item content entries + * @return bool + * @throws \Exception */ private static function updateActivity($item, $condition) { @@ -1960,8 +1980,9 @@ class Item extends BaseObject /** * @brief Update existing item content entries * - * @param array $item The item fields that are to be changed + * @param array $item The item fields that are to be changed * @param array $condition The condition for finding the item content entries + * @throws \Exception */ private static function updateContent($item, $condition) { @@ -1989,6 +2010,7 @@ class Item extends BaseObject * * @param integer $itemid Item ID that should be added * @param string $signed_text Original text (for Diaspora signatures), JSON encoded. + * @throws \Exception */ public static function distribute($itemid, $signed_text = '') { @@ -2085,6 +2107,7 @@ class Item extends BaseObject * @param integer $itemid Item ID that should be added * @param array $item The item entry that will be stored * @param integer $uid The user that will receive the item entry + * @throws \Exception */ private static function storeForUser($itemid, $item, $uid) { @@ -2132,6 +2155,7 @@ class Item extends BaseObject * It is planned that in the future we will store public item entries only once. * * @param integer $itemid Item ID that should be added + * @throws \Exception */ public static function addShadow($itemid) { @@ -2193,6 +2217,7 @@ class Item extends BaseObject * This function does the same like the function above - but for comments * * @param integer $itemid Item ID that should be added + * @throws \Exception */ public static function addShadowPost($itemid) { @@ -2249,9 +2274,12 @@ class Item extends BaseObject } } - /** + /** * Adds a language specification in a "language" element of given $arr. * Expects "body" element to exist in $arr. + * + * @param $item + * @throws \Text_LanguageDetect_Exception */ private static function addLanguageToItemArray(&$item) { @@ -2297,10 +2325,11 @@ class Item extends BaseObject /** * generate an unique URI * - * @param integer $uid User id - * @param string $guid An existing GUID (Otherwise it will be generated) + * @param integer $uid User id + * @param string $guid An existing GUID (Otherwise it will be generated) * * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function newURI($uid, $guid = "") { @@ -2319,6 +2348,7 @@ class Item extends BaseObject * Don't set this value if it isn't from the owner (could be an author that we don't know) * * @param array $arr Contains the just posted item record + * @throws \Exception */ private static function updateContact($arr) { @@ -2439,9 +2469,11 @@ class Item extends BaseObject /** * This function is only used for the old Friendica app on Android that doesn't like paths with guid + * * @param string $guid item guid * @param int $uid user id * @return array with id and nick of the item with the given guid + * @throws \Exception */ public static function getIdAndNickByGuid($guid, $uid = 0) { @@ -2483,9 +2515,12 @@ class Item extends BaseObject /** * look for mention tags and setup a second delivery chain for forum/community posts if appropriate + * * @param int $uid * @param int $item_id - * @return bool true if item was deleted, else false + * @return void true if item was deleted, else false + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function tagDeliver($uid, $item_id) { @@ -2671,6 +2706,8 @@ class Item extends BaseObject * @param array $item * @param int $cid * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function fixPrivatePhotos($s, $uid, $item = null, $cid = 0) { @@ -2928,12 +2965,15 @@ class Item extends BaseObject * * @param string $item_id * @param string $verb - * Activity verb. One of - * like, unlike, dislike, undislike, attendyes, unattendyes, - * attendno, unattendno, attendmaybe, unattendmaybe - * @hook 'post_local_end' - * array $arr - * 'post_id' => ID of posted item + * Activity verb. One of + * like, unlike, dislike, undislike, attendyes, unattendyes, + * attendno, unattendno, attendmaybe, unattendmaybe + * @return bool + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException + * @hook 'post_local_end' + * array $arr + * 'post_id' => ID of posted item */ public static function performLike($item_id, $verb) { @@ -3212,7 +3252,7 @@ class Item extends BaseObject /** * get translated item type * - * @param array $itme + * @param $item * @return string */ public static function postType($item) @@ -3238,6 +3278,7 @@ class Item extends BaseObject * @param array $item * @param bool $update * + * @throws \Friendica\Network\HTTPException\InternalServerErrorException * @todo Remove reference, simply return "rendered-html" and "rendered-hash" */ public static function putInCache(&$item, $update = false) @@ -3296,10 +3337,12 @@ class Item extends BaseObject * @param boolean $attach * @param boolean $is_preview * @return string item body html - * @hook prepare_body_init item array before any work - * @hook prepare_body_content_filter ('item'=>item array, 'filter_reasons'=>string array) before first bbcode to html - * @hook prepare_body ('item'=>item array, 'html'=>body string, 'is_preview'=>boolean, 'filter_reasons'=>string array) after first bbcode to html - * @hook prepare_body_final ('item'=>item array, 'html'=>body string) after attach icons and blockquote special case handling (spoiler, author) + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException + * @hook prepare_body_init item array before any work + * @hook prepare_body_content_filter ('item'=>item array, 'filter_reasons'=>string array) before first bbcode to html + * @hook prepare_body ('item'=>item array, 'html'=>body string, 'is_preview'=>boolean, 'filter_reasons'=>string array) after first bbcode to html + * @hook prepare_body_final ('item'=>item array, 'html'=>body string) after attach icons and blockquote special case handling (spoiler, author) */ public static function prepareBody(array &$item, $attach = false, $is_preview = false) { @@ -3467,8 +3510,10 @@ class Item extends BaseObject /** * get private link for item + * * @param array $item * @return boolean|array False if item has not plink, otherwise array('href'=>plink url, 'title'=>translated title) + * @throws \Exception */ public static function getPlink($item) { diff --git a/src/Model/ItemContent.php b/src/Model/ItemContent.php index 25ae6b8424..6d03ae3253 100644 --- a/src/Model/ItemContent.php +++ b/src/Model/ItemContent.php @@ -22,9 +22,10 @@ class ItemContent extends BaseObject * @param int $htmlmode This controls the behavior of the BBCode conversion * @param string $target_network Name of the network where the post should go to. * - * @see \Friendica\Content\Text\BBCode::getAttachedData - * * @return array Same array structure than \Friendica\Content\Text\BBCode::getAttachedData + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @see \Friendica\Content\Text\BBCode::getAttachedData + * */ public static function getPlaintextPost($item, $limit = 0, $includedlinks = false, $htmlmode = 2, $target_network = '') { diff --git a/src/Model/ItemDeliveryData.php b/src/Model/ItemDeliveryData.php index fa69af8419..8d273e22b9 100644 --- a/src/Model/ItemDeliveryData.php +++ b/src/Model/ItemDeliveryData.php @@ -53,6 +53,7 @@ class ItemDeliveryData * * @param integer $item_id * @return bool + * @throws \Exception */ public static function incrementQueueDone($item_id) { @@ -65,6 +66,7 @@ class ItemDeliveryData * @param integer $item_id * @param array $fields * @return bool + * @throws \Exception */ public static function insert($item_id, array $fields) { @@ -85,6 +87,7 @@ class ItemDeliveryData * @param integer $item_id * @param array $fields * @return bool + * @throws \Exception */ public static function update($item_id, array $fields) { @@ -105,6 +108,7 @@ class ItemDeliveryData * * @param integer $item_id * @return bool + * @throws \Exception */ public static function delete($item_id) { diff --git a/src/Model/ItemURI.php b/src/Model/ItemURI.php index 56e9e1caae..8e39ebd1cb 100644 --- a/src/Model/ItemURI.php +++ b/src/Model/ItemURI.php @@ -17,6 +17,7 @@ class ItemURI extends BaseObject * @param array $fields Item-uri fields * * @return integer item-uri id + * @throws \Exception */ public static function insert($fields) { @@ -43,6 +44,7 @@ class ItemURI extends BaseObject * @param string $uri * * @return integer item-uri id + * @throws \Exception */ public static function getIdByURI($uri) { diff --git a/src/Model/Mail.php b/src/Model/Mail.php index b47d4ac8e3..b5841d1785 100644 --- a/src/Model/Mail.php +++ b/src/Model/Mail.php @@ -26,6 +26,8 @@ class Mail * @param string $body message body, default empty * @param string $subject message subject, default empty * @param string $replyto reply to + * @return int + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function send($recipient = 0, $body = '', $subject = '', $replyto = '') { @@ -160,6 +162,9 @@ class Mail * @param string $body message body, default empty * @param string $subject message subject, default empty * @param string $replyto reply to, default empty + * @return int + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function sendWall($recipient = '', $body = '', $subject = '', $replyto = '') { diff --git a/src/Model/OpenWebAuthToken.php b/src/Model/OpenWebAuthToken.php index 7c14cd3046..7b30d2eb05 100644 --- a/src/Model/OpenWebAuthToken.php +++ b/src/Model/OpenWebAuthToken.php @@ -16,12 +16,13 @@ class OpenWebAuthToken /** * Create an entry in the 'openwebauth-token' table. * - * @param string $type Verify type. - * @param int $uid The user ID. + * @param string $type Verify type. + * @param int $uid The user ID. * @param string $token * @param string $meta * * @return boolean + * @throws \Exception */ public static function create($type, $uid, $token, $meta) { @@ -38,11 +39,12 @@ class OpenWebAuthToken /** * Get the "meta" field of an entry in the openwebauth-token table. * - * @param string $type Verify type. - * @param int $uid The user ID. + * @param string $type Verify type. + * @param int $uid The user ID. * @param string $token * * @return string|boolean The meta enry or false if not found. + * @throws \Exception */ public static function getMeta($type, $uid, $token) { @@ -62,6 +64,7 @@ class OpenWebAuthToken * * @param string $type Verify type. * @param string $interval SQL compatible time interval + * @throws \Exception */ public static function purge($type, $interval) { diff --git a/src/Model/PermissionSet.php b/src/Model/PermissionSet.php index ab6c46afb2..3148d4da03 100644 --- a/src/Model/PermissionSet.php +++ b/src/Model/PermissionSet.php @@ -16,7 +16,8 @@ class PermissionSet extends BaseObject * Fetch the id of a given permission set. Generate a new one when needed * * @param array $postarray The array from an item, picture or event post - * @return id + * @return int id + * @throws \Exception */ public static function fetchIDForPost(&$postarray) { @@ -69,6 +70,7 @@ class PermissionSet extends BaseObject * @param array $groups Possibly previously fetched group ids for that contact * * @return array of permission set ids. + * @throws \Exception */ static public function get($uid, $contact_id, $groups = null) diff --git a/src/Model/Photo.php b/src/Model/Photo.php index a1e2e378be..f22e6b86c7 100644 --- a/src/Model/Photo.php +++ b/src/Model/Photo.php @@ -29,13 +29,14 @@ class Photo extends BaseObject /** * @brief Select rows from the photo table * - * @param array $fields Array of selected fields, empty for all - * @param array $conditions Array of fields for conditions - * @param array $params Array of several parameters + * @param array $fields Array of selected fields, empty for all + * @param array $conditions Array of fields for conditions + * @param array $params Array of several parameters * * @return boolean|array * - * @see \Friendica\Database\DBA::select + * @throws \Exception + * @see \Friendica\Database\DBA::select */ public static function select(array $fields = [], array $conditions = [], array $params = []) { @@ -50,13 +51,14 @@ class Photo extends BaseObject /** * @brief Retrieve a single record from the photo table * - * @param array $fields Array of selected fields, empty for all - * @param array $conditions Array of fields for conditions - * @param array $params Array of several parameters + * @param array $fields Array of selected fields, empty for all + * @param array $conditions Array of fields for conditions + * @param array $params Array of several parameters * * @return bool|array * - * @see \Friendica\Database\DBA::select + * @throws \Exception + * @see \Friendica\Database\DBA::select */ public static function selectFirst(array $fields = [], array $conditions = [], array $params = []) { @@ -70,14 +72,15 @@ class Photo extends BaseObject /** * @brief Get photos for user id * - * @param integer $uid User id - * @param string $resourceid Rescource ID of the photo - * @param array $conditions Array of fields for conditions - * @param array $params Array of several parameters + * @param integer $uid User id + * @param string $resourceid Rescource ID of the photo + * @param array $conditions Array of fields for conditions + * @param array $params Array of several parameters * * @return bool|array * - * @see \Friendica\Database\DBA::select + * @throws \Exception + * @see \Friendica\Database\DBA::select */ public static function getPhotosForUser($uid, $resourceid, array $conditions = [], array $params = []) { @@ -90,15 +93,16 @@ class Photo extends BaseObject /** * @brief Get a photo for user id * - * @param integer $uid User id - * @param string $resourceid Rescource ID of the photo - * @param integer $scale Scale of the photo. Defaults to 0 - * @param array $conditions Array of fields for conditions - * @param array $params Array of several parameters + * @param integer $uid User id + * @param string $resourceid Rescource ID of the photo + * @param integer $scale Scale of the photo. Defaults to 0 + * @param array $conditions Array of fields for conditions + * @param array $params Array of several parameters * * @return bool|array * - * @see \Friendica\Database\DBA::select + * @throws \Exception + * @see \Friendica\Database\DBA::select */ public static function getPhotoForUser($uid, $resourceid, $scale = 0, array $conditions = [], array $params = []) { @@ -116,10 +120,11 @@ class Photo extends BaseObject * on success, "no sign" image info, if user has no permission, * false if photo does not exists * - * @param string $resourceid Rescource ID of the photo - * @param integer $scale Scale of the photo. Defaults to 0 + * @param string $resourceid Rescource ID of the photo + * @param integer $scale Scale of the photo. Defaults to 0 * * @return boolean|array + * @throws \Exception */ public static function getPhoto($resourceid, $scale = 0) { @@ -145,9 +150,10 @@ class Photo extends BaseObject /** * @brief Check if photo with given conditions exists * - * @param array $conditions Array of extra conditions + * @param array $conditions Array of extra conditions * * @return boolean + * @throws \Exception */ public static function exists(array $conditions) { @@ -158,9 +164,11 @@ class Photo extends BaseObject /** * @brief Get Image object for given row id. null if row id does not exist * - * @param array $photo Photo data. Needs at least 'id', 'type', 'backend-class', 'backend-ref' + * @param array $photo Photo data. Needs at least 'id', 'type', 'backend-class', 'backend-ref' * * @return \Friendica\Object\Image + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function getImageForPhoto(array $photo) { @@ -188,6 +196,7 @@ class Photo extends BaseObject * @brief Return a list of fields that are associated with the photo table * * @return array field list + * @throws \Exception */ private static function getFields() { @@ -200,10 +209,11 @@ class Photo extends BaseObject /** * @brief Construct a photo array for a system resource image * - * @param string $filename Image file name relative to code root - * @param string $mimetype Image mime type. Defaults to "image/jpeg" + * @param string $filename Image file name relative to code root + * @param string $mimetype Image mime type. Defaults to "image/jpeg" * * @return array + * @throws \Exception */ public static function createPhotoForSystemResource($filename, $mimetype = "image/jpeg") { @@ -236,6 +246,7 @@ class Photo extends BaseObject * @param string $desc Photo caption. optional, default = "" * * @return boolean True on success + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function store(Image $Image, $uid, $cid, $rid, $filename, $album, $scale, $profile = 0, $allow_cid = "", $allow_gid = "", $deny_cid = "", $deny_gid = "", $desc = "") { @@ -310,12 +321,13 @@ class Photo extends BaseObject /** * @brief Delete info from table and data from storage * - * @param array $conditions Field condition(s) - * @param array $options Options array, Optional + * @param array $conditions Field condition(s) + * @param array $options Options array, Optional * * @return boolean * - * @see \Friendica\Database\DBA::delete + * @throws \Exception + * @see \Friendica\Database\DBA::delete */ public static function delete(array $conditions, array $options = []) { @@ -342,7 +354,8 @@ class Photo extends BaseObject * * @return boolean Was the update successfull? * - * @see \Friendica\Database\DBA::update + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @see \Friendica\Database\DBA::update */ public static function update($fields, $conditions, Image $img = null, array $old_fields = []) { @@ -372,6 +385,8 @@ class Photo extends BaseObject * @param integer $cid contact id * @param boolean $quit_on_error optional, default false * @return array + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function importProfilePhoto($image_url, $uid, $cid, $quit_on_error = false) { @@ -508,6 +523,7 @@ class Photo extends BaseObject * @param bool $update Update the cache * * @return array Returns array of the photo albums + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function getAlbums($uid, $update = false) { @@ -545,6 +561,7 @@ class Photo extends BaseObject /** * @param int $uid User id of the photos * @return void + * @throws \Exception */ public static function clearAlbumCache($uid) { @@ -556,6 +573,7 @@ class Photo extends BaseObject * Generate a unique photo ID. * * @return string + * @throws \Exception */ public static function newResource() { diff --git a/src/Model/Process.php b/src/Model/Process.php index 4d50ecd4eb..f70b12ba7c 100644 --- a/src/Model/Process.php +++ b/src/Model/Process.php @@ -19,6 +19,7 @@ class Process extends BaseObject * @param string $command * @param string $pid * @return bool + * @throws \Exception */ public static function insert($command, $pid = null) { @@ -44,6 +45,7 @@ class Process extends BaseObject * * @param string $pid * @return bool + * @throws \Exception */ public static function deleteByPid($pid = null) { diff --git a/src/Model/Profile.php b/src/Model/Profile.php index f78f422359..1dedab0ede 100644 --- a/src/Model/Profile.php +++ b/src/Model/Profile.php @@ -36,6 +36,7 @@ class Profile * @param integer User ID * * @return array Profile data + * @throws \Exception */ public static function getByUID($uid) { @@ -102,6 +103,8 @@ class Profile * @param int $profile int * @param array $profiledata array * @param boolean $show_connect Show connect link + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function load(App $a, $nickname, $profile = 0, array $profiledata = [], $show_connect = true) { @@ -206,10 +209,11 @@ class Profile * Includes all available profile data * * @brief Get all profile data of a local user - * @param string $nickname nick - * @param int $uid uid - * @param int $profile_id ID of the profile + * @param string $nickname nick + * @param int $uid uid + * @param int $profile_id ID of the profile * @return array + * @throws \Exception */ public static function getByNickname($nickname, $uid = 0, $profile_id = 0) { @@ -265,13 +269,15 @@ class Profile * because of all the conditional logic. * * @brief Formats a profile for display in the sidebar. - * @param array $profile - * @param int $block + * @param array $profile + * @param int $block * @param boolean $show_connect Show connect link * * @return string HTML sidebar module * - * @note Returns empty string if passed $profile is wrong type or not populated + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException + * @note Returns empty string if passed $profile is wrong type or not populated * * @hooks 'profile_sidebar_enter' * array $profile - profile data @@ -1022,6 +1028,8 @@ class Profile * Ported from Hubzilla: https://framagit.org/hubzilla/core/blob/master/include/channel.php * * @param App $a Application instance. + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function zrlInit(App $a) { @@ -1091,6 +1099,8 @@ class Profile * Ported from Hubzilla: https://framagit.org/hubzilla/core/blob/master/include/zid.php * * @param string $token + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function openWebAuthInit($token) { @@ -1184,6 +1194,7 @@ class Profile * @brief Get the user ID of the page owner * @return int user ID * + * @throws \Friendica\Network\HTTPException\InternalServerErrorException * @note Returns local_user instead of user ID if "always_my_theme" is set to true */ public static function getThemeUid(App $a) @@ -1208,11 +1219,12 @@ class Profile } /** - * Stip query parameter from a string. - * - * @param string $s The input string. - * @return string The query parameter. - */ + * Strip query parameter from a string. + * + * @param string $s The input string. + * @param $param + * @return string The query parameter. + */ public static function stripQueryParam($s, $param) { return preg_replace('/[\?&]' . $param . '=(.*?)(&|$)/ism', '$2', $s); diff --git a/src/Model/PushSubscriber.php b/src/Model/PushSubscriber.php index fb34bb55f4..92d1dd21d1 100644 --- a/src/Model/PushSubscriber.php +++ b/src/Model/PushSubscriber.php @@ -14,8 +14,9 @@ class PushSubscriber /** * @brief Send subscription notifications for the given user * - * @param integer $uid User ID - * @param string $priority Priority for push workers + * @param integer $uid User ID + * @param int $default_priority + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function publishFeed($uid, $default_priority = PRIORITY_HIGH) { @@ -28,7 +29,8 @@ class PushSubscriber /** * @brief start workers to transmit the feed data * - * @param string $priority Priority for push workers + * @param int $default_priority + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function requeue($default_priority = PRIORITY_HIGH) { @@ -60,6 +62,7 @@ class PushSubscriber * @param string $hub_callback Callback address * @param string $hub_topic Feed topic * @param string $hub_secret Subscription secret + * @throws \Exception */ public static function renew($uid, $nick, $subscribe, $hub_callback, $hub_topic, $hub_secret) { @@ -98,6 +101,7 @@ class PushSubscriber * @brief Delay the push subscriber * * @param integer $id Subscriber ID + * @throws \Exception */ public static function delay($id) { @@ -135,7 +139,8 @@ class PushSubscriber * @brief Reset the push subscriber * * @param integer $id Subscriber ID - * @param date $last_update Date of last transmitted item + * @param string $last_update Date of last transmitted item + * @throws \Exception */ public static function reset($id, $last_update) { diff --git a/src/Model/Queue.php b/src/Model/Queue.php index b2c002574c..ecbc0ed3b6 100644 --- a/src/Model/Queue.php +++ b/src/Model/Queue.php @@ -13,6 +13,7 @@ class Queue { /** * @param string $id id + * @throws \Exception */ public static function updateTime($id) { @@ -37,6 +38,7 @@ class Queue /** * @param string $id id + * @throws \Exception */ public static function removeItem($id) { @@ -78,6 +80,8 @@ class Queue * @param string $network network * @param string $msg message * @param boolean $batch batch, default false + * @param string $guid + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function add($cid, $network, $msg, $batch = false, $guid = '') { diff --git a/src/Model/Register.php b/src/Model/Register.php index 66f19133b8..c2dd96def5 100644 --- a/src/Model/Register.php +++ b/src/Model/Register.php @@ -20,6 +20,7 @@ class Register * Return the list of pending registrations * * @return array + * @throws \Exception */ public static function getPending() { @@ -37,6 +38,7 @@ class Register * Returns the pending registration count * * @return int + * @throws \Exception */ public static function getPendingCount() { @@ -54,6 +56,7 @@ class Register * * @param string $hash * @return array + * @throws \Exception */ public static function getByHash($hash) { @@ -63,8 +66,9 @@ class Register /** * Returns true if a register record exists with the provided hash * - * @param string $hash + * @param string $hash * @return boolean + * @throws \Exception */ public static function existsByHash($hash) { @@ -75,6 +79,7 @@ class Register * Creates a register record for an invitation and returns the auto-generated code for it * * @return string + * @throws \Exception */ public static function createForInvitation() { @@ -98,6 +103,7 @@ class Register * @param string $language The registration language * @param string $note An additional message from the user * @return boolean + * @throws \Exception */ public static function createForApproval($uid, $language, $note = '') { @@ -122,8 +128,9 @@ class Register /** * Deletes a register record by the provided hash and returns the success of the database deletion * - * @param string $hash + * @param string $hash * @return boolean + * @throws \Exception */ public static function deleteByHash($hash) { diff --git a/src/Model/Storage/Filesystem.php b/src/Model/Storage/Filesystem.php index 2f375491b2..b5bc883b4b 100644 --- a/src/Model/Storage/Filesystem.php +++ b/src/Model/Storage/Filesystem.php @@ -49,7 +49,8 @@ class Filesystem implements IStorage /** * @brief Create dirctory tree to store file, with .htaccess and index.html files - * @param string $file Path and filename + * @param string $file Path and filename + * @throws StorageException */ private static function createFoldersForFile($file) { diff --git a/src/Model/Term.php b/src/Model/Term.php index 7f494fc4af..28c28fb1a9 100644 --- a/src/Model/Term.php +++ b/src/Model/Term.php @@ -192,7 +192,9 @@ class Term /** * @param integer $itemid item id + * @param $files * @return void + * @throws \Exception */ public static function insertFromFileFieldByItemId($itemid, $files) { @@ -241,6 +243,8 @@ class Term * * @param array $item * @return array + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function populateTagsFromItem(&$item) { @@ -291,8 +295,10 @@ class Term /** * Delete all tags from an item + * * @param int itemid - choose from which item the tags will be removed - * @param array type - items type. default is [TERM_HASHTAG, TERM_MENTION] + * @param array $type + * @throws \Exception */ public static function deleteByItemId($itemid, $type = [TERM_HASHTAG, TERM_MENTION]) { diff --git a/src/Model/User.php b/src/Model/User.php index 602ba9b33f..23ba7e64d8 100644 --- a/src/Model/User.php +++ b/src/Model/User.php @@ -34,6 +34,7 @@ class User * * @param integer $uid * @return boolean + * @throws Exception */ public static function exists($uid) { @@ -43,6 +44,7 @@ class User /** * @param integer $uid * @return array|boolean User record if it exists, false otherwise + * @throws Exception */ public static function getById($uid) { @@ -55,6 +57,7 @@ class User * @param string $url * * @return integer user id + * @throws Exception */ public static function getIdForURL($url) { @@ -71,6 +74,7 @@ class User * * @param int $uid * @return boolean|array + * @throws Exception */ public static function getOwnerDataById($uid) { $r = DBA::fetchFirst("SELECT @@ -115,6 +119,7 @@ class User * * @param int $nick * @return boolean|array + * @throws Exception */ public static function getOwnerDataByNick($nick) { @@ -134,6 +139,7 @@ class User * @param string $network network name * * @return int group id + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function getDefaultGroup($uid, $network = '') { @@ -364,6 +370,7 @@ class User * @param int $uid * @param string $pasword_hashed * @return bool + * @throws Exception */ private static function updatePasswordHashed($uid, $pasword_hashed) { @@ -385,6 +392,7 @@ class User * * @param string $nickname The nickname that should be checked * @return boolean True is the nickname is blocked on the node + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function isNicknameBlocked($nickname) { @@ -422,6 +430,7 @@ class User * @return array * @throws \ErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException * @throws Exception */ public static function create(array $data) @@ -807,7 +816,8 @@ class User /** * @param object $uid user to remove - * @return void + * @return bool + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function remove($uid) { @@ -848,18 +858,19 @@ class User * @return array All identities for this user * * Example for a return: - * [ - * [ - * 'uid' => 1, - * 'username' => 'maxmuster', - * 'nickname' => 'Max Mustermann' - * ], - * [ - * 'uid' => 2, - * 'username' => 'johndoe', - * 'nickname' => 'John Doe' - * ] - * ] + * [ + * [ + * 'uid' => 1, + * 'username' => 'maxmuster', + * 'nickname' => 'Max Mustermann' + * ], + * [ + * 'uid' => 2, + * 'username' => 'johndoe', + * 'nickname' => 'John Doe' + * ] + * ] + * @throws Exception */ public static function identities($uid) { diff --git a/src/Module/Contact.php b/src/Module/Contact.php index fa231b1de1..04cc923057 100644 --- a/src/Module/Contact.php +++ b/src/Module/Contact.php @@ -841,12 +841,12 @@ class Contact extends BaseModule * * Available Pages are 'Status', 'Profile', 'Contacts' and 'Common Friends' * - * @param App $a - * @param array $contact The contact array - * @param int $active_tab 1 if tab should be marked as active + * @param App $a + * @param array $contact The contact array + * @param int $active_tab 1 if tab should be marked as active * - * @return string | HTML string of the contact page tabs buttons. - + * @return string HTML string of the contact page tabs buttons. + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function getTabsHTML($a, $contact, $active_tab) { diff --git a/src/Module/Install.php b/src/Module/Install.php index 2e0f16c4e9..ab49e426c5 100644 --- a/src/Module/Install.php +++ b/src/Module/Install.php @@ -254,6 +254,7 @@ class Install extends BaseModule * @param App $a The global App * * @return string The text for the next steps + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function whatNext($a) { diff --git a/src/Module/Login.php b/src/Module/Login.php index 7a0e8e40e2..06af508e9b 100644 --- a/src/Module/Login.php +++ b/src/Module/Login.php @@ -79,6 +79,7 @@ class Login extends BaseModule * * @param string $openid_url OpenID URL string * @param bool $remember Whether to set the session remember flag + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function openIdAuthentication($openid_url, $remember) { @@ -112,6 +113,7 @@ class Login extends BaseModule * @param string $username User name * @param string $password Clear password * @param bool $remember Whether to set the session remember flag + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function passwordAuthentication($username, $password, $remember) { @@ -269,14 +271,15 @@ class Login extends BaseModule /** * @brief Wrapper for adding a login box. * - * @param string $return_path The path relative to the base the user should be sent - * back to after login completes - * @param bool $register If $register == true provide a registration link. - * This will most always depend on the value of config.register_policy. - * @param array $hiddens optional + * @param string $return_path The path relative to the base the user should be sent + * back to after login completes + * @param bool $register If $register == true provide a registration link. + * This will most always depend on the value of config.register_policy. + * @param array $hiddens optional * * @return string Returns the complete html for inserting into the page * + * @throws \Friendica\Network\HTTPException\InternalServerErrorException * @hooks 'login_hook' string $o */ public static function form($return_path = null, $register = false, $hiddens = []) diff --git a/src/Module/Proxy.php b/src/Module/Proxy.php index 4387cc7ec2..3df90c5356 100644 --- a/src/Module/Proxy.php +++ b/src/Module/Proxy.php @@ -32,7 +32,6 @@ class Proxy extends BaseModule * * Sets application instance and checks if /proxy/ path is writable. * - * @param \Friendica\App $app Application instance */ public static function init() { @@ -157,6 +156,7 @@ class Proxy extends BaseModule * 'size' => requested image size (int) * 'sizetype' => requested image size (string): ':micro', ':thumb', ':small', ':medium', ':large' * ] + * @throws \Exception */ private static function getRequestInfo() { @@ -224,12 +224,13 @@ class Proxy extends BaseModule 'sizetype' => $sizetype, ]; } - - + + /** * @brief setup ./proxy folder for direct cache * * @return bool False if direct cache can't be used. + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function setupDirectCache() { @@ -248,16 +249,18 @@ class Proxy extends BaseModule return $direct_cache; } - - + + /** * @brief Try to reply with image in cachefile * - * @param array $request Array from getRequestInfo + * @param array $request Array from getRequestInfo * * @return string Cache file name, empty string if cache is not enabled. - * + * * If cachefile exists, script ends here and this function will never returns + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function responseFromCache(&$request) { @@ -269,13 +272,15 @@ class Proxy extends BaseModule } return $cachefile; } - + /** * @brief Try to reply with image in database * - * @param array $request Array from getRequestInfo + * @param array $request Array from getRequestInfo * * If the image exists in database, then script ends here and this function will never returns + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function responseFromDB(&$request) { @@ -297,11 +302,12 @@ class Proxy extends BaseModule echo file_get_contents('images/blank.png'); exit(); } - + /** * @brief Output the image with cache headers * - * @param Image $image + * @param Image $img + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function responseImageHttpCache(Image $img) { diff --git a/src/Module/Tos.php b/src/Module/Tos.php index 170371ad46..6dca554b25 100644 --- a/src/Module/Tos.php +++ b/src/Module/Tos.php @@ -53,6 +53,7 @@ class Tos extends BaseModule self::getApp()->internalRedirect('profile/' . Config::get('system','singleuser')); } } + /** * @brief generate the content of the /tos page * @@ -63,7 +64,8 @@ class Tos extends BaseModule * This privacy statement has fixed text, so it can be translated easily. * * @return string - **/ + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + */ public static function content() { $tpl = Renderer::getMarkupTemplate('tos.tpl'); if (Config::get('system', 'tosdisplay')) { diff --git a/src/Network/CurlResult.php b/src/Network/CurlResult.php index 1aafbfa9b8..1a475c7cec 100644 --- a/src/Network/CurlResult.php +++ b/src/Network/CurlResult.php @@ -77,6 +77,7 @@ class CurlResult * @param string $url optional URL * * @return CurlResult a CURL with error response + * @throws InternalServerErrorException */ public static function createErrorCurl($url = '') { diff --git a/src/Network/FKOAuth1.php b/src/Network/FKOAuth1.php index 1e84ff052b..33fdf0ac22 100644 --- a/src/Network/FKOAuth1.php +++ b/src/Network/FKOAuth1.php @@ -32,6 +32,7 @@ class FKOAuth1 extends OAuthServer /** * @param string $uid user id * @return void + * @throws HTTPException\InternalServerErrorException */ public function loginUser($uid) { diff --git a/src/Network/FKOAuthDataStore.php b/src/Network/FKOAuthDataStore.php index 276ba2fcbe..d1f43172b6 100644 --- a/src/Network/FKOAuthDataStore.php +++ b/src/Network/FKOAuthDataStore.php @@ -35,6 +35,7 @@ class FKOAuthDataStore extends OAuthDataStore /** * @param string $consumer_key key * @return mixed + * @throws \Exception */ public function lookup_consumer($consumer_key) { @@ -55,6 +56,7 @@ class FKOAuthDataStore extends OAuthDataStore * @param string $token_type type * @param string $token token * @return mixed + * @throws \Exception */ public function lookup_token($consumer, $token_type, $token) { @@ -80,6 +82,7 @@ class FKOAuthDataStore extends OAuthDataStore * @param string $nonce nonce * @param string $timestamp timestamp * @return mixed + * @throws \Exception */ public function lookup_nonce($consumer, $token, $nonce, $timestamp) { @@ -95,6 +98,7 @@ class FKOAuthDataStore extends OAuthDataStore * @param string $consumer consumer * @param string $callback optional, default null * @return mixed + * @throws \Exception */ public function new_request_token($consumer, $callback = null) { @@ -130,6 +134,7 @@ class FKOAuthDataStore extends OAuthDataStore * @param string $consumer consumer * @param string $verifier optional, defult null * @return object + * @throws HTTPException\InternalServerErrorException */ public function new_access_token($token, $consumer, $verifier = null) { diff --git a/src/Network/Probe.php b/src/Network/Probe.php index d322c3ed27..49822c725a 100644 --- a/src/Network/Probe.php +++ b/src/Network/Probe.php @@ -97,6 +97,7 @@ class Probe * @param string $host The host part of an url * * @return array with template and type of the webfinger template for JSON or XML + * @throws HTTPException\InternalServerErrorException */ private static function hostMeta($host) { @@ -188,6 +189,7 @@ class Probe * @param string $hcard_url Link to the hcard - is returned by reference * * @return string profile link + * @throws HTTPException\InternalServerErrorException */ public static function webfingerDfrn($webbie, &$hcard_url) { @@ -221,6 +223,7 @@ class Probe * @param string $uri Address that should be probed * * @return array uri data + * @throws HTTPException\InternalServerErrorException */ public static function lrdd($uri) { @@ -315,6 +318,8 @@ class Probe * @param boolean $cache Use cached values? * * @return array uri data + * @throws HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function uri($uri, $network = '', $uid = -1, $cache = true) { @@ -527,6 +532,7 @@ class Probe * @param string $type type * * @return array fixed webfinger data + * @throws HTTPException\InternalServerErrorException */ private static function fixOStatus($webfinger, $lrdd, $type) { @@ -572,6 +578,7 @@ class Probe * @param integer $uid User ID for the probe (only used for mails) * * @return array uri data + * @throws HTTPException\InternalServerErrorException */ private static function detect($uri, $network, $uid) { @@ -740,6 +747,7 @@ class Probe * @param string $type type * * @return array webfinger data + * @throws HTTPException\InternalServerErrorException */ private static function webfinger($url, $type) { @@ -810,6 +818,7 @@ class Probe * @param array $data The already fetched data * * @return array noscrape data + * @throws HTTPException\InternalServerErrorException */ private static function pollNoscrape($noscrape_url, $data) { @@ -926,6 +935,8 @@ class Probe * @param string $profile_link Link to the profile page * * @return array profile data + * @throws HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function profile($profile_link) { @@ -976,6 +987,7 @@ class Probe * @param array $webfinger Webfinger data * * @return array DFRN data + * @throws HTTPException\InternalServerErrorException */ private static function dfrn($webfinger) { @@ -1057,6 +1069,7 @@ class Probe * @param boolean $dfrn Poll DFRN specific data * * @return array hcard data + * @throws HTTPException\InternalServerErrorException */ private static function pollHcard($hcard_url, $data, $dfrn = false) { @@ -1181,6 +1194,7 @@ class Probe * @param array $webfinger Webfinger data * * @return array Diaspora data + * @throws HTTPException\InternalServerErrorException */ private static function diaspora($webfinger) { @@ -1268,6 +1282,7 @@ class Probe * @param bool $short Short detection mode * * @return array|bool OStatus data or "false" on error or "true" on short mode + * @throws HTTPException\InternalServerErrorException */ private static function ostatus($webfinger, $short = false) { @@ -1450,6 +1465,7 @@ class Probe * * @param array $webfinger Webfinger data * + * @param $addr * @return array pump.io data */ private static function pumpio($webfinger, $addr) @@ -1552,6 +1568,7 @@ class Probe * @param boolean $probe Do a probe if the page contains a feed link * * @return array feed data + * @throws HTTPException\InternalServerErrorException */ private static function feed($url, $probe = true) { @@ -1614,6 +1631,7 @@ class Probe * @param integer $uid User ID * * @return array mail data + * @throws \Exception */ private static function mail($uri, $uid) { @@ -1701,6 +1719,7 @@ class Probe * @param string $base Another path that is hopefully complete * * @return string fixed avatar path + * @throws \Exception */ public static function fixAvatar($avatar, $base) { diff --git a/src/Object/Image.php b/src/Object/Image.php index 298a449b3d..c6381bea85 100644 --- a/src/Object/Image.php +++ b/src/Object/Image.php @@ -65,7 +65,8 @@ class Image * @brief Constructor * @param object $data data * @param boolean $type optional, default null - * @return object + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public function __construct($data, $type = null) { @@ -128,6 +129,8 @@ class Image /** * @param object $data data * @return boolean + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private function loadData($data) { @@ -643,6 +646,7 @@ class Image /** * @param string $path file path * @return mixed + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public function saveToFilePath($path) { @@ -667,6 +671,7 @@ class Image * $data = (string) $Image; * * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public function __toString() { return $this->asString(); @@ -674,6 +679,7 @@ class Image /** * @return mixed + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public function asString() { @@ -721,9 +727,10 @@ class Image * * @param string $filename Image filename * @param boolean $fromcurl Check Content-Type header from curl request - * @param string $header passed headers to take into account + * @param string $header passed headers to take into account * * @return object + * @throws \ImagickException */ public static function guessType($filename, $fromcurl = false, $header = '') { @@ -772,6 +779,7 @@ class Image /** * @param string $url url * @return object + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function getInfoFromURL($url) { @@ -876,11 +884,13 @@ class Image /** * @brief This function is used by the fromgplus addon - * @param object $a App + * @param App $a App * @param integer $uid user id * @param string $imagedata optional, default empty * @param string $url optional, default empty * @return array + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function storePhoto(App $a, $uid, $imagedata = "", $url = "") { diff --git a/src/Object/Post.php b/src/Object/Post.php index a1d6c1eab0..5e1056aa93 100644 --- a/src/Object/Post.php +++ b/src/Object/Post.php @@ -61,6 +61,7 @@ class Post extends BaseObject * Constructor * * @param array $data data array + * @throws \Exception */ public function __construct(array $data) { @@ -116,6 +117,8 @@ class Post extends BaseObject * * @return mixed The data requested on success * false on failure + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public function getTemplateData(array $conv_responses, $thread_level = 1) { @@ -501,6 +504,7 @@ class Post extends BaseObject * @param Post $item The child item to add * * @return mixed + * @throws \Exception */ public function addChild(Post $item) { @@ -590,6 +594,7 @@ class Post extends BaseObject * @param Post $item The child to be removed * * @return boolean Success or failure + * @throws \Exception */ public function removeChild(Post $item) { @@ -679,6 +684,7 @@ class Post extends BaseObject * * @param string $name template name * @return bool + * @throws \Exception */ private function setTemplate($name) { @@ -770,6 +776,7 @@ class Post extends BaseObject * * @return mixed The comment box string (empty if no comment box) * false on failure + * @throws \Exception */ private function getCommentBox($indent) { @@ -849,6 +856,7 @@ class Post extends BaseObject * Check if we are a wall to wall item and set the relevant properties * * @return void + * @throws \Exception */ protected function checkWallToWall() { diff --git a/src/Object/Thread.php b/src/Object/Thread.php index 0068fa2fb9..426e9f802c 100644 --- a/src/Object/Thread.php +++ b/src/Object/Thread.php @@ -26,9 +26,10 @@ class Thread extends BaseObject /** * Constructor * - * @param string $mode The mode - * @param boolean $preview Are we in the preview mode? + * @param string $mode The mode + * @param boolean $preview Are we in the preview mode? * @param boolean $writable Override the writable check + * @throws \Exception */ public function __construct($mode, $preview, $writable = false) { @@ -39,10 +40,11 @@ class Thread extends BaseObject /** * Set the mode we'll be displayed on * - * @param string $mode The mode to set + * @param string $mode The mode to set * @param boolean $writable Override the writable check * * @return void + * @throws \Exception */ private function setMode($mode, $writable) { @@ -125,10 +127,11 @@ class Thread extends BaseObject /** * Add a thread to the conversation * - * @param object $item The item to insert + * @param Post $item The item to insert * * @return mixed The inserted item on success * false on failure + * @throws \Exception */ public function addParent(Post $item) { @@ -172,6 +175,7 @@ class Thread extends BaseObject * * @return mixed The data requested on success * false on failure + * @throws \Exception */ public function getTemplateData($conv_responses) { diff --git a/src/Protocol/ActivityPub.php b/src/Protocol/ActivityPub.php index c7c2623558..4c909efbc0 100644 --- a/src/Protocol/ActivityPub.php +++ b/src/Protocol/ActivityPub.php @@ -49,7 +49,7 @@ class ActivityPub /** * Checks if the web request is done for the AP protocol * - * @return is it AP? + * @return bool is it AP? */ public static function isRequest() { @@ -63,6 +63,7 @@ class ActivityPub * @param string $url content url * @param integer $uid User ID for the signature * @return array + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function fetchContent($url, $uid = 0) { @@ -89,6 +90,8 @@ class ActivityPub * * @param string $url profile url * @return array + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function probeProfile($url) { @@ -128,8 +131,9 @@ class ActivityPub /** * Fetches activities from the outbox of a given profile and processes it * - * @param string $url + * @param string $url * @param integer $uid User ID + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function fetchOutbox($url, $uid) { diff --git a/src/Protocol/ActivityPub/Processor.php b/src/Protocol/ActivityPub/Processor.php index d3c616a7e0..0e00797a46 100644 --- a/src/Protocol/ActivityPub/Processor.php +++ b/src/Protocol/ActivityPub/Processor.php @@ -30,7 +30,7 @@ class Processor * * @param string $body * - * @return converted body + * @return string converted body */ private static function convertMentions($body) { @@ -93,7 +93,7 @@ class Processor * @param array $attachments * @param array $item * - * @return item array + * @return array array */ private static function constructAttachList($attachments, $item) { @@ -124,7 +124,8 @@ class Processor /** * Updates a message * - * @param array $activity Activity array + * @param array $activity Activity array + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function updateItem($activity) { @@ -143,7 +144,9 @@ class Processor /** * Prepares data for a message * - * @param array $activity Activity array + * @param array $activity Activity array + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function createItem($activity) { @@ -173,6 +176,8 @@ class Processor * Delete items * * @param array $activity + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function deleteItem($activity) { @@ -187,6 +192,8 @@ class Processor * * @param array $activity Activity array * @param string $verb Activity verb + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function createActivity($activity, $verb) { @@ -206,6 +213,7 @@ class Processor * * @param array $activity Activity array * @param array $item + * @throws \Exception */ public static function createEvent($activity, $item) { @@ -237,8 +245,10 @@ class Processor /** * Creates an item post * - * @param array $activity Activity data - * @param array $item item array + * @param array $activity Activity data + * @param array $item item array + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function postItem($activity, $item) { @@ -327,6 +337,7 @@ class Processor * * @param $url * @param $child + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function fetchMissingActivity($url, $child) { @@ -370,6 +381,8 @@ class Processor * perform a "follow" request * * @param array $activity + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function followUser($activity) { @@ -412,6 +425,7 @@ class Processor * Update the given profile * * @param array $activity + * @throws \Exception */ public static function updatePerson($activity) { @@ -427,6 +441,7 @@ class Processor * Delete the given profile * * @param array $activity + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function deletePerson($activity) { @@ -453,6 +468,8 @@ class Processor * Accept a follow request * * @param array $activity + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function acceptFollowUser($activity) { @@ -487,6 +504,8 @@ class Processor * Reject a follow request * * @param array $activity + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function rejectFollowUser($activity) { @@ -517,6 +536,8 @@ class Processor * Undo activity like "like" or "dislike" * * @param array $activity + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function undoActivity($activity) { @@ -540,6 +561,8 @@ class Processor * Activity to remove a follower * * @param array $activity + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function undoFollowUser($activity) { @@ -571,6 +594,7 @@ class Processor * Switches a contact to AP if needed * * @param integer $cid Contact ID + * @throws \Exception */ private static function switchContact($cid) { diff --git a/src/Protocol/ActivityPub/Receiver.php b/src/Protocol/ActivityPub/Receiver.php index 61e9f8e9c6..9949577a71 100644 --- a/src/Protocol/ActivityPub/Receiver.php +++ b/src/Protocol/ActivityPub/Receiver.php @@ -42,7 +42,7 @@ class Receiver /** * Checks if the web request is done for the AP protocol * - * @return is it AP? + * @return bool is it AP? */ public static function isRequest() { @@ -53,9 +53,10 @@ class Receiver /** * Checks incoming message from the inbox * - * @param $body - * @param $header + * @param $body + * @param $header * @param integer $uid User ID + * @throws \Exception */ public static function processInbox($body, $header, $uid) { @@ -114,9 +115,11 @@ class Receiver * * @param array $activity * @param string $object_id Object ID of the the provided object - * @param integer $uid User ID + * @param integer $uid User ID * * @return string with object type + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function fetchObjectType($activity, $object_id, $uid = 0) { @@ -152,11 +155,13 @@ class Receiver /** * Prepare the object array * - * @param array $activity + * @param array $activity * @param integer $uid User ID - * @param $trust_source + * @param $trust_source * * @return array with object data + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function prepareObjectData($activity, $uid, &$trust_source) { @@ -264,6 +269,7 @@ class Receiver * * @param array $activity Array with activity data * @param string $body The raw message + * @throws \Exception */ private static function storeConversation($activity, $body) { @@ -290,6 +296,7 @@ class Receiver * @param string $body * @param integer $uid User ID * @param boolean $trust_source Do we trust the source? + * @throws \Exception */ public static function processActivity($activity, $body = '', $uid = null, $trust_source = false) { @@ -428,11 +435,12 @@ class Receiver /** * Fetch the receiver list from an activity array * - * @param array $activity + * @param array $activity * @param string $actor - * @param array $tags + * @param array $tags * * @return array with receivers (user id) + * @throws \Exception */ private static function getReceivers($activity, $actor, $tags = []) { @@ -523,9 +531,10 @@ class Receiver * Fetch the receiver list of a given actor * * @param string $actor - * @param array $tags + * @param array $tags * * @return array with receivers (user id) + * @throws \Exception */ public static function getReceiverForActor($actor, $tags) { @@ -546,11 +555,12 @@ class Receiver /** * Tests if the contact is a valid receiver for this actor * - * @param array $contact + * @param array $contact * @param string $actor - * @param array $tags + * @param array $tags * - * @return array with receivers (user id) + * @return bool with receivers (user id) + * @throws \Exception */ private static function isValidReceiverForActor($contact, $actor, $tags) { @@ -589,7 +599,9 @@ class Receiver * * @param integer $cid Contact ID * @param integer $uid User ID - * @param string $url Profile URL + * @param string $url Profile URL + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function switchContact($cid, $uid, $url) { @@ -622,6 +634,8 @@ class Receiver * * @param $receivers * @param $actor + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function switchContacts($receivers, $actor) { @@ -645,10 +659,10 @@ class Receiver /** * * - * @param $object_data + * @param $object_data * @param array $activity * - * @return + * @return mixed */ private static function addActivityFields($object_data, $activity) { @@ -674,6 +688,8 @@ class Receiver * @param integer $uid User ID for the signature that we use to fetch data * * @return array with trusted and valid object data + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function fetchObject($object_id, $object = [], $trust_source = false, $uid = 0) { @@ -759,8 +775,7 @@ class Receiver /** * Convert emojis from JSON-LD format into a simplified format * - * @param array $tags Tags in JSON-LD format - * + * @param $emojis * @return array with emojis in a simplified format */ private static function processEmojis($emojis) @@ -819,6 +834,7 @@ class Receiver * @param array $object * * @return array + * @throws \Exception */ private static function processObject($object) { diff --git a/src/Protocol/ActivityPub/Transmitter.php b/src/Protocol/ActivityPub/Transmitter.php index 89986f4923..5136bc72c1 100644 --- a/src/Protocol/ActivityPub/Transmitter.php +++ b/src/Protocol/ActivityPub/Transmitter.php @@ -42,10 +42,11 @@ class Transmitter /** * collects the lost of followers of the given owner * - * @param array $owner Owner array - * @param integer $page Page number + * @param array $owner Owner array + * @param integer $page Page number * * @return array of owners + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function getFollowers($owner, $page = null) { @@ -89,10 +90,11 @@ class Transmitter /** * Create list of following contacts * - * @param array $owner Owner array - * @param integer $page Page numbe + * @param array $owner Owner array + * @param integer $page Page numbe * * @return array of following contacts + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function getFollowing($owner, $page = null) { @@ -136,10 +138,12 @@ class Transmitter /** * Public posts for the given owner * - * @param array $owner Owner array - * @param integer $page Page numbe + * @param array $owner Owner array + * @param integer $page Page numbe * * @return array of posts + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function getOutbox($owner, $page = null) { @@ -186,6 +190,7 @@ class Transmitter * * @param integer $uid User ID * @return array with profile data + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function getProfile($uid) { @@ -246,6 +251,8 @@ class Transmitter * @param array $item * * @return array with permissions + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function fetchPermissionBlockFromConversation($item) { @@ -295,11 +302,13 @@ class Transmitter /** * Creates an array of permissions from an item thread * - * @param array $item + * @param array $item * @param boolean $blindcopy * @param boolean $last_id * * @return array with permission data + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function createPermissionBlockForItem($item, $blindcopy, $last_id = 0) { @@ -441,10 +450,12 @@ class Transmitter /** * Fetches a list of inboxes of followers of a given user * - * @param integer $uid User ID + * @param integer $uid User ID * @param boolean $personal fetch personal inboxes * * @return array of follower inboxes + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function fetchTargetInboxesforUser($uid, $personal = false) { @@ -486,12 +497,14 @@ class Transmitter /** * Fetches an array of inboxes for the given item and user * - * @param array $item - * @param integer $uid User ID + * @param array $item + * @param integer $uid User ID * @param boolean $personal fetch personal inboxes * @param integer $last_id Last item id for adding receivers * * @return array with inboxes + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function fetchTargetInboxes($item, $uid, $personal = false, $last_id = 0) { @@ -545,6 +558,8 @@ class Transmitter * @param array $item * * @return string with activity type + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function getTypeOfItem($item) { @@ -585,9 +600,10 @@ class Transmitter * Creates the activity or fetches it from the cache * * @param integer $item_id - * @param boolean $force Force new cache entry + * @param boolean $force Force new cache entry * * @return array with the activity + * @throws \Exception */ public static function createCachedActivityFromItem($item_id, $force = false) { @@ -613,6 +629,7 @@ class Transmitter * @param boolean $object_mode Is the activity item is used inside another object? * * @return array of activity + * @throws \Exception */ public static function createActivityFromItem($item_id, $object_mode = false) { @@ -692,6 +709,8 @@ class Transmitter * @param integer $item_id * * @return array with the object data + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function createObjectFromItemID($item_id) { @@ -747,6 +766,7 @@ class Transmitter * @param array $item * * @return array of tags + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function createTagList($item) { @@ -774,10 +794,11 @@ class Transmitter /** * Adds attachment data to the JSON document * - * @param array $item Data of the item that is to be posted - * @param text $type Object type + * @param array $item Data of the item that is to be posted + * @param string $type Object type * * @return array with attachment data + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function createAttachmentList($item, $type) { @@ -826,11 +847,12 @@ class Transmitter return $attachments; } - /** + /** * @brief Callback function to replace a Friendica style mention in a mention that is used on AP * * @param array $match Matching values for the callback * @return string Replaced mention + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function mentionCallback($match) { @@ -870,6 +892,7 @@ class Transmitter * @param array $item * * @return string with context url + * @throws \Exception */ private static function fetchContextURLForItem($item) { @@ -890,6 +913,7 @@ class Transmitter * @param integer $item_id * * @return boolean + * @throws \Exception */ private static function isSensitive($item_id) { @@ -903,6 +927,7 @@ class Transmitter * @param array $item * * @return array with the event data + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function createEvent($item) { @@ -929,6 +954,8 @@ class Transmitter * @param array $item * * @return array with the object data + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function createNote($item) { @@ -1019,6 +1046,8 @@ class Transmitter * @param array $item * * @return string with announced object url + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function createAnnounce($item) { @@ -1062,11 +1091,12 @@ class Transmitter /** * Transmits a contact suggestion to a given inbox * - * @param integer $uid User ID - * @param string $inbox Target inbox + * @param integer $uid User ID + * @param string $inbox Target inbox * @param integer $suggestion_id Suggestion ID * * @return boolean was the transmission successful? + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function sendContactSuggestion($uid, $inbox, $suggestion_id) { @@ -1093,10 +1123,11 @@ class Transmitter /** * Transmits a profile relocation to a given inbox * - * @param integer $uid User ID - * @param string $inbox Target inbox + * @param integer $uid User ID + * @param string $inbox Target inbox * * @return boolean was the transmission successful? + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function sendProfileRelocation($uid, $inbox) { @@ -1121,10 +1152,11 @@ class Transmitter /** * Transmits a profile deletion to a given inbox * - * @param integer $uid User ID - * @param string $inbox Target inbox + * @param integer $uid User ID + * @param string $inbox Target inbox * * @return boolean was the transmission successful? + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function sendProfileDeletion($uid, $inbox) { @@ -1149,10 +1181,12 @@ class Transmitter /** * Transmits a profile change to a given inbox * - * @param integer $uid User ID - * @param string $inbox Target inbox + * @param integer $uid User ID + * @param string $inbox Target inbox * * @return boolean was the transmission successful? + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function sendProfileUpdate($uid, $inbox) { @@ -1178,10 +1212,12 @@ class Transmitter /** * Transmits a given activity to a target * - * @param array $activity - * @param string $target Target profile - * @param integer $uid User ID - * @param string $id activity id + * @param array $activity + * @param string $target Target profile + * @param integer $uid User ID + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException + * @throws \Exception */ public static function sendActivity($activity, $target, $uid, $id = '') { @@ -1210,9 +1246,11 @@ class Transmitter /** * Transmit a message that the contact request had been accepted * - * @param string $target Target profile - * @param $id - * @param integer $uid User ID + * @param string $target Target profile + * @param $id + * @param integer $uid User ID + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function sendContactAccept($target, $id, $uid) { @@ -1238,9 +1276,11 @@ class Transmitter /** * Reject a contact request or terminates the contact relation * - * @param string $target Target profile - * @param $id - * @param integer $uid User ID + * @param string $target Target profile + * @param $id + * @param integer $uid User ID + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function sendContactReject($target, $id, $uid) { @@ -1266,9 +1306,11 @@ class Transmitter /** * Transmits a message that we don't want to follow this contact anymore * - * @param string $target Target profile - * @param integer $cid Contact ID of target - * @param integer $uid User ID + * @param string $target Target profile + * @param integer $uid User ID + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException + * @throws \Exception */ public static function sendContactUndo($target, $cid, $uid) { diff --git a/src/Protocol/DFRN.php b/src/Protocol/DFRN.php index c08a24f423..4786f8d620 100644 --- a/src/Protocol/DFRN.php +++ b/src/Protocol/DFRN.php @@ -56,6 +56,7 @@ class DFRN * @param integer $uid User id * * @return array importer + * @throws \Exception */ public static function getImporter($cid, $uid = 0) { @@ -96,7 +97,9 @@ class DFRN * @param array $owner Owner record * * @return string DFRN entries - * @todo Find proper type-hints + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException + * @todo Find proper type-hints */ public static function entries($items, $owner) { @@ -134,6 +137,8 @@ class DFRN * @param boolean $onlyheader Output only the header without content? (Default is "no") * * @return string DFRN feed entries + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function feed($dfrn_id, $owner_nick, $last_update, $direction = 0, $onlyheader = false) { @@ -341,6 +346,8 @@ class DFRN * @param boolean $conversation Show the conversation. If false show the single post. * * @return string DFRN feed entry + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function itemFeed($item_id, $conversation = false) { @@ -406,7 +413,8 @@ class DFRN * @param array $owner Owner record * * @return string DFRN mail - * @todo Find proper type-hints + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @todo Find proper type-hints */ public static function mail($item, $owner) { @@ -442,7 +450,8 @@ class DFRN * @param array $owner Owner record * * @return string DFRN suggestions - * @todo Find proper type-hints + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @todo Find proper type-hints */ public static function fsuggest($item, $owner) { @@ -471,7 +480,8 @@ class DFRN * @param int $uid User ID * * @return string DFRN relocations - * @todo Find proper type-hints + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @todo Find proper type-hints */ public static function relocate($owner, $uid) { @@ -532,7 +542,8 @@ class DFRN * @param bool $public Is it a header for public posts? * * @return object XML root object - * @todo Find proper type-hints + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @todo Find proper type-hints */ private static function addHeader($doc, $owner, $authorelement, $alternatelink = "", $public = false) { @@ -608,7 +619,8 @@ class DFRN * @param boolean $public boolean * * @return object XML author object - * @todo Find proper type-hints + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @todo Find proper type-hints */ private static function addAuthor($doc, $owner, $authorelement, $public) { @@ -752,7 +764,8 @@ class DFRN * @param array $item Item elements * * @return object XML author object - * @todo Find proper type-hints + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @todo Find proper type-hints */ private static function addEntryAuthor($doc, $element, $contact_url, $item) { @@ -793,7 +806,8 @@ class DFRN * @param string $activity activity value * * @return object XML activity object - * @todo Find proper type-hints + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @todo Find proper type-hints */ private static function createActivity($doc, $element, $activity) { @@ -858,8 +872,8 @@ class DFRN * @param object $root XML root * @param array $item Item element * - * @return object XML attachment object - * @todo Find proper type-hints + * @return void XML attachment object + * @todo Find proper type-hints */ private static function getAttachment($doc, $root, $item) { @@ -899,7 +913,9 @@ class DFRN * @param bool $single If set, the entry is created as an XML document with a single "entry" element * * @return object XML entry object - * @todo Find proper type-hints + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException + * @todo Find proper type-hints */ private static function entry($doc, $type, array $item, array $owner, $comment = false, $cid = 0, $single = false) { @@ -1155,8 +1171,11 @@ class DFRN * @param string $atom Content that will be transmitted * @param bool $dissolve (to be documented) * + * @param bool $legacy_transport * @return int Deliver status. Negative values mean an error. - * @todo Add array type-hint for $owner, $contact + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException + * @todo Add array type-hint for $owner, $contact */ public static function deliver($owner, $contact, $atom, $dissolve = false, $legacy_transport = false) { @@ -1412,11 +1431,14 @@ class DFRN /** * @brief Transmits atom content to the contacts via the Diaspora transport layer * - * @param array $owner Owner record - * @param array $contact Contact record of the receiver - * @param string $atom Content that will be transmitted + * @param array $owner Owner record + * @param array $contact Contact record of the receiver + * @param string $atom Content that will be transmitted * + * @param bool $public_batch * @return int Deliver status. Negative values mean an error. + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function transmit($owner, $contact, $atom, $public_batch = false) { @@ -1514,7 +1536,9 @@ class DFRN * @param string $xml optional, default empty * * @return array Relevant data of the author - * @todo Find good type-hints for all parameter + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException + * @todo Find good type-hints for all parameter */ private static function fetchauthor($xpath, $context, $importer, $element, $onlyfetch, $xml = "") { @@ -1835,7 +1859,8 @@ class DFRN * @param object $mail mail elements * @param array $importer Record of the importer user mixed with contact of the content * @return void - * @todo Find good type-hints for all parameter + * @throws \Exception + * @todo Find good type-hints for all parameter */ private static function processMail($xpath, $mail, $importer) { @@ -1890,7 +1915,8 @@ class DFRN * @param object $suggestion suggestion elements * @param array $importer Record of the importer user mixed with contact of the content * @return boolean - * @todo Find good type-hints for all parameter + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @todo Find good type-hints for all parameter */ private static function processSuggestion($xpath, $suggestion, $importer) { @@ -2008,7 +2034,9 @@ class DFRN * @param object $relocation relocation elements * @param array $importer Record of the importer user mixed with contact of the content * @return boolean - * @todo Find good type-hints for all parameter + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException + * @todo Find good type-hints for all parameter */ private static function processRelocation($xpath, $relocation, $importer) { @@ -2092,7 +2120,8 @@ class DFRN * @param array $importer Record of the importer user mixed with contact of the content * @param int $entrytype Is it a toplevel entry, a comment or a relayed comment? * @return mixed - * @todo set proper type-hints (array?) + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @todo set proper type-hints (array?) */ private static function updateContent($current, $item, $importer, $entrytype) { @@ -2123,7 +2152,8 @@ class DFRN * @param array $item the new item record * * @return int Is it a toplevel entry, a comment or a relayed comment? - * @todo set proper type-hints (array?) + * @throws \Exception + * @todo set proper type-hints (array?) */ private static function getEntryType($importer, $item) { @@ -2190,7 +2220,8 @@ class DFRN * @param array $importer Record of the importer user mixed with contact of the content * @param int $posted_id The record number of item record that was just posted * @return void - * @todo set proper type-hints (array?) + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @todo set proper type-hints (array?) */ private static function doPoke($item, $importer, $posted_id) { @@ -2253,7 +2284,8 @@ class DFRN * @param bool $is_like Is the verb a "like"? * * @return bool Should the processing of the entries be continued? - * @todo set proper type-hints (array?) + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @todo set proper type-hints (array?) */ private static function processVerbs($entrytype, $importer, &$item, &$is_like) { @@ -2400,7 +2432,9 @@ class DFRN * @param array $importer Record of the importer user mixed with contact of the content * @param object $xml xml * @return void - * @todo Add type-hints + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException + * @todo Add type-hints */ private static function processEntry($header, $xpath, $entry, $importer, $xml) { @@ -2741,7 +2775,8 @@ class DFRN * @param object $deletion deletion elements * @param array $importer Record of the importer user mixed with contact of the content * @return void - * @todo set proper type-hints + * @throws \Exception + * @todo set proper type-hints */ private static function processDeletion($xpath, $deletion, $importer) { @@ -2801,7 +2836,9 @@ class DFRN * @param array $importer Record of the importer user mixed with contact of the content * @param bool $sort_by_date Is used when feeds are polled * @return integer Import status - * @todo set proper type-hints + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException + * @todo set proper type-hints */ public static function import($xml, $importer, $sort_by_date = false) { @@ -2938,6 +2975,7 @@ class DFRN /** * @param App $a App * @param string $contact_nick contact nickname + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function autoRedir(App $a, $contact_nick) { @@ -3091,6 +3129,10 @@ class DFRN * item is assumed to be up-to-date. If the timestamps are equal it * assumes the update has been seen before and should be ignored. * + * @param $existing + * @param $update + * @return bool + * @throws \Exception */ private static function isEditedTimestampNewer($existing, $update) { diff --git a/src/Protocol/Diaspora.php b/src/Protocol/Diaspora.php index ed58350341..0087ced4b1 100644 --- a/src/Protocol/Diaspora.php +++ b/src/Protocol/Diaspora.php @@ -53,6 +53,7 @@ class Diaspora * @param array $contacts The previously fetched contacts * * @return array of relay servers + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function relayList($item_id, array $contacts = []) { @@ -138,6 +139,7 @@ class Diaspora * * @param string $server_url The url of the server * @return array with the contact + * @throws \Exception */ private static function getRelayContact($server_url) { @@ -169,8 +171,9 @@ class Diaspora /** * @brief Update or insert a relay contact * - * @param string $server_url The url of the server - * @param array $network_fields Optional network specific fields + * @param string $server_url The url of the server + * @param array $network_fields Optional network specific fields + * @throws \Exception */ public static function setRelayContact($server_url, array $network_fields = []) { @@ -204,6 +207,7 @@ class Diaspora * @param array $contacts The previously fetched contacts * * @return array of relay servers + * @throws \Exception */ public static function participantsForThread($thread, array $contacts) { @@ -250,6 +254,7 @@ class Diaspora * @param integer $level This value is only set inside this function to avoid endless loops * * @return string the repaired signature + * @throws \Exception */ private static function repairSignature($signature, $handle = "", $level = 1) { @@ -276,6 +281,8 @@ class Diaspora * @param string $envelope The magic envelope * * @return string verified data + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function verifyMagicEnvelope($envelope) { @@ -372,6 +379,8 @@ class Diaspora * 'message' -> decoded Diaspora XML message * 'author' -> author diaspora handle * 'key' -> author public key (converted to pkcs#8) + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function decodeRaw(array $importer, $raw, $no_exit = false) { @@ -475,6 +484,8 @@ class Diaspora * 'message' -> decoded Diaspora XML message * 'author' -> author diaspora handle * 'key' -> author public key (converted to pkcs#8) + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function decode(array $importer, $xml) { @@ -612,6 +623,8 @@ class Diaspora * @param array $msg The post that will be dispatched * * @return int The message id of the generated message, "true" or "false" if there was an error + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function dispatchPublic($msg) { @@ -640,6 +653,8 @@ class Diaspora * @param object $fields SimpleXML object that contains the message * * @return int The message id of the generated message, "true" or "false" if there was an error + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function dispatch(array $importer, $msg, $fields = null) { @@ -746,6 +761,8 @@ class Diaspora * @param array $msg Array with the XML, the sender handle and the sender signature * * @return bool|array If the posting is valid then an array with an SimpleXML object is returned + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function validPosting($msg) { @@ -894,6 +911,8 @@ class Diaspora * @param string $handle The handle * * @return string The public key + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function key($handle) { @@ -915,6 +934,8 @@ class Diaspora * @param string $handle The handle * * @return array the queried data + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function personByHandle($handle) { @@ -960,6 +981,7 @@ class Diaspora * @brief Updates the fcontact table * * @param array $arr The fcontact data + * @throws \Exception */ private static function updateFContact($arr) { @@ -983,6 +1005,7 @@ class Diaspora * @param int $pcontact_id The id in the contact table (Used for the public contact) * * @return string the handle + * @throws \Exception */ private static function handleFromContact($contact_id, $pcontact_id = 0) { @@ -1029,6 +1052,7 @@ class Diaspora * @param mixed $fcontact_guid Hexadecimal string guid * * @return string the contact url or null + * @throws \Exception */ public static function urlFromContactGuid($fcontact_guid) { @@ -1050,12 +1074,14 @@ class Diaspora /** * @brief Get a contact id for a given handle * - * @todo Move to Friendica\Model\Contact + * @todo Move to Friendica\Model\Contact * * @param int $uid The user id * @param string $handle The handle in the format user@domain.tld * * @return int Contact id + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function contactByHandle($uid, $handle) { @@ -1139,6 +1165,7 @@ class Diaspora * @param bool $is_comment Is the check for a comment? * * @return array The contact data + * @throws \Exception */ private static function allowedContactByHandle(array $importer, $handle, $is_comment = false) { @@ -1169,6 +1196,7 @@ class Diaspora * @param string $guid The guid of the message * * @return int|bool message id if the message already was stored into the system - or false. + * @throws \Exception */ private static function messageExists($uid, $guid) { @@ -1249,6 +1277,8 @@ class Diaspora * @param array $match array containing a link that has to be checked for a message link * @param array $item The item array * @return void + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function fetchGuidSub($match, $item) { @@ -1265,6 +1295,8 @@ class Diaspora * @param int $uid The user id of the user * * @return int the message id of the stored message or false + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function storeByGuid($guid, $server, $uid = 0) { @@ -1301,6 +1333,7 @@ class Diaspora * 'message' => The message XML * 'author' => The author handle * 'key' => The public key of the author + * @throws \Exception */ private static function message($guid, $server, $level = 0) { @@ -1377,6 +1410,7 @@ class Diaspora * @param array $contact The contact of the item owner * * @return array the item record + * @throws \Exception */ private static function parentItem($uid, $guid, $author, array $contact) { @@ -1421,6 +1455,7 @@ class Diaspora * @return array * 'cid' => contact id * 'network' => network type + * @throws \Exception */ private static function authorContactByUrl($def_contact, $person, $uid) { @@ -1457,6 +1492,8 @@ class Diaspora * @param string $parent_guid optional parent guid * * @return string the post link + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function plink($addr, $guid, $parent_guid = '') { @@ -1493,6 +1530,8 @@ class Diaspora * @param object $data The message object * * @return bool Success + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function receiveAccountMigration(array $importer, $data) { @@ -1550,9 +1589,10 @@ class Diaspora /** * @brief Processes an account deletion * - * @param object $data The message object + * @param object $data The message object * * @return bool Success + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function receiveAccountDeletion($data) { @@ -1578,6 +1618,8 @@ class Diaspora * @param boolean $onlyfound Only return uri when found in the database * * @return string The constructed uri or the one from our database + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function getUriFromGuid($author, $guid, $onlyfound = false) { @@ -1604,6 +1646,7 @@ class Diaspora * @param string $uid Author handle * * @return string The post guid + * @throws \Exception */ private static function getGuidFromUri($uri, $uid) { @@ -1621,6 +1664,7 @@ class Diaspora * @param string $guid The guid of the item * * @return array|boolean the origin owner of that post - or false + * @throws \Exception */ private static function importerForGuid($guid) { @@ -1644,6 +1688,8 @@ class Diaspora * @param string $xml The original XML of the message * * @return int The message id of the generated comment or "false" if there was an error + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function receiveComment(array $importer, $sender, $data, $xml) { @@ -1761,6 +1807,7 @@ class Diaspora * @param array $conversation The conversation record to which this message belongs * * @return bool "true" if it was successful + * @throws \Exception */ private static function receiveConversationMessage(array $importer, array $contact, $data, $msg, $mesg, $conversation) { @@ -1850,6 +1897,7 @@ class Diaspora * @param object $data The message object * * @return bool Success + * @throws \Exception */ private static function receiveConversation(array $importer, $msg, $data) { @@ -1908,6 +1956,8 @@ class Diaspora * @param object $data The message object * * @return int The message id of the generated like or "false" if there was an error + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function receiveLike(array $importer, $sender, $data) { @@ -2017,6 +2067,7 @@ class Diaspora * @param object $data The message object * * @return bool Success? + * @throws \Exception */ private static function receiveMessage(array $importer, $data) { @@ -2109,6 +2160,8 @@ class Diaspora * @param object $data The message object * * @return bool always true + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function receiveParticipation(array $importer, $data) { @@ -2202,6 +2255,8 @@ class Diaspora * @param object $data The message object * * @return bool Success + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function receiveProfile(array $importer, $data) { @@ -2295,6 +2350,7 @@ class Diaspora * @param array $importer Array of the importer user * @param array $contact The contact that send the request * @return void + * @throws \Exception */ private static function receiveRequestMakeFriend(array $importer, array $contact) { @@ -2316,6 +2372,7 @@ class Diaspora * @param object $data The message object * * @return bool Success + * @throws \Exception */ private static function receiveContactRequest(array $importer, $data) { @@ -2496,9 +2553,9 @@ class Diaspora * * @param string $guid message guid * @param string $orig_author handle of the original post - * @param string $author handle of the sharer - * * @return array The fetched item + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function originalItem($guid, $orig_author) { @@ -2579,6 +2636,8 @@ class Diaspora * @param string $xml The original XML of the message * * @return int the message id + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function receiveReshare(array $importer, $data, $xml) { @@ -2671,6 +2730,7 @@ class Diaspora * @param object $data The message object * * @return bool success + * @throws \Exception */ private static function itemRetraction(array $importer, array $contact, $data) { @@ -2735,6 +2795,7 @@ class Diaspora * @param object $data The message object * * @return bool Success + * @throws \Exception */ private static function receiveRetraction(array $importer, $sender, $data) { @@ -2775,11 +2836,13 @@ class Diaspora /** * @brief Receives status messages * - * @param array $importer Array of the importer user - * @param object $data The message object - * @param string $xml The original XML of the message + * @param array $importer Array of the importer user + * @param SimpleXMLElement $data The message object + * @param string $xml The original XML of the message * * @return int The message id of the newly created item + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function receiveStatusMessage(array $importer, SimpleXMLElement $data, $xml) { @@ -2900,6 +2963,7 @@ class Diaspora * @param array $contact contact array * * @return string the handle in the format user@domain.tld + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function myHandle(array $contact) { @@ -2929,6 +2993,7 @@ class Diaspora * @param string $pubkey The public key of the receiver * * @return string The encrypted data + * @throws \Exception */ public static function encodePrivateData($msg, array $user, array $contact, $prvkey, $pubkey) { @@ -2967,6 +3032,7 @@ class Diaspora * @param array $user The record of the sender * * @return string The envelope + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function buildMagicEnvelope($msg, array $user) { @@ -3010,6 +3076,7 @@ class Diaspora * @param bool $public Is the message public? * * @return string The message that will be transmitted to other servers + * @throws \Exception */ public static function buildMessage($msg, array $user, array $contact, $prvkey, $pubkey, $public = false) { @@ -3053,7 +3120,10 @@ class Diaspora * @param bool $queue_run Is the transmission called from the queue? * @param string $guid message guid * + * @param bool $no_queue * @return int Result of the transmission + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function transmit(array $owner, array $contact, $envelope, $public_batch, $queue_run = false, $guid = "", $no_queue = false) { @@ -3145,6 +3215,8 @@ class Diaspora * @param bool $spool Should the transmission be spooled or transmitted? * * @return int Result of the transmission + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function buildAndTransmit(array $owner, array $contact, $type, $message, $public_batch = false, $guid = "", $spool = false) { @@ -3176,9 +3248,10 @@ class Diaspora * @brief sends a participation (Used to get all further updates) * * @param array $contact Target of the communication - * @param array $item Item array + * @param array $item Item array * * @return int The result of the transmission + * @throws \Exception */ private static function sendParticipation(array $contact, array $item) { @@ -3225,9 +3298,11 @@ class Diaspora * * @param array $owner the array of the item owner * @param array $contact Target of the communication - * @param int $uid User ID + * @param int $uid User ID * * @return int The result of the transmission + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function sendAccountMigration(array $owner, array $contact, $uid) { @@ -3253,6 +3328,7 @@ class Diaspora * @param array $contact Target of the communication * * @return int The result of the transmission + * @throws \Exception */ public static function sendShare(array $owner, array $contact) { @@ -3296,6 +3372,7 @@ class Diaspora * @param array $contact Target of the communication * * @return int The result of the transmission + * @throws \Exception */ public static function sendUnshare(array $owner, array $contact) { @@ -3316,6 +3393,8 @@ class Diaspora * @param bool $complete Should it be a complete check or a simple check? * * @return array|bool Reshare details or "false" if no reshare + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function isReshare($body, $complete = true) { @@ -3403,6 +3482,7 @@ class Diaspora * @param integer $event_id The id of the event * * @return array with event data + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function buildEvent($event_id) { @@ -3485,6 +3565,8 @@ class Diaspora * @return array * 'type' -> Message type ("status_message" or "reshare") * 'message' -> Array of XML elements of the status + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function buildStatus(array $item, array $owner) { @@ -3599,6 +3681,8 @@ class Diaspora * @param bool $public_batch Is it a public post? * * @return int The result of the transmission + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function sendStatus(array $item, array $owner, array $contact, $public_batch = false) { @@ -3614,6 +3698,7 @@ class Diaspora * @param array $owner the array of the item owner * * @return array The data for a "like" + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function constructLike(array $item, array $owner) { @@ -3645,6 +3730,7 @@ class Diaspora * @param array $owner the array of the item owner * * @return array The data for an "EventParticipation" + * @throws \Exception */ private static function constructAttend(array $item, array $owner) { @@ -3682,6 +3768,7 @@ class Diaspora * @param array $owner the array of the item owner * * @return array The data for a comment + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function constructComment(array $item, array $owner) { @@ -3726,6 +3813,8 @@ class Diaspora * @param bool $public_batch Is it a public post? * * @return int The result of the transmission + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function sendFollowup(array $item, array $owner, array $contact, $public_batch = false) { @@ -3752,10 +3841,8 @@ class Diaspora /** * @brief Creates a message from a signature record entry * - * @param array $item The item that will be exported - * @param array $signature The entry of the "sign" record - * - * @return string The message + * @param array $item The item that will be exported + * @return array The message */ private static function messageFromSignature(array $item) { @@ -3806,6 +3893,7 @@ class Diaspora * @param bool $public_batch Is it a public post? * * @return int The result of the transmission + * @throws \Exception */ public static function sendRelay(array $item, array $owner, array $contact, $public_batch = false) { @@ -3862,6 +3950,7 @@ class Diaspora * @param bool $relay Is the retraction transmitted from a relay? * * @return int The result of the transmission + * @throws \Exception */ public static function sendRetraction(array $item, array $owner, array $contact, $public_batch = false, $relay = false) { @@ -3894,6 +3983,8 @@ class Diaspora * @param array $contact Target of the communication * * @return int The result of the transmission + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function sendMail(array $item, array $owner, array $contact) { @@ -4004,6 +4095,7 @@ class Diaspora * @param int $uid The user id * * @return array The profile data + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function createProfileData($uid) { @@ -4088,6 +4180,7 @@ class Diaspora * @param int $uid The user id * @param bool $recips optional, default false * @return void + * @throws \Exception */ public static function sendProfile($uid, $recips = false) { @@ -4129,6 +4222,7 @@ class Diaspora * @param array $item Item array * * @return array Signed content + * @throws \Exception */ public static function createLikeSignature($uid, array $item) { @@ -4159,6 +4253,7 @@ class Diaspora * @param array $item Item array * * @return array Signed content + * @throws \Exception */ public static function createCommentSignature($uid, array $item) { diff --git a/src/Protocol/Email.php b/src/Protocol/Email.php index 87f4091e5e..55bef6d253 100644 --- a/src/Protocol/Email.php +++ b/src/Protocol/Email.php @@ -19,6 +19,7 @@ class Email * @param string $username The username * @param string $password The password * @return object + * @throws \Exception */ public static function connect($mailbox, $username, $password) { @@ -45,6 +46,7 @@ class Email * @param object $mbox mailbox * @param string $email_addr email * @return array + * @throws \Exception */ public static function poll($mbox, $email_addr) { @@ -106,6 +108,7 @@ class Email * @param integer $uid user id * @param string $reply reply * @return array + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function getMessage($mbox, $uid, $reply) { @@ -321,6 +324,8 @@ class Email * * @return void * + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException * @todo This could be changed to use the Emailer class */ public static function send($addr, $subject, $headers, $item) diff --git a/src/Protocol/Feed.php b/src/Protocol/Feed.php index 91341328a1..86e831c705 100644 --- a/src/Protocol/Feed.php +++ b/src/Protocol/Feed.php @@ -25,13 +25,14 @@ class Feed { /** * @brief Read a RSS/RDF/Atom feed and create an item entry for it * - * @param string $xml The feed data - * @param array $importer The user record of the importer - * @param array $contact The contact record of the feed - * @param string $hub Unused dummy value for compatibility reasons - * @param bool $simulate If enabled, no data is imported + * @param string $xml The feed data + * @param array $importer The user record of the importer + * @param array $contact The contact record of the feed + * @param string $hub Unused dummy value for compatibility reasons + * @param bool $simulate If enabled, no data is imported * * @return array In simulation mode it returns the header and the first item + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function import($xml, $importer, &$contact, &$hub, $simulate = false) { diff --git a/src/Protocol/OStatus.php b/src/Protocol/OStatus.php index 458fee1620..84a97c20a3 100644 --- a/src/Protocol/OStatus.php +++ b/src/Protocol/OStatus.php @@ -43,13 +43,15 @@ class OStatus /** * @brief Fetches author data * - * @param object $xpath The xpath object - * @param object $context The xml context of the author details - * @param array $importer user record of the importing user - * @param array $contact Called by reference, will contain the fetched contact - * @param bool $onlyfetch Only fetch the header without updating the contact entries + * @param DOMXPath $xpath The xpath object + * @param object $context The xml context of the author details + * @param array $importer user record of the importing user + * @param array $contact Called by reference, will contain the fetched contact + * @param bool $onlyfetch Only fetch the header without updating the contact entries * * @return array Array of author related entries for the item + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function fetchAuthor(DOMXPath $xpath, $context, array $importer, array &$contact = null, $onlyfetch) { @@ -242,6 +244,8 @@ class OStatus * @param array $importer user record of the importing user * * @return array Array of author related entries for the item + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function salmonAuthor($xml, array $importer) { @@ -296,6 +300,8 @@ class OStatus * @param array $contact contact * @param string $hub Called by reference, returns the fetched hub data * @return void + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function import($xml, array $importer, array &$contact = null, &$hub) { @@ -313,6 +319,8 @@ class OStatus * @param boolean $initialize Is it the leading post so that data has to be initialized? * * @return boolean Could the XML be processed? + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function process($xml, array $importer, array &$contact = null, &$hub, $stored = false, $initialize = true) { @@ -556,8 +564,10 @@ class OStatus /** * Removes notice item from database + * * @param array $item item * @return void + * @throws \Exception */ private static function deleteNotice(array $item) { @@ -575,11 +585,13 @@ class OStatus /** * @brief Processes the XML for a post * - * @param object $xpath The xpath object - * @param object $entry The xml entry that is processed - * @param array $item The item array - * @param array $importer user record of the importing user + * @param DOMXPath $xpath The xpath object + * @param object $entry The xml entry that is processed + * @param array $item The item array + * @param array $importer user record of the importing user * @return void + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function processPost(DOMXPath $xpath, $entry, array &$item, array $importer) { @@ -725,6 +737,7 @@ class OStatus * @param string $conversation The link to the conversation * @param string $conversation_uri The conversation in "uri" format * @return void + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function fetchConversation($conversation, $conversation_uri) { @@ -787,6 +800,7 @@ class OStatus * @param string $conversation conversation * @param string $conversation_uri conversation uri * @return void + * @throws \Exception */ private static function storeConversation($xml, $conversation = '', $conversation_uri = '') { @@ -870,6 +884,7 @@ class OStatus * @param string $self The link to the self item * @param array $item The item array * @return void + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function fetchSelf($self, array &$item) { @@ -905,6 +920,8 @@ class OStatus * @param string $related_uri The related item in "uri" format * @param array $importer user record of the importing user * @return void + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function fetchRelated($related, $related_uri, $importer) { @@ -1008,12 +1025,14 @@ class OStatus /** * @brief Processes the XML for a repeated post * - * @param object $xpath The xpath object - * @param object $entry The xml entry that is processed - * @param array $item The item array - * @param array $importer user record of the importing user + * @param DOMXPath $xpath The xpath object + * @param object $entry The xml entry that is processed + * @param array $item The item array + * @param array $importer user record of the importing user * * @return array with data from links + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function processRepeatedItem(DOMXPath $xpath, $entry, array &$item, array $importer) { @@ -1223,6 +1242,7 @@ class OStatus * @param string $body The body * * @return string The cleaned body + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function formatPicturePost($body) { @@ -1257,12 +1277,13 @@ class OStatus /** * @brief Adds the header elements to the XML document * - * @param object $doc XML document - * @param array $owner Contact data of the poster - * @param string $filter The related feed filter (activity, posts or comments) - * @param bool $feed_mode Behave like a regular feed for users if true + * @param DOMDocument $doc XML document + * @param array $owner Contact data of the poster + * @param string $filter The related feed filter (activity, posts or comments) + * @param bool $feed_mode Behave like a regular feed for users if true * * @return object header root element + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function addHeader(DOMDocument $doc, array $owner, $filter, $feed_mode = false) { @@ -1347,10 +1368,11 @@ class OStatus /** * @brief Add the link to the push hubs to the XML document * - * @param object $doc XML document - * @param object $root XML root element where the hub links are added - * @param object $nick nick + * @param DOMDocument $doc XML document + * @param object $root XML root element where the hub links are added + * @param object $nick nick * @return void + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function hublinks(DOMDocument $doc, $root, $nick) { @@ -1361,14 +1383,14 @@ class OStatus /** * @brief Adds attachment data to the XML document * - * @param object $doc XML document - * @param object $root XML root element where the hub links are added - * @param array $item Data of the item that is to be posted + * @param DOMDocument $doc XML document + * @param object $root XML root element where the hub links are added + * @param array $item Data of the item that is to be posted * @return void + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function getAttachment(DOMDocument $doc, $root, $item) { - $o = ""; $siteinfo = BBCode::getAttachedData($item["body"]); switch ($siteinfo["type"]) { @@ -1433,11 +1455,12 @@ class OStatus /** * @brief Adds the author element to the XML document * - * @param object $doc XML document - * @param array $owner Contact data of the poster - * @param bool $show_profile Whether to show profile + * @param DOMDocument $doc XML document + * @param array $owner Contact data of the poster + * @param bool $show_profile Whether to show profile * * @return object author element + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function addAuthor(DOMDocument $doc, array $owner, $show_profile = true) { @@ -1550,13 +1573,15 @@ class OStatus /** * @brief Adds an entry element to the XML document * - * @param object $doc XML document - * @param array $item Data of the item that is to be posted - * @param array $owner Contact data of the poster - * @param bool $toplevel optional default false - * @param bool $feed_mode Behave like a regular feed for users if true + * @param DOMDocument $doc XML document + * @param array $item Data of the item that is to be posted + * @param array $owner Contact data of the poster + * @param bool $toplevel optional default false + * @param bool $feed_mode Behave like a regular feed for users if true * * @return object Entry element + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function entry(DOMDocument $doc, array $item, array $owner, $toplevel = false, $feed_mode = false) { @@ -1583,10 +1608,11 @@ class OStatus /** * @brief Adds a source entry to the XML document * - * @param object $doc XML document - * @param array $contact Array of the contact that is added + * @param DOMDocument $doc XML document + * @param array $contact Array of the contact that is added * * @return object Source element + * @throws \Exception */ private static function sourceEntry(DOMDocument $doc, array $contact) { @@ -1608,6 +1634,8 @@ class OStatus * @param array $owner Contact data of the poster * * @return array Contact array + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function contactEntry($url, array $owner) { @@ -1655,13 +1683,15 @@ class OStatus /** * @brief Adds an entry element with reshared content * - * @param object $doc XML document - * @param array $item Data of the item that is to be posted - * @param array $owner Contact data of the poster - * @param string $repeated_guid guid - * @param bool $toplevel Is it for en entry element (false) or a feed entry (true)? + * @param DOMDocument $doc XML document + * @param array $item Data of the item that is to be posted + * @param array $owner Contact data of the poster + * @param string $repeated_guid guid + * @param bool $toplevel Is it for en entry element (false) or a feed entry (true)? * - * @return object Entry element + * @return bool Entry element + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function reshareEntry(DOMDocument $doc, array $item, array $owner, $repeated_guid, $toplevel) { @@ -1719,12 +1749,14 @@ class OStatus /** * @brief Adds an entry element with a "like" * - * @param object $doc XML document - * @param array $item Data of the item that is to be posted - * @param array $owner Contact data of the poster - * @param bool $toplevel Is it for en entry element (false) or a feed entry (true)? + * @param DOMDocument $doc XML document + * @param array $item Data of the item that is to be posted + * @param array $owner Contact data of the poster + * @param bool $toplevel Is it for en entry element (false) or a feed entry (true)? * * @return object Entry element with "like" + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function likeEntry(DOMDocument $doc, array $item, array $owner, $toplevel) { @@ -1759,9 +1791,9 @@ class OStatus /** * @brief Adds the person object element to the XML document * - * @param object $doc XML document - * @param array $owner Contact data of the poster - * @param array $contact Contact data of the target + * @param DOMDocument $doc XML document + * @param array $owner Contact data of the poster + * @param array $contact Contact data of the target * * @return object author element */ @@ -1804,12 +1836,14 @@ class OStatus /** * @brief Adds a follow/unfollow entry element * - * @param object $doc XML document - * @param array $item Data of the follow/unfollow message - * @param array $owner Contact data of the poster - * @param bool $toplevel Is it for en entry element (false) or a feed entry (true)? + * @param DOMDocument $doc XML document + * @param array $item Data of the follow/unfollow message + * @param array $owner Contact data of the poster + * @param bool $toplevel Is it for en entry element (false) or a feed entry (true)? * * @return object Entry element + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function followEntry(DOMDocument $doc, array $item, array $owner, $toplevel) { @@ -1866,13 +1900,15 @@ class OStatus /** * @brief Adds a regular entry element * - * @param object $doc XML document - * @param array $item Data of the item that is to be posted - * @param array $owner Contact data of the poster - * @param bool $toplevel Is it for en entry element (false) or a feed entry (true)? - * @param bool $feed_mode Behave like a regular feed for users if true + * @param DOMDocument $doc XML document + * @param array $item Data of the item that is to be posted + * @param array $owner Contact data of the poster + * @param bool $toplevel Is it for en entry element (false) or a feed entry (true)? + * @param bool $feed_mode Behave like a regular feed for users if true * * @return object Entry element + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function noteEntry(DOMDocument $doc, array $item, array $owner, $toplevel, $feed_mode) { @@ -1894,12 +1930,15 @@ class OStatus /** * @brief Adds a header element to the XML document * - * @param object $doc XML document - * @param object $entry The entry element where the elements are added - * @param array $owner Contact data of the poster - * @param bool $toplevel Is it for en entry element (false) or a feed entry (true)? + * @param DOMDocument $doc XML document + * @param object $entry The entry element where the elements are added + * @param array $owner Contact data of the poster + * @param array $item + * @param bool $toplevel Is it for en entry element (false) or a feed entry (true)? * * @return string The title for the element + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function entryHeader(DOMDocument $doc, &$entry, array $owner, array $item, $toplevel) { @@ -1940,15 +1979,16 @@ class OStatus /** * @brief Adds elements to the XML document * - * @param object $doc XML document - * @param object $entry Entry element where the content is added - * @param array $item Data of the item that is to be posted - * @param array $owner Contact data of the poster - * @param string $title Title for the post - * @param string $verb The activity verb - * @param bool $complete Add the "status_net" element? - * @param bool $feed_mode Behave like a regular feed for users if true + * @param DOMDocument $doc XML document + * @param object $entry Entry element where the content is added + * @param array $item Data of the item that is to be posted + * @param array $owner Contact data of the poster + * @param string $title Title for the post + * @param string $verb The activity verb + * @param bool $complete Add the "status_net" element? + * @param bool $feed_mode Behave like a regular feed for users if true * @return void + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function entryContent(DOMDocument $doc, $entry, array $item, array $owner, $title, $verb = "", $complete = true, $feed_mode = false) { @@ -1988,13 +2028,14 @@ class OStatus /** * @brief Adds the elements at the foot of an entry to the XML document * - * @param object $doc XML document - * @param object $entry The entry element where the elements are added - * @param array $item Data of the item that is to be posted - * @param array $owner Contact data of the poster - * @param bool $complete default true - * @param bool $feed_mode Behave like a regular feed for users if true + * @param DOMDocument $doc XML document + * @param object $entry The entry element where the elements are added + * @param array $item Data of the item that is to be posted + * @param array $owner Contact data of the poster + * @param bool $complete default true + * @param bool $feed_mode Behave like a regular feed for users if true * @return void + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function entryFooter(DOMDocument $doc, $entry, array $item, array $owner, $complete = true, $feed_mode = false) { @@ -2159,6 +2200,8 @@ class OStatus * @param boolean $feed_mode Behave like a regular feed for users if true * * @return string XML feed + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function feed($owner_nick, &$last_update, $max_items = 300, $filter = 'activity', $nocache = false, $feed_mode = false) { @@ -2250,6 +2293,8 @@ class OStatus * @param array $owner Contact data of the poster * * @return string XML for the salmon + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function salmon(array $item, array $owner) { diff --git a/src/Protocol/PortableContact.php b/src/Protocol/PortableContact.php index dcdc9e2b14..fcbd26ecfa 100644 --- a/src/Protocol/PortableContact.php +++ b/src/Protocol/PortableContact.php @@ -44,7 +44,7 @@ class PortableContact * Once the global contact is stored add (if necessary) the contact linkage which associates * the given uid, cid to the global contact entry. There can be many uid/cid combinations * pointing to the same global contact id. - * + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function loadWorker($cid, $uid = 0, $zcid = 0, $url = null) { @@ -59,7 +59,7 @@ class PortableContact * @param integer $uid User ID * @param integer $zcid Global Contact ID * @param integer $url POCO address that should be polled - * + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function load($cid, $uid, $zcid, $url) { @@ -643,6 +643,7 @@ class PortableContact * * @param string $server_url address of the server * @return array Server data + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function fetchNodeinfo($server_url) { @@ -696,6 +697,7 @@ class PortableContact * * @param string $nodeinfo_url address of the nodeinfo path * @return array Server data + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function parseNodeinfo1($nodeinfo_url) { @@ -780,6 +782,7 @@ class PortableContact * * @param string $nodeinfo_url address of the nodeinfo path * @return array Server data + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function parseNodeinfo2($nodeinfo_url) { @@ -1444,6 +1447,7 @@ class PortableContact * @brief Fetch relay data from a given server url * * @param string $server_url address of the server + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function discoverRelay($server_url) { @@ -1542,6 +1546,7 @@ class PortableContact * @brief Fetch server list from remote servers and adds them when they are new. * * @param string $poco URL to the POCO endpoint + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function fetchServerlist($poco) { diff --git a/src/Protocol/Salmon.php b/src/Protocol/Salmon.php index 47376890d5..f8fa2f0540 100644 --- a/src/Protocol/Salmon.php +++ b/src/Protocol/Salmon.php @@ -22,6 +22,7 @@ class Salmon * @param string $uri Uniform Resource Identifier * @param string $keyhash encoded key * @return mixed + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function getKey($uri, $keyhash) { @@ -86,6 +87,7 @@ class Salmon * @param string $url url * @param string $slap slap * @return integer + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function slapper($owner, $url, $slap) { @@ -205,6 +207,7 @@ class Salmon /** * @param string $pubkey public key * @return string + * @throws \Exception */ public static function salmonKey($pubkey) { diff --git a/src/Util/Crypto.php b/src/Util/Crypto.php index 6e054df973..4f762964c9 100644 --- a/src/Util/Crypto.php +++ b/src/Util/Crypto.php @@ -42,7 +42,7 @@ class Crypto /** * @param string $Der der formatted string - * @param string $Private key type optional, default false + * @param bool $Private key type optional, default false * @return string */ private static function DerToPem($Der, $Private = false) @@ -149,6 +149,7 @@ class Crypto * @param string $m modulo reference * @param object $e exponent reference * @return void + * @throws \Exception */ private static function pubRsaToMe($key, &$m, &$e) { @@ -166,6 +167,7 @@ class Crypto /** * @param string $key key * @return string + * @throws \Exception */ public static function rsaToPem($key) { @@ -176,6 +178,7 @@ class Crypto /** * @param string $key key * @return string + * @throws \Exception */ private static function pemToRsa($key) { @@ -188,6 +191,7 @@ class Crypto * @param string $m modulo reference * @param string $e exponent reference * @return void + * @throws \Exception */ public static function pemToMe($key, &$m, &$e) { @@ -217,6 +221,7 @@ class Crypto /** * @param integer $bits number of bits * @return mixed + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function newKeypair($bits) { @@ -318,14 +323,15 @@ class Crypto } /** - * + * * Ported from Hubzilla: https://framagit.org/hubzilla/core/blob/master/include/crypto.php - * + * * @param string $data * @param string $pubkey The public key. * @param string $alg The algorithm used for encryption. - * + * * @return array + * @throws \Exception */ public static function encapsulate($data, $pubkey, $alg = 'aes256cbc') { @@ -336,14 +342,15 @@ class Crypto } /** - * + * * Ported from Hubzilla: https://framagit.org/hubzilla/core/blob/master/include/crypto.php - * - * @param type $data - * @param type $pubkey The public key. - * @param type $alg The algorithm used for encryption. - * + * + * @param string $data + * @param string $pubkey The public key. + * @param string $alg The algorithm used for encryption. + * * @return array + * @throws \Exception */ private static function encapsulateOther($data, $pubkey, $alg) { @@ -378,13 +385,14 @@ class Crypto } /** - * + * * Ported from Hubzilla: https://framagit.org/hubzilla/core/blob/master/include/crypto.php - * + * * @param string $data * @param string $pubkey - * + * * @return array + * @throws \Exception */ private static function encapsulateAes($data, $pubkey) { @@ -412,13 +420,14 @@ class Crypto } /** - * + * * Ported from Hubzilla: https://framagit.org/hubzilla/core/blob/master/include/crypto.php - * + * * @param string $data - * @param string $prvkey The private key used for decryption. - * + * @param string $prvkey The private key used for decryption. + * * @return string|boolean The decrypted string or false on failure. + * @throws \Exception */ public static function unencapsulate($data, $prvkey) { @@ -434,14 +443,15 @@ class Crypto } /** - * + * * Ported from Hubzilla: https://framagit.org/hubzilla/core/blob/master/include/crypto.php - * + * * @param string $data - * @param string $prvkey The private key used for decryption. + * @param string $prvkey The private key used for decryption. * @param string $alg - * + * * @return string|boolean The decrypted string or false on failure. + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function unencapsulateOther($data, $prvkey, $alg) { @@ -461,13 +471,14 @@ class Crypto } /** - * + * * Ported from Hubzilla: https://framagit.org/hubzilla/core/blob/master/include/crypto.php - * + * * @param array $data - * @param string $prvkey The private key used for decryption. - * + * @param string $prvkey The private key used for decryption. + * * @return string|boolean The decrypted string or false on failure. + * @throws \Exception */ private static function unencapsulateAes($data, $prvkey) { diff --git a/src/Util/DateTimeFormat.php b/src/Util/DateTimeFormat.php index 8eead1d2e5..0b47a16f15 100644 --- a/src/Util/DateTimeFormat.php +++ b/src/Util/DateTimeFormat.php @@ -26,6 +26,7 @@ class DateTimeFormat * @param string $time A date/time string * @param string $format DateTime format string or Temporal constant * @return string + * @throws Exception */ public static function utc($time, $format = self::MYSQL) { @@ -38,6 +39,7 @@ class DateTimeFormat * @param string $time A date/time string * @param string $format DateTime format string or Temporal constant * @return string + * @throws Exception */ public static function local($time, $format = self::MYSQL) { @@ -47,8 +49,10 @@ class DateTimeFormat /** * convert() shorthand for timezoned now. * + * @param $timezone * @param string $format DateTime format string or Temporal constant * @return string + * @throws Exception */ public static function timezoneNow($timezone, $format = self::MYSQL) { @@ -60,6 +64,7 @@ class DateTimeFormat * * @param string $format DateTime format string or Temporal constant * @return string + * @throws Exception */ public static function localNow($format = self::MYSQL) { @@ -71,6 +76,7 @@ class DateTimeFormat * * @param string $format DateTime format string or Temporal constant * @return string + * @throws Exception */ public static function utcNow($format = self::MYSQL) { @@ -84,9 +90,10 @@ class DateTimeFormat * @param string $tz_to Destination timezone * @param string $tz_from Source timezone * @param string $format Output format recognised from php's DateTime class - * http://www.php.net/manual/en/datetime.format.php + * http://www.php.net/manual/en/datetime.format.php * * @return string Formatted date according to given format + * @throws Exception */ public static function convert($s = 'now', $tz_to = 'UTC', $tz_from = 'UTC', $format = self::MYSQL) { diff --git a/src/Util/Emailer.php b/src/Util/Emailer.php index e9bcbc200d..cccf8c2fab 100644 --- a/src/Util/Emailer.php +++ b/src/Util/Emailer.php @@ -19,17 +19,18 @@ class Emailer * Send a multipart/alternative message with Text and HTML versions * * @param array $params parameters - * fromName name of the sender - * fromEmail email fo the sender - * replyTo replyTo address to direct responses - * toEmail destination email address - * messageSubject subject of the message - * htmlVersion html version of the message - * textVersion text only version of the message - * additionalMailHeader additions to the smtp mail header + * fromName name of the sender + * fromEmail email of the sender + * replyTo address to direct responses + * toEmail destination email address + * messageSubject subject of the message + * htmlVersion html version of the message + * textVersion text only version of the message + * additionalMailHeader additions to the SMTP mail header * optional uid user id of the destination user * * @return object + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function send($params) { diff --git a/src/Util/ExAuth.php b/src/Util/ExAuth.php index 28157c23ef..d341682e80 100644 --- a/src/Util/ExAuth.php +++ b/src/Util/ExAuth.php @@ -47,7 +47,6 @@ class ExAuth /** * @brief Create the class * - * @param boolean $bDebug Debug mode */ public function __construct() { @@ -63,6 +62,7 @@ class ExAuth * parameters * * @return null + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public function readStdin() { @@ -119,6 +119,7 @@ class ExAuth * @brief Check if the given username exists * * @param array $aCommand The command array + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private function isUser(array $aCommand) { @@ -165,11 +166,12 @@ class ExAuth /** * @brief Check remote user existance via HTTP(S) * - * @param string $host The hostname - * @param string $user Username - * @param boolean $ssl Should the check be done via SSL? + * @param string $host The hostname + * @param string $user Username + * @param boolean $ssl Should the check be done via SSL? * * @return boolean Was the user found? + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private function checkUser($host, $user, $ssl) { @@ -199,6 +201,7 @@ class ExAuth * @brief Authenticate the given user and password * * @param array $aCommand The command array + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private function auth(array $aCommand) { @@ -294,6 +297,7 @@ class ExAuth * @brief Set the hostname for this process * * @param string $host The hostname + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private function setHost($host) { diff --git a/src/Util/HTTPSignature.php b/src/Util/HTTPSignature.php index b54f500512..bff3287065 100644 --- a/src/Util/HTTPSignature.php +++ b/src/Util/HTTPSignature.php @@ -34,6 +34,7 @@ class HTTPSignature * @param $key * * @return array with verification data + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function verifyMagic($key) { @@ -188,6 +189,7 @@ class HTTPSignature * - \e string \b algorithm * - \e array \b headers * - \e string \b signature + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function parseSigheader($header) { @@ -235,6 +237,7 @@ class HTTPSignature * - \e string \b key * - \e string \b alg * - \e string \b data + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function decryptSigheader($header, $prvkey = null) { @@ -276,11 +279,12 @@ class HTTPSignature /** * @brief Transmit given data to a target for a user * - * @param array $data Data that is about to be send - * @param string $target The URL of the inbox - * @param integer $uid User id of the sender + * @param array $data Data that is about to be send + * @param string $target The URL of the inbox + * @param integer $uid User id of the sender * * @return boolean Was the transmission successful? + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function transmit($data, $target, $uid) { @@ -320,10 +324,11 @@ class HTTPSignature /** * @brief Fetches JSON data for a user * - * @param string $request request url - * @param integer $uid User id of the requester + * @param string $request request url + * @param integer $uid User id of the requester * * @return array JSON array + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function fetch($request, $uid) { @@ -372,7 +377,8 @@ class HTTPSignature * @param $content * @param $http_headers * - * @return signer string + * @return string Signer + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function getSigner($content, $http_headers) { @@ -493,6 +499,7 @@ class HTTPSignature * @param $actor * * @return array with actor url and public key + * @throws \Exception */ private static function fetchKey($id, $actor) { diff --git a/src/Util/JsonLD.php b/src/Util/JsonLD.php index e9c52d3d05..8cc9f274d9 100644 --- a/src/Util/JsonLD.php +++ b/src/Util/JsonLD.php @@ -18,7 +18,8 @@ class JsonLD * * @param $url * - * @return the loaded data + * @return mixed the loaded data + * @throws \JsonLdException */ public static function documentLoader($url) { @@ -53,7 +54,8 @@ class JsonLD * * @param array $json * - * @return normalized JSON string + * @return mixed|bool normalized JSON string + * @throws Exception */ public static function normalize($json) { @@ -77,7 +79,8 @@ class JsonLD * * @param array $json * - * @return comacted JSON array + * @return array Compacted JSON array + * @throws Exception */ public static function compact($json) { @@ -131,7 +134,7 @@ class JsonLD * @param $element * @param $key * - * @return fetched element array + * @return array fetched element */ public static function fetchElementArray($array, $element, $key = '@id') { @@ -172,7 +175,7 @@ class JsonLD * @param $type * @param $type_value * - * @return fetched element + * @return string fetched element */ public static function fetchElement($array, $element, $key = '@id', $type = null, $type_value = null) { diff --git a/src/Util/Network.php b/src/Util/Network.php index 5cac96b79c..4e4d329d3d 100644 --- a/src/Util/Network.php +++ b/src/Util/Network.php @@ -31,6 +31,7 @@ class Network * @param string $cookiejar Path to cookie jar file * * @return string The fetched content + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function fetchUrl($url, $binary = false, &$redirects = 0, $timeout = 0, $accept_content = null, $cookiejar = '') { @@ -55,6 +56,7 @@ class Network * @param string $cookiejar Path to cookie jar file * * @return CurlResult With all relevant information, 'body' contains the actual fetched content. + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function fetchUrlFull($url, $binary = false, &$redirects = 0, $timeout = 0, $accept_content = null, $cookiejar = '') { @@ -86,6 +88,7 @@ class Network * 'header' => header array * * @return CurlResult + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function curl($url, $binary = false, &$redirects = 0, $opts = []) { @@ -245,6 +248,7 @@ class Network * @param integer $timeout The timeout in seconds, default system config value or 60 seconds * * @return CurlResult The content + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function post($url, $params, $headers = null, &$redirects = 0, $timeout = 0) { @@ -347,6 +351,7 @@ class Network * * @param string $url The URL to be validated * @return string|boolean The actual working URL, false else + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function isUrlValid($url) { @@ -378,6 +383,7 @@ class Network * * @param string $addr The email address * @return boolean True if it's a valid email address, false if it's not + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function isEmailDomainValid($addr) { @@ -409,6 +415,7 @@ class Network * * @param string $url URL which get tested * @return boolean True if url is allowed otherwise return false + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function isUrlAllowed($url) { @@ -454,6 +461,7 @@ class Network * @param string $url The url to check the domain from * * @return boolean + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function isUrlBlocked($url) { @@ -483,7 +491,8 @@ class Network * * @param string $email email address * @return boolean False if not allowed, true if allowed - * or if allowed list is not configured + * or if allowed list is not configured + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function isEmailDomainAllowed($email) { @@ -597,14 +606,15 @@ class Network * This function strips tracking query params and follows redirections, either * through HTTP code or meta refresh tags. Stops after 10 redirections. * - * @todo Remove the $fetchbody parameter that generates an extraneous HEAD request + * @todo Remove the $fetchbody parameter that generates an extraneous HEAD request * - * @see ParseUrl::getSiteinfo + * @see ParseUrl::getSiteinfo * * @param string $url A user-submitted URL * @param int $depth The current redirection recursion level (internal) * @param bool $fetchbody Wether to fetch the body or not after the HEAD requests * @return string A canonical URL + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function finalUrl($url, $depth = 1, $fetchbody = false) { diff --git a/src/Util/ParseUrl.php b/src/Util/ParseUrl.php index cdafc7387b..e2bd1e4e5b 100644 --- a/src/Util/ParseUrl.php +++ b/src/Util/ParseUrl.php @@ -22,10 +22,10 @@ class ParseUrl * @brief Search for chached embeddable data of an url otherwise fetch it * * @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 + * @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 * string 'url' => The url of the parsed page @@ -37,7 +37,8 @@ class ParseUrl * array'images' = Array of preview pictures * string 'keywords' => The tags which belong to the content * - * @see ParseUrl::getSiteinfo() for more information about scraping + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @see ParseUrl::getSiteinfo() for more information about scraping * embeddable content */ public static function getSiteinfoCached($url, $no_guessing = false, $do_oembed = true) @@ -68,6 +69,7 @@ class ParseUrl return $data; } + /** * @brief Parse a page for embeddable content information * @@ -79,11 +81,11 @@ class ParseUrl * \ * * @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 - * @param int $count Internal counter to avoid endless loops + * @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 + * @param int $count Internal counter to avoid endless loops * * @return array which contains needed data for embedding * string 'url' => The url of the parsed page @@ -95,7 +97,8 @@ class ParseUrl * array'images' = Array of preview pictures * string 'keywords' => The tags which belong to the content * - * @todo https://developers.google.com/+/plugins/snippet/ + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @todo https://developers.google.com/+/plugins/snippet/ * @verbatim * * diff --git a/src/Util/Proxy.php b/src/Util/Proxy.php index be70077f15..fc65047b93 100644 --- a/src/Util/Proxy.php +++ b/src/Util/Proxy.php @@ -60,6 +60,7 @@ class Proxy * @param string $size One of the ProxyUtils::SIZE_* constants * * @return string The proxyfied URL or relative path + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function proxifyUrl($url, $writemode = false, $size = '') { @@ -138,6 +139,7 @@ class Proxy * @param string $html Un-proxified HTML code * * @return string Proxified HTML code + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function proxifyHtml($html) { @@ -151,6 +153,7 @@ class Proxy * * @param string $url * @return boolean + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function isLocalImage($url) { @@ -190,6 +193,7 @@ class Proxy * * @param array $matches Matches from preg_replace_callback() * @return string Proxified HTML image tag + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function replaceUrl(array $matches) { diff --git a/src/Util/Strings.php b/src/Util/Strings.php index a11ac2fd58..0a476a76be 100644 --- a/src/Util/Strings.php +++ b/src/Util/Strings.php @@ -13,12 +13,13 @@ use Friendica\Core\Logger; */ class Strings { - /** - * @brief Generates a pseudo-random string of hexadecimal characters - * - * @param int $size - * @return string - */ + /** + * @brief Generates a pseudo-random string of hexadecimal characters + * + * @param int $size + * @return string + * @throws \Exception + */ public static function getRandomHex($size = 64) { $byte_size = ceil($size / 2); @@ -139,14 +140,15 @@ class Strings return $word; } - /** - * @brief Translate and format the network name of a contact - * - * @param string $network Network name of the contact (e.g. dfrn, rss and so on) - * @param string $url The contact url - * - * @return string Formatted network name - */ + /** + * Translate and format the network name of a contact + * + * @param string $network Network name of the contact (e.g. dfrn, rss and so on) + * @param string $url The contact url + * + * @return string Formatted network name + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + */ public static function formatNetworkName($network, $url = '') { if ($network != '') { @@ -240,12 +242,13 @@ class Strings return $s; } - /** - * @brief Decode Base64 Encoded URL and translate -_ to +/ - * @param string $s URL to decode - * - * @return string Decoded URL - */ + /** + * @brief Decode Base64 Encoded URL and translate -_ to +/ + * @param string $s URL to decode + * + * @return string Decoded URL + * @throws \Exception + */ public static function base64UrlDecode($s) { if (is_array($s)) { diff --git a/src/Util/Temporal.php b/src/Util/Temporal.php index b6392d72fc..b52b939565 100644 --- a/src/Util/Temporal.php +++ b/src/Util/Temporal.php @@ -99,12 +99,13 @@ class Temporal * arguments follow convention as other field_* template array: * 'name', 'label', $value, 'help' * - * @param string $name Name of the selector - * @param string $label Label for the selector + * @param string $name Name of the selector + * @param string $label Label for the selector * @param string $current Timezone - * @param string $help Help text + * @param string $help Help text * * @return string Parsed HTML + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function getTimezoneField($name = 'timezone', $label = '', $current = 'America/Los_Angeles', $help = '') { @@ -123,6 +124,7 @@ class Temporal * * @param string $dob Date of Birth * @return string Formatted HTML + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function getDateofBirthField($dob) { @@ -163,6 +165,7 @@ class Temporal * @param string $id ID and name of datetimepicker (defaults to "datetimepicker") * * @return string Parsed HTML output. + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function getDateField($min, $max, $default, $id = 'datepicker') { @@ -177,6 +180,7 @@ class Temporal * @param string $id ID and name of datetimepicker (defaults to "timepicker") * * @return string Parsed HTML output. + * @throws \Exception */ public static function getTimeField($h, $m, $id = 'timepicker') { @@ -189,6 +193,7 @@ class Temporal * @param DateTime $minDate Minimum date * @param DateTime $maxDate Maximum date * @param DateTime $defaultDate Default date + * @param $label * @param string $id Id and name of datetimepicker (defaults to "datetimepicker") * @param bool $pickdate true to show date picker (default) * @param bool $picktime true to show time picker (default) @@ -198,7 +203,8 @@ class Temporal * * @return string Parsed HTML output. * - * @todo Once browser support is better this could probably be replaced with + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @todo Once browser support is better this could probably be replaced with * native HTML5 date picker. */ public static function getDateTimeField( @@ -348,11 +354,12 @@ class Temporal * and become a year older. If you wish me happy birthday on January 1 * (San Bruno time), you'll be a day late. * - * @param string $dob Date of Birth - * @param string $owner_tz (optional) Timezone of the person of interest + * @param string $dob Date of Birth + * @param string $owner_tz (optional) Timezone of the person of interest * @param string $viewer_tz (optional) Timezone of the person viewing * * @return int Age in years + * @throws \Exception */ public static function getAgeByTimezone($dob, $owner_tz = '', $viewer_tz = '') { @@ -404,6 +411,7 @@ class Temporal * @param int $m Month (1=January, 12=December) * * @return string day 0 = Sunday through 6 = Saturday + * @throws \Exception */ private static function getFirstDayInMonth($y, $m) { @@ -420,14 +428,15 @@ class Temporal * altering td class. * Months count from 1. * - * @param int $y Year - * @param int $m Month + * @param int $y Year + * @param int $m Month * @param array $links (default null) * @param string $class * * @return string * - * @todo Provide (prev, next) links, define class variations for different size calendars + * @throws \Exception + * @todo Provide (prev, next) links, define class variations for different size calendars */ public static function getCalendarTable($y = 0, $m = 0, $links = null, $class = '') { diff --git a/src/Util/XML.php b/src/Util/XML.php index c115e4d0de..09072610c1 100644 --- a/src/Util/XML.php +++ b/src/Util/XML.php @@ -230,17 +230,18 @@ class XML * (namespaces, lowercase tags, get_attribute default changed, more...) * * Examples: $array = Xml::toArray(file_get_contents('feed.xml')); - * $array = Xml::toArray(file_get_contents('feed.xml', true, 1, 'attribute')); + * $array = Xml::toArray(file_get_contents('feed.xml', true, 1, 'attribute')); * - * @param object $contents The XML text - * @param boolean $namespaces True or false include namespace information - * in the returned array as array elements. - * @param integer $get_attributes 1 or 0. If this is 1 the function will get the attributes as well as the tag values - - * this results in a different array structure in the return value. - * @param string $priority Can be 'tag' or 'attribute'. This will change the way the resulting - * array sturcture. For 'tag', the tags are given more importance. + * @param object $contents The XML text + * @param boolean $namespaces True or false include namespace information + * in the returned array as array elements. + * @param integer $get_attributes 1 or 0. If this is 1 the function will get the attributes as well as the tag values - + * this results in a different array structure in the return value. + * @param string $priority Can be 'tag' or 'attribute'. This will change the way the resulting + * array sturcture. For 'tag', the tags are given more importance. * * @return array The parsed XML in an array form. Use print_r() to see the resulting array structure. + * @throws \Exception */ public static function toArray($contents, $namespaces = true, $get_attributes = 1, $priority = 'attribute') { diff --git a/src/Worker/APDelivery.php b/src/Worker/APDelivery.php index 2fabb4a4eb..798a9b49a1 100644 --- a/src/Worker/APDelivery.php +++ b/src/Worker/APDelivery.php @@ -21,6 +21,8 @@ class APDelivery extends BaseObject * @param integer $target_id * @param string $inbox * @param integer $uid + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ public static function execute($cmd, $target_id, $inbox, $uid) { diff --git a/src/Worker/Cron.php b/src/Worker/Cron.php index 837c0020fa..1db7d916d1 100644 --- a/src/Worker/Cron.php +++ b/src/Worker/Cron.php @@ -133,10 +133,11 @@ class Cron /** * @brief Poll contacts for unreceived messages * - * @todo Currently it seems as if the following parameter aren't used at all ... + * @todo Currently it seems as if the following parameter aren't used at all ... * - * @param string $parameter Parameter (force, restart, ...) for the contact polling + * @param string $parameter Parameter (force, restart, ...) for the contact polling * @param integer $generation + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function pollContacts($parameter, $generation) { $manual_id = 0; diff --git a/src/Worker/CronJobs.php b/src/Worker/CronJobs.php index ca50e0e75f..f723cf69f1 100644 --- a/src/Worker/CronJobs.php +++ b/src/Worker/CronJobs.php @@ -134,6 +134,7 @@ class CronJobs * @brief Clear cache entries * * @param App $a + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function clearCache(App $a) { @@ -231,6 +232,8 @@ class CronJobs * @brief Repair missing values in Diaspora contacts * * @param App $a + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function repairDiaspora(App $a) { diff --git a/src/Worker/DBClean.php b/src/Worker/DBClean.php index 67f073b10f..f123b2dd89 100644 --- a/src/Worker/DBClean.php +++ b/src/Worker/DBClean.php @@ -47,16 +47,17 @@ class DBClean { * * Values for $stage: * ------------------ - * 1: Old global item entries from item table without user copy. - * 2: Items without parents. - * 3: Orphaned data from thread table. - * 4: Orphaned data from notify table. - * 5: Orphaned data from notify-threads table. - * 6: Orphaned data from sign table. - * 7: Orphaned data from term table. - * 8: Expired threads. - * 9: Old global item entries from expired threads. - * 10: Old conversations. + * 1: Old global item entries from item table without user copy. + * 2: Items without parents. + * 3: Orphaned data from thread table. + * 4: Orphaned data from notify table. + * 5: Orphaned data from notify-threads table. + * 6: Orphaned data from sign table. + * 7: Orphaned data from term table. + * 8: Expired threads. + * 9: Old global item entries from expired threads. + * 10: Old conversations. + * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ private static function removeOrphans($stage) { $count = 0; diff --git a/src/Worker/Delivery.php b/src/Worker/Delivery.php index d7d9ac504d..49fe47c54c 100644 --- a/src/Worker/Delivery.php +++ b/src/Worker/Delivery.php @@ -230,6 +230,8 @@ class Delivery extends BaseObject * @param boolean $public_message Is the content public? * @param boolean $top_level Is it a thread starter? * @param boolean $followup Is it an answer to a remote post? + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function deliverDFRN($cmd, $contact, $owner, $items, $target_item, $public_message, $top_level, $followup) { @@ -351,6 +353,8 @@ class Delivery extends BaseObject * @param boolean $public_message Is the content public? * @param boolean $top_level Is it a thread starter? * @param boolean $followup Is it an answer to a remote post? + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function deliverDiaspora($cmd, $contact, $owner, $items, $target_item, $public_message, $top_level, $followup) { @@ -414,6 +418,8 @@ class Delivery extends BaseObject * @param array $contact Contact record of the receiver * @param array $owner Owner record of the sender * @param array $target_item Item record of the content + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function deliverMail($cmd, $contact, $owner, $target_item) { diff --git a/src/Worker/DiscoverPoCo.php b/src/Worker/DiscoverPoCo.php index 55eeec98f2..c2a81e7e72 100644 --- a/src/Worker/DiscoverPoCo.php +++ b/src/Worker/DiscoverPoCo.php @@ -267,6 +267,9 @@ class DiscoverPoCo * @brief Search for GNU Social user with gstools.org * * @param string $search User name + * @return bool + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function gsSearchUser($search) { diff --git a/src/Worker/Notifier.php b/src/Worker/Notifier.php index f6b1d23cf0..d991e6a4e9 100644 --- a/src/Worker/Notifier.php +++ b/src/Worker/Notifier.php @@ -515,9 +515,11 @@ class Notifier /** * @param int $self_user_id - * @param int $priority The priority the Notifier queue item was created with - * @param string $created The date the Notifier queue item was created on + * @param int $priority The priority the Notifier queue item was created with + * @param string $created The date the Notifier queue item was created on * @return bool + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function notifySelfRemoval($self_user_id, $priority, $created) { @@ -550,9 +552,11 @@ class Notifier * @param string $cmd * @param array $target_item * @param array $parent - * @param int $priority The priority the Notifier queue item was created with - * @param string $created The date the Notifier queue item was created on + * @param int $priority The priority the Notifier queue item was created with + * @param string $created The date the Notifier queue item was created on * @return int The number of delivery tasks created + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + * @throws \ImagickException */ private static function activityPubDelivery($cmd, array $target_item, array $parent, $priority, $created) { diff --git a/src/Worker/OnePoll.php b/src/Worker/OnePoll.php index 4cfcf1037e..112c79c8cd 100644 --- a/src/Worker/OnePoll.php +++ b/src/Worker/OnePoll.php @@ -698,7 +698,8 @@ class OnePoll * @brief Updates a personal contact entry and the public contact entry * * @param array $contact The personal contact entry - * @param array $fields The fields that are updated + * @param array $fields The fields that are updated + * @throws \Exception */ private static function updateContact(array $contact, array $fields) {