From dea1a98a5d3b7102076e89a8dde2abfd5e31acf0 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Fri, 7 Dec 2018 00:50:16 -0500 Subject: [PATCH] Fix various documentation issues/unused variables --- mod/group.php | 3 --- mod/item.php | 2 +- src/Model/Group.php | 2 -- src/Model/Item.php | 3 +-- src/Object/Post.php | 53 +++++++++++++++++++++++---------------------- 5 files changed, 29 insertions(+), 34 deletions(-) diff --git a/mod/group.php b/mod/group.php index 51fa2493e4..d3c0c8477b 100644 --- a/mod/group.php +++ b/mod/group.php @@ -129,7 +129,6 @@ function group_content(App $a) { $members = []; $preselected = []; - $entry = []; $context = $context + [ '$title' => $group['name'], @@ -191,8 +190,6 @@ function group_content(App $a) { $group = $r[0]; $members = Model\Contact::getByGroupId($group['id']); $preselected = []; - $entry = []; - $id = 0; if (count($members)) { foreach ($members as $member) { diff --git a/mod/item.php b/mod/item.php index 62b088a04f..c499e9ffc5 100644 --- a/mod/item.php +++ b/mod/item.php @@ -912,7 +912,7 @@ function item_content(App $a) * the appropiate link. * * @param App $a Application instance @TODO is unused in this function's scope (excluding included files) - * @param unknown_type $body the text to replace the tag in + * @param string $body the text to replace the tag in * @param string $inform a comma-seperated string containing everybody to inform * @param string $str_tags string to add the tag to * @param integer $profile_uid diff --git a/src/Model/Group.php b/src/Model/Group.php index 9a4fc23407..8981e2c647 100644 --- a/src/Model/Group.php +++ b/src/Model/Group.php @@ -351,8 +351,6 @@ class Group extends BaseObject */ public static function sidebarWidget($every = 'contact', $each = 'group', $editmode = 'standard', $group_id = '', $cid = 0) { - $o = ''; - if (!local_user()) { return ''; } diff --git a/src/Model/Item.php b/src/Model/Item.php index f4290aab97..09de6cfd1f 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -1238,8 +1238,6 @@ class Item extends BaseObject public static function insert($item, $force_parent = false, $notify = false, $dontcache = false) { - $a = \get_app(); - // If it is a posting where users should get notifications, then define it as wall posting if ($notify) { $item['wall'] = 1; @@ -1883,6 +1881,7 @@ class Item extends BaseObject * @brief Insert a new item content entry * * @param array $item The item fields that are to be inserted + * @return bool */ private static function insertActivity(&$item) { diff --git a/src/Object/Post.php b/src/Object/Post.php index dd2628d3ee..2bad9a6262 100644 --- a/src/Object/Post.php +++ b/src/Object/Post.php @@ -6,7 +6,6 @@ namespace Friendica\Object; use Friendica\BaseObject; use Friendica\Content\ContactSelector; -use Friendica\Content\Feature; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; @@ -16,6 +15,7 @@ use Friendica\Core\Protocol; use Friendica\Core\Renderer; use Friendica\Database\DBA; use Friendica\Model\Contact; +use Friendica\Model\Conversation; use Friendica\Model\Item; use Friendica\Model\Term; use Friendica\Util\Crypto; @@ -38,8 +38,15 @@ class Post extends BaseObject private $comment_box_template = 'comment_item.tpl'; private $toplevel = false; private $writable = false; + /** + * @var Post[] + */ private $children = []; private $parent = null; + + /** + * @var Thread + */ private $thread = null; private $redirect_url = null; private $owner_url = ''; @@ -56,8 +63,6 @@ class Post extends BaseObject */ public function __construct(array $data) { - $a = self::getApp(); - $this->data = $data; $this->setTemplate('wall'); $this->toplevel = $this->getId() == $this->getDataValue('parent'); @@ -105,16 +110,14 @@ class Post extends BaseObject /** * Get data in a form usable by a conversation template * - * @param object $conv_responses conversation responses + * @param array $conv_responses conversation responses * @param integer $thread_level default = 1 * * @return mixed The data requested on success * false on failure */ - public function getTemplateData($conv_responses, $thread_level = 1) + public function getTemplateData(array $conv_responses, $thread_level = 1) { - $result = []; - $a = self::getApp(); $item = $this->getData(); @@ -131,7 +134,6 @@ class Post extends BaseObject 'relative' => Temporal::getRelativeDate($item['edited']) ]; } - $commentww = ''; $sparkle = ''; $buttons = ''; $dropping = false; @@ -486,7 +488,7 @@ class Post extends BaseObject /** * Add a child item * - * @param object $item The child item to add + * @param Post $item The child item to add * * @return mixed */ @@ -536,7 +538,7 @@ class Post extends BaseObject /** * Get all our children * - * @return object + * @return Post[] */ public function getChildren() { @@ -546,11 +548,11 @@ class Post extends BaseObject /** * Set our parent * - * @param object $item The item to set as parent + * @param Post $item The item to set as parent * * @return void */ - protected function setParent($item) + protected function setParent(Post $item) { $parent = $this->getParent(); if ($parent) { @@ -575,11 +577,11 @@ class Post extends BaseObject /** * Remove a child * - * @param object $item The child to be removed + * @param Post $item The child to be removed * * @return boolean Success or failure */ - public function removeChild($item) + public function removeChild(Post $item) { $id = $item->getId(); foreach ($this->getChildren() as $key => $child) { @@ -606,28 +608,26 @@ class Post extends BaseObject } /** - * Set conversation + * Set conversation thread * - * @param object $conv The conversation + * @param Thread $thread * * @return void */ - public function setThread($conv) + public function setThread(Thread $thread = null) { - $previous_mode = ($this->thread ? $this->thread->getMode() : ''); - - $this->thread = $conv; + $this->thread = $thread; // Set it on our children too foreach ($this->getChildren() as $child) { - $child->setThread($conv); + $child->setThread($thread); } } /** * Get conversation * - * @return object + * @return Thread */ public function getThread() { @@ -649,7 +649,7 @@ class Post extends BaseObject /** * Get a data value * - * @param object $name key + * @param string $name key * * @return mixed value on success * false on failure @@ -667,9 +667,8 @@ class Post extends BaseObject /** * Set template * - * @param object $name template name - * - * @return void + * @param string $name template name + * @return bool */ private function setTemplate($name) { @@ -679,6 +678,8 @@ class Post extends BaseObject } $this->template = $this->available_templates[$name]; + + return true; } /**