<?php
namespace App\Entity;
use App\Repository\XeroStorageRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: XeroStorageRepository::class)]
class XeroStorage
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'text')]
private $accessToken;
#[ORM\Column(type: 'string', length: 255)]
private $expires;
#[ORM\Column(type: 'string', length: 255)]
private $tenantId;
#[ORM\Column(type: 'text')]
private $refreshToken;
#[ORM\Column(type: 'text')]
private $idToken;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $tag;
public function getId(): ?int
{
return $this->id;
}
public function getAccessToken(): ?string
{
return $this->accessToken;
}
public function setAccessToken(string $accessToken): self
{
$this->accessToken = $accessToken;
return $this;
}
public function getExpires(): ?string
{
return $this->expires;
}
public function setExpires(string $expires): self
{
$this->expires = $expires;
return $this;
}
public function getTenantId(): ?string
{
return $this->tenantId;
}
public function setTenantId(string $tenantId): self
{
$this->tenantId = $tenantId;
return $this;
}
public function getRefreshToken(): ?string
{
return $this->refreshToken;
}
public function setRefreshToken(string $refreshToken): self
{
$this->refreshToken = $refreshToken;
return $this;
}
public function getIdToken(): ?string
{
return $this->idToken;
}
public function setIdToken(string $idToken): self
{
$this->idToken = $idToken;
return $this;
}
/**
* Return false if access token is expired
*
* @return boolean
*/
public function getHasExpired()
{
$isExpired = true;
if(time() < $this->getExpires()) {
$isExpired = false;
}
return $isExpired;
}
public function getTag(): ?string
{
return $this->tag;
}
public function setTag(?string $tag): self
{
$this->tag = $tag;
return $this;
}
}