Changed parameter order

This commit is contained in:
Michael 2022-12-25 07:30:39 +00:00
parent dc73cbe30c
commit cef4349421
5 changed files with 19 additions and 17 deletions

View file

@ -23,21 +23,21 @@ namespace Friendica\Moderation\Entity;
/**
* @property-read int $id
* @property-read int $uid
* @property-read int $reporterId
* @property-read int $cid
* @property-read string $comment
* @property-read string|null $category
* @property-read bool $forward
* @property-read array $postUriIds
* @property-read int $uid
* @property-read \DateTime|null $created
*/
class Report extends \Friendica\BaseEntity
{
/** @var int|null */
protected $id;
/** @var int ID of the user making a moderation report*/
protected $reporterId;
/** @var int ID of the contact making a moderation report*/
protected $uid;
protected $reporterId;
/** @var int ID of the contact being reported*/
protected $cid;
/** @var string Optional comment */
@ -50,10 +50,11 @@ class Report extends \Friendica\BaseEntity
protected $created;
/** @var array Optional list of URI IDs of posts supporting the report*/
protected $postUriIds;
/** @var int ID of the user making a moderation report*/
protected $uid;
public function __construct(int $uid = null, int $reporterId, int $cid, \DateTime $created, string $comment = '', string $category = null, bool $forward = false, array $postUriIds = [], int $id = null)
public function __construct(int $reporterId, int $cid, \DateTime $created, string $comment = '', string $category = null, bool $forward = false, array $postUriIds = [], int $uid = null, int $id = null)
{
$this->uid = $uid;
$this->reporterId = $reporterId;
$this->cid = $cid;
$this->created = $created;
@ -61,6 +62,7 @@ class Report extends \Friendica\BaseEntity
$this->category = $category;
$this->forward = $forward;
$this->postUriIds = $postUriIds;
$this->uid = $uid;
$this->id = $id;
}
}

View file

@ -35,7 +35,6 @@ class Report extends \Friendica\BaseFactory implements ICanCreateFromTableRow
public function createFromTableRow(array $row, array $postUriIds = []): Entity\Report
{
return new Entity\Report(
$row['uid'],
$row['reporter-id'],
$row['cid'],
new \DateTime($row['created'] ?? 'now', new \DateTimeZone('UTC')),
@ -43,6 +42,7 @@ class Report extends \Friendica\BaseFactory implements ICanCreateFromTableRow
$row['category'],
$row['forward'],
$postUriIds,
$row['uid'],
$row['id'],
);
}
@ -61,10 +61,9 @@ class Report extends \Friendica\BaseFactory implements ICanCreateFromTableRow
* @return Entity\Report
* @throws \Exception
*/
public function createFromReportsRequest(int $uid = null, int $reporterId, int $cid, string $comment = '', string $category = null, bool $forward = false, array $postUriIds = []): Entity\Report
public function createFromReportsRequest(int $reporterId, int $cid, string $comment = '', string $category = null, bool $forward = false, array $postUriIds = [], int $uid = null): Entity\Report
{
return new Entity\Report(
$uid,
$reporterId,
$cid,
new \DateTime('now', new \DateTimeZone('UTC')),
@ -72,6 +71,7 @@ class Report extends \Friendica\BaseFactory implements ICanCreateFromTableRow
$category,
$forward,
$postUriIds,
$uid,
);
}
}