CommentCountQuery.php 2.45 KB
<?php

namespace FootyRoom\Queries\Comment;

/**
 * Query to return count of comments in a discussion.
 */
class CommentCountQuery
{
    use ViewedBy;

    /**
     * @var string
     */
    protected $discussionId;

    /**
     * Should show unpublished comments?
     *
     * @var bool
     */
    protected $unpublished;

    /**
     * @var string
     */
    protected $filter;

    /**
     * Comment id before which to get count. Useful to determine page
     * number of specific comment.
     *
     * @var int
     */
    protected $before;

    /**
     * Used in conjunction with `before` to define order of comments.
     *
     * @var string
     */
    protected $order = 'desc';

    /**
     * Constructor.
     *
     * @param string $discussionId
     */
    public function __construct($discussionId)
    {
        $this->discussionId = $discussionId;
    }

    /**
     * Gets the value of discussionId.
     *
     * @return string
     */
    public function getDiscussionId()
    {
        return $this->discussionId;
    }

    /**
     * Gets the Should show unpublished comments?.
     *
     * @return bool
     */
    public function getUnpublished()
    {
        return $this->unpublished;
    }

    /**
     * Gets the value of filter.
     *
     * @return string
     */
    public function getFilter()
    {
        return $this->filter;
    }

    /**
     * Sets the value of filter.
     *
     * @param string $filter the filter
     *
     * @return self
     */
    public function filter($filter)
    {
        $this->filter = $filter;

        return $this;
    }

    /**
     * Gets the comment id before which to get count. Useful to
     * determine page number of specific comment.
     *
     * @return int
     */
    public function getBefore()
    {
        return $this->before;
    }

    /**
     * Sets the comment id before which to get count. Useful to
     * determine page number of specific comment.
     *
     * @param int $before
     *
     * @return self
     */
    public function before($before)
    {
        $this->before = $before;

        return $this;
    }

    /**
     * Gets the order of comments.
     *
     * @return string
     */
    public function getOrder()
    {
        return $this->order;
    }

    /**
     * Sets the order of comments.
     *
     * @param string $order
     *
     * @return self
     */
    public function order($order)
    {
        $this->order = $order;

        return $this;
    }
}