session = $session; $this->dt = $dt ?? new \DateTime('now'); } /** * Get id. * * @return int Account id * * @since 1.0.0 */ public function getId() : int { return $this->id; } /** * Get the dt data * * @return \DateTime * * @since 1.0.0 */ public function getDatetime() : \DateTime { return $this->dt; } /** * Get the session element type * * @return int * * @since 1.0.0 */ public function getType() : int { return $this->type; } /** * Set the session element type * * @param int $type Session element type * * @return void * * @since 1.0.0 */ public function setType(int $type) : void { $this->type = $type; } /** * {@inheritdoc} */ public function toArray() : array { return [ 'id' => $this->id, 'type' => $this->type, 'dt' => $this->dt->format('Y-m-d H:i:s'), 'sesseion' => $this->session, ]; } /** * {@inheritdoc} */ public function __toString() { return (string) \json_encode($this->toArray()); } /** * {@inheritdoc} */ public function jsonSerialize() { return $this->toArray(); } }