use Friendica\BaseObject;
use Friendica\Content\ContactSelector;
-use Friendica\Content\Feature;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\L10n;
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;
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 = '';
*/
public function __construct(array $data)
{
- $a = self::getApp();
-
$this->data = $data;
$this->setTemplate('wall');
$this->toplevel = $this->getId() == $this->getDataValue('parent');
/**
* 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();
'relative' => Temporal::getRelativeDate($item['edited'])
];
}
- $commentww = '';
$sparkle = '';
$buttons = '';
$dropping = false;
/**
* Add a child item
*
- * @param object $item The child item to add
+ * @param Post $item The child item to add
*
* @return mixed
*/
/**
* Get all our children
*
- * @return object
+ * @return Post[]
*/
public function getChildren()
{
/**
* 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) {
/**
* 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) {
}
/**
- * 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()
{
/**
* Get a data value
*
- * @param object $name key
+ * @param string $name key
*
* @return mixed value on success
* false on failure
/**
* Set template
*
- * @param object $name template name
- *
- * @return void
+ * @param string $name template name
+ * @return bool
*/
private function setTemplate($name)
{
}
$this->template = $this->available_templates[$name];
+
+ return true;
}
/**