<?phpnamespace App\Entity\Log;use App\Repository\Log\APIRequestRepository;use Doctrine\ORM\Mapping as ORM;use Gedmo\Timestampable\Traits\TimestampableEntity;/** * @ORM\Entity(repositoryClass=APIRequestRepository::class) */class APIRequest{ /** * Hook timestampable behavior * updates createdAt, updatedAt fields */ use TimestampableEntity; /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @var string * @ORM\Column(type="string", length=10) */ private $method; /** * @var string * @ORM\Column(type="string", length=1024) */ private $endPoint; /** * @var array|null * @ORM\Column(type="json", nullable=true) */ private $payload = []; /** * @var int * @ORM\Column(type="integer", nullable=true) */ private $statusCode; /** * @var array|null * @ORM\Column(type="json", nullable=true) */ private $responseInfos = []; /** * @var array|null * @ORM\Column(type="json", nullable=true) */ private $responseBody = []; /** * APIRequest constructor. */ public function __construct() { $this->responseBody = ["status" => "waiting for response"]; } /** * @return string */ public function getMethod(): string { return $this->method; } /** * @param string $method * @return APIRequest */ public function setMethod(string $method): APIRequest { $this->method = $method; return $this; } /** * @return string */ public function getEndPoint(): string { return $this->endPoint; } /** * @param string $endPoint * @return APIRequest */ public function setEndPoint(string $endPoint): APIRequest { $this->endPoint = $endPoint; return $this; } /** * @return mixed */ public function getId() { return $this->id; } /** * @return array|null */ public function getPayload(): ?array { return $this->payload; } /** * @param array|null $payload * @return APIRequest */ public function setPayload(?array $payload): APIRequest { $this->payload = $payload; return $this; } /** * @return int */ public function getStatusCode(): int { return $this->statusCode; } /** * @param int $statusCode * @return APIRequest */ public function setStatusCode(int $statusCode): APIRequest { $this->statusCode = $statusCode; return $this; } /** * @return array|null */ public function getResponseBody(): ?array { return $this->responseBody; } /** * @param array|null $responseBody * @return APIRequest */ public function setResponseBody(?array $responseBody): APIRequest { $this->responseBody = $responseBody; return $this; } /** * @return array|null */ public function getResponseInfos(): ?array { return $this->responseInfos; } /** * @param array|null $responseInfos * @return APIRequest */ public function setResponseInfos(?array $responseInfos): APIRequest { $this->responseInfos = isset($_ENV['APP_ENV']) && $_ENV['APP_ENV'] !== 'prod' ? $responseInfos : ["status" => 'Not logged in prod env']; return $this; }}