Skip to content

Commit

Permalink
! cleanup formatting / doceblocks etc
Browse files Browse the repository at this point in the history
  • Loading branch information
Spuds committed Jan 18, 2022
1 parent f29167a commit 4afb77b
Show file tree
Hide file tree
Showing 15 changed files with 31 additions and 81 deletions.
Expand Up @@ -13,7 +13,6 @@

namespace ElkArte\Mentions\MentionType;

use ElkArte\Mentions\MentionType\AbstractEventMessage;
use ElkArte\Themes\ThemeLoader;
use ElkArte\Util;

Expand All @@ -38,7 +37,7 @@ public function view($type, &$mentions)
continue;
}

// These things are associated to messages and require permission checks
// These things are associated to message and require permission checks
if (empty($row['id_board']))
{
$unset_keys[] = $key;
Expand Down
21 changes: 5 additions & 16 deletions sources/ElkArte/Mentions/MentionType/AbstractEventMessage.php
Expand Up @@ -14,36 +14,25 @@
namespace ElkArte\Mentions\MentionType;

use ElkArte\HttpReq;
use ElkArte\Mentions\MentionType\EventInterface;
use ElkArte\UserInfo;

/**
* Class AbstractEventMessage
*/
abstract class AbstractEventMessage implements EventInterface
{
/**
* The identifier of the mention (the name that is stored in the db)
*
* @var string
*/
/** @var string The identifier of the mention (the name that is stored in the db) */
protected static $_type = '';

/**
* The database object
*
* @var \ElkArte\HttpReq
*/
/** @var \ElkArte\HttpReq The post/get object */
protected $_request = null;

/**
* The current user object
*
* @var \ElkArte\ValuesContainer
*/
/** @var \ElkArte\ValuesContainer The current user object */
protected $user = null;

/**
* AbstractEventMessage constructor
*
* @param \ElkArte\HttpReq $http_req
* @param \ElkArte\UserInfo $user
*/
Expand Down
2 changes: 1 addition & 1 deletion sources/ElkArte/Mentions/MentionType/Event/Buddy.php
Expand Up @@ -17,7 +17,7 @@
use ElkArte\Mentions\MentionType\CommonConfigTrait;

/**
* Class BuddyMention
* Class Buddy
*
* Handles mentioning of buddies
*/
Expand Down
2 changes: 1 addition & 1 deletion sources/ElkArte/Mentions/MentionType/Event/Likemsg.php
Expand Up @@ -17,7 +17,7 @@
use ElkArte\Mentions\MentionType\CommonConfigTrait;

/**
* Class LikemsgMention
* Class Likemsg
*
* Handles mentions of likes
*/
Expand Down
2 changes: 1 addition & 1 deletion sources/ElkArte/Mentions/MentionType/Event/Mailfail.php
Expand Up @@ -17,7 +17,7 @@
use ElkArte\Mentions\MentionType\MailfailConfigTrait;

/**
* Class MailfailMention
* Class Mailfail
*
* Handles notifying users who have had email notifications disabled for failure to deliver
*/
Expand Down
2 changes: 1 addition & 1 deletion sources/ElkArte/Mentions/MentionType/Event/Mentionmem.php
Expand Up @@ -21,7 +21,7 @@
use ElkArte\NotificationsTask;

/**
* Class MentionmemMention
* Class Mentionmem
*
* Handles the mentioning of members (@ member actions)
*/
Expand Down
2 changes: 1 addition & 1 deletion sources/ElkArte/Mentions/MentionType/Event/Quotedmem.php
Expand Up @@ -21,7 +21,7 @@
use ElkArte\NotificationsTask;

/**
* Class QuotedmemMention
* Class Quotedmem
*
* Handles mentioning of members whose messages has been quoted
*/
Expand Down
2 changes: 1 addition & 1 deletion sources/ElkArte/Mentions/MentionType/Event/Rlikemsg.php
Expand Up @@ -17,7 +17,7 @@
use ElkArte\Mentions\MentionType\CommonConfigTrait;

/**
* Class RlikemsgMention
* Class Rlikemsg
*
* Handles the notification (or non-notification) of removed likes.
*/
Expand Down
Expand Up @@ -17,7 +17,7 @@
use ElkArte\Mentions\MentionType\CommonConfigTrait;

/**
* Class BuddyMention
* Class Buddy
*
* Handles mentioning of buddies
*/
Expand Down
Expand Up @@ -17,7 +17,7 @@
use ElkArte\Mentions\MentionType\CommonConfigTrait;

/**
* Class LikemsgMention
* Class Likemsg
*
* Handles mentions of likes
*/
Expand Down
Expand Up @@ -17,7 +17,7 @@
use ElkArte\Mentions\MentionType\MailfailConfigTrait;

/**
* Class MailfailMention
* Class Mailfail
*
* Handles notifying users who have had email notifications disabled for failure to deliver
*/
Expand Down
Expand Up @@ -17,7 +17,7 @@
use ElkArte\Mentions\MentionType\CommonConfigTrait;

/**
* Class MentionmemMention
* Class Mentionmem
*
* Handles the mentioning of members (@ member actions)
*/
Expand Down
Expand Up @@ -17,7 +17,7 @@
use ElkArte\Mentions\MentionType\CommonConfigTrait;

/**
* Class QuotedmemMention
* Class Quotedmem
*
* Handles mentioning of members whose messages has been quoted
*/
Expand Down
Expand Up @@ -17,7 +17,7 @@
use ElkArte\Mentions\MentionType\CommonConfigTrait;

/**
* Class RlikemsgMention
* Class Rlikemsg
*
* Handles the notification (or non-notification) of removed likes.
*/
Expand All @@ -41,7 +41,7 @@ public function setUsersToNotify()
}
else
{
// I'm not entirely sure this is necessary, but better safe than sorry at this point.
// I'm not entirely sure if this is necessary, but better safe than sorry at this point.
if (isset($this->_task))
{
$this->_task->setMembers([]);
Expand Down
62 changes: 12 additions & 50 deletions sources/ElkArte/Mentions/Mentioning.php
Expand Up @@ -24,61 +24,29 @@
*/
class Mentioning extends AbstractModel
{
/**
* Value assumed by a new mention
*
* @const int
*/
/** @const int Value assumed by a new mention */
public const MNEW = 0;

/**
* Value assumed by a mention that has been read
*
* @const int
*/
/** @const int Value assumed by a mention that has been read */
public const READ = 1;

/**
* Value assumed by a mention that has been deleted
*
* @const int
*/
/** @const int Value assumed by a mention that has been deleted */
public const DELETED = 2;

/**
* Value assumed by an unapproved mention
*
* @const int
*/
/** @const int Value assumed by an unapproved mention */
public const UNAPPROVED = 3;

/**
* Will hold all available mention types
*
* @var array
*/
/** @var array Will hold all available mention types */
protected $_known_mentions = array();

/**
* Will hold all available mention status
* 'new' => 0, 'read' => 1, 'deleted' => 2, 'unapproved' => 3,
*
* @var array
*/
/** @var array Will hold all available mention status
'new' => 0, 'read' => 1, 'deleted' => 2, 'unapproved' => 3 */
protected $_known_status = array();

/**
* Holds the instance of the data validation class
*
* @var object
*/
/** @var \ElkArte\DataValidator Holds the instance of the data validation class */
protected $_validator = null;

/**
* Holds the passed data for this instance, is passed through the validator
*
* @var array
*/
/** @var array Holds the passed data for this instance, is passed through the validator */
protected $_data = null;

/**
Expand Down Expand Up @@ -107,12 +75,11 @@ public function __construct($db, $user, $validator, $enabled_mentions = '')
/**
* Inserts a new mention.
*
* @param \ElkArte\Mentions\MentionType\NotificationInterface $mention_obj The object that knows how to store
* the mention in the database
* @param \ElkArte\Mentions\MentionType\NotificationInterface $mention_obj The object that knows
* how to store the mention in the database
* @param mixed[] $data must contain uid, type and msg at a minimum
*
* @return int[]
* @throws \ElkArte\Exceptions\Exception
*/
public function create($mention_obj, $data)
{
Expand Down Expand Up @@ -230,7 +197,6 @@ protected function _isValid()
* @param int $status
* @param int $member_id
* @package Mentions
* @throws \ElkArte\Exceptions\Exception
*/
protected function _updateMenuCount($status, $member_id)
{
Expand Down Expand Up @@ -260,7 +226,6 @@ protected function _updateMenuCount($status, $member_id)
*
* @param int|int[] $mention_id
* @return bool if successfully changed or not
* @throws \ElkArte\Exceptions\Exception
*/
public function markread($mention_id)
{
Expand All @@ -273,11 +238,10 @@ public function markread($mention_id)
* @param int|int[] $items
* @param string $mark
* @return bool if successfully changed or not
* @throws \ElkArte\Exceptions\Exception
*/
public function updateStatus($items, $mark)
{
// Make sure its all good
// Make sure it is all good
$own_id = $this->_getAccessible((array) $items, $mark);

if (!empty($own_id))
Expand Down Expand Up @@ -342,7 +306,6 @@ protected function _getAccessible($mention_ids, $action)
* @param string $status status to update, 'new', 'read', 'deleted', 'unapproved'
* @return bool if successfully changed or not
* @package Mentions
* @throws \ElkArte\Exceptions\Exception
*/
protected function _changeStatus($id_mentions, $status = 'read')
{
Expand All @@ -363,6 +326,5 @@ protected function _changeStatus($id_mentions, $status = 'read')
}

return $success;
require_once(SUBSDIR . '/Mentions.subs.php');
}
}

0 comments on commit 4afb77b

Please sign in to comment.