Ban.php 2.04 KB
<?php

namespace FootyRoom\Queries\Ban;

use FootyRoom\Support\Helpers\TimeAgo;

class Ban
{
    /**
     * @var int
     */
    protected $id;

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

    /**
     * @var mixed
     */
    protected $entityId;

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

    /**
     * @var int
     */
    protected $duration;

    /**
     * @var \DateTime
     */
    protected $createdAt;

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

    /**
     * Gets the value of id.
     *
     * @return int
     */
    public function getId()
    {
        return $this->id;
    }

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

    /**
     * Gets the value of entityId.
     *
     * @return mixed
     */
    public function getEntityId()
    {
        return $this->entityId;
    }

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

    /**
     * Gets the value of duration.
     *
     * @return int
     */
    public function getDuration()
    {
        return $this->duration;
    }

    /**
     * Gets duration in humanized form.
     *
     * @return string
     */
    public function getDurationHumanized(): string
    {
        return TimeAgo::between($this->getDuration());
    }

    /**
     * Gets remaining time left in humanized form.
     *
     * @return string
     */
    public function getRemainingHumanized(): string
    {
        return TimeAgo::between(
            $this->getCreatedAt()->getTimestamp() + $this->getDuration(), time()
        );
    }

    /**
     * Gets the value of createdAt.
     *
     * @return \DateTime
     */
    public function getCreatedAt()
    {
        return $this->createdAt;
    }

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