src/Entity/UserFailedLogins.php line 15

Open in your IDE?
  1. <?php
  2. namespace MedBrief\MSR\Entity;
  3. use DateTimeInterface;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use MedBrief\MSR\Repository\UserFailedLoginsRepository;
  6. /**
  7. * @ORM\Table(name="UserFailedLogins")
  8. *
  9. * @ORM\Entity(repositoryClass=UserFailedLoginsRepository::class)
  10. *
  11. */
  12. class UserFailedLogins
  13. {
  14. /**
  15. * @ORM\Id
  16. *
  17. * @ORM\GeneratedValue
  18. *
  19. * @ORM\Column(type="integer")
  20. */
  21. private ?int $id;
  22. /**
  23. * @ORM\Column(type="text", nullable=true)
  24. */
  25. private ?string $username;
  26. /**
  27. * @ORM\Column(type="text", nullable=true)
  28. */
  29. private ?string $ipAddress;
  30. /**
  31. * @ORM\Column(type="integer", nullable=true)
  32. */
  33. private ?int $failedCount = null;
  34. /**
  35. * @ORM\Column(type="datetime", nullable=true)
  36. */
  37. private ?DateTimeInterface $firstAttempt;
  38. /**
  39. * @ORM\Column(type="datetime", nullable=true)
  40. */
  41. private ?DateTimeInterface $lastAttempt;
  42. /**
  43. * @ORM\Column(type="datetime", nullable=true)
  44. */
  45. private ?DateTimeInterface $successfulLoginTimestamp;
  46. /**
  47. * @ORM\Column(type="integer", nullable=true)
  48. */
  49. private ?int $otpFailedCount = null;
  50. /**
  51. * Get the ID of the UserFailedLogins entity.
  52. *
  53. * @return int|null Returns the ID of the UserFailedLogins entity.
  54. */
  55. public function getId(): ?int
  56. {
  57. return $this->id;
  58. }
  59. /**
  60. * Get the username of the UserFailedLogins entity.
  61. *
  62. * @return string|null Returns the username of the UserFailedLogins entity.
  63. * If the username is not set, it returns null.
  64. */
  65. public function getUsername(): ?string
  66. {
  67. return $this->username;
  68. }
  69. /**
  70. * Sets the username of the UserFailedLogins entity.
  71. *
  72. * @param string|null $username The username of the UserFailedLogins entity.
  73. * If null, the username will be set to null.
  74. *
  75. * @return self Returns the current instance of the UserFailedLogins entity.
  76. * This allows method chaining.
  77. */
  78. public function setUsername(?string $username): self
  79. {
  80. if ($username !== null) {
  81. $this->username = $username;
  82. } else {
  83. $this->username = json_encode(['']);
  84. }
  85. return $this;
  86. }
  87. /**
  88. * Get the IP address of the UserFailedLogins entity.
  89. *
  90. * @return string|null Returns the IP address of the UserFailedLogins entity.
  91. * If the IP address is not set, it returns null.
  92. */
  93. public function getIpAddress(): ?string
  94. {
  95. return $this->ipAddress;
  96. }
  97. /**
  98. * Sets the IP address of the UserFailedLogins entity.
  99. *
  100. * @param string|null $ipAddress The IP address of the UserFailedLogins entity.
  101. * If null, the IP address will be set to null.
  102. *
  103. * @return self Returns the current instance of the UserFailedLogins entity.
  104. * This allows method chaining.
  105. */
  106. public function setIpAddress(?string $ipAddress): self
  107. {
  108. if ($ipAddress !== null) {
  109. $this->ipAddress = $ipAddress;
  110. } else {
  111. $this->ipAddress = json_encode(['']);
  112. }
  113. return $this;
  114. }
  115. /**
  116. * Get the failed count of the UserFailedLogins entity.
  117. *
  118. * @return int|null Returns the failed count of the UserFailedLogins entity.
  119. * If the failed count is not set, it returns 0.
  120. */
  121. public function getFailedCount(): ?int
  122. {
  123. if ($this->failedCount === null) {
  124. return 0;
  125. }
  126. return $this->failedCount;
  127. }
  128. /**
  129. * Sets the failed count of the UserFailedLogins entity.
  130. *
  131. * @param int|null $failedCount The failed count of the UserFailedLogins entity.
  132. * If null, the failed count will be set to null.
  133. *
  134. * @return self Returns the current instance of the UserFailedLogins entity.
  135. * This allows method chaining.
  136. */
  137. public function setFailedCount(?int $failedCount): self
  138. {
  139. $this->failedCount = $failedCount;
  140. return $this;
  141. }
  142. /**
  143. * Gets the first attempt timestamp of the UserFailedLogins entity.
  144. *
  145. * @return DateTimeInterface|null Returns the first attempt timestamp.
  146. * If the first attempt timestamp is not set, it returns null.
  147. */
  148. public function getFirstAttempt(): ?DateTimeInterface
  149. {
  150. return $this->firstAttempt;
  151. }
  152. /**
  153. * Sets the first attempt timestamp of the UserFailedLogins entity.
  154. *
  155. * @param DateTimeInterface|null $firstAttempt The first attempt timestamp.
  156. * If null, the first attempt timestamp will be set to null.
  157. *
  158. * @return self Returns the current instance of the UserFailedLogins entity.
  159. * This allows method chaining.
  160. */
  161. public function setFirstAttempt(?DateTimeInterface $firstAttempt): self
  162. {
  163. $this->firstAttempt = $firstAttempt;
  164. return $this;
  165. }
  166. /**
  167. * Gets the last attempt timestamp of the UserFailedLogins entity.
  168. *
  169. * @return DateTimeInterface|null Returns the last attempt timestamp.
  170. * If the last attempt timestamp is not set, it returns null.
  171. */
  172. public function getLastAttempt(): ?DateTimeInterface
  173. {
  174. return $this->lastAttempt;
  175. }
  176. /**
  177. * Sets the last attempt timestamp of the UserFailedLogins entity.
  178. *
  179. * @param DateTimeInterface|null $lastAttempt The last attempt timestamp.
  180. * If null, the last attempt timestamp will be set to null.
  181. *
  182. * @return self Returns the current instance of the UserFailedLogins entity.
  183. * This allows method chaining.
  184. */
  185. public function setLastAttempt(?DateTimeInterface $lastAttempt): self
  186. {
  187. $this->lastAttempt = $lastAttempt;
  188. return $this;
  189. }
  190. /**
  191. * Gets the successful login timestamp of the UserFailedLogins entity.
  192. *
  193. * @return \DateTimeInterface|null Returns the successful login timestamp.
  194. * If the successful login timestamp is not set, it returns null.
  195. */
  196. public function getSuccessfulLoginTimestamp(): ?DateTimeInterface
  197. {
  198. return $this->successfulLoginTimestamp;
  199. }
  200. /**
  201. * Sets the successful login timestamp of the UserFailedLogins entity.
  202. *
  203. * @param \DateTimeInterface|null $successfulLoginTimestamp The successful login timestamp.
  204. * If null, the successful login timestamp will be set to null.
  205. *
  206. * @return self Returns the current instance of the UserFailedLogins entity.
  207. * This allows method chaining.
  208. */
  209. public function setSuccessfulLoginTimestamp(?DateTimeInterface $successfulLoginTimestamp): self
  210. {
  211. $this->successfulLoginTimestamp = $successfulLoginTimestamp;
  212. return $this;
  213. }
  214. /**
  215. * Gets the OTP failed count of the UserFailedLogins entity.
  216. *
  217. * @return int|null Returns the OTP failed count.
  218. * If the OTP failed count is not set, it returns null.
  219. */
  220. public function getOtpFailedCount()
  221. {
  222. if ($this->otpFailedCount === null) {
  223. return 0;
  224. }
  225. return $this->otpFailedCount;
  226. }
  227. /**
  228. * Sets the OTP failed count of the UserFailedLogins entity.
  229. *
  230. * @param int|null $otpFailedCount The OTP failed count.
  231. * If null, the OTP failed count will be set to null.
  232. *
  233. * @return self Returns the current instance of the UserFailedLogins entity.
  234. * This allows method chaining.
  235. */
  236. public function setOtpFailedCount(?int $otpFailedCount)
  237. {
  238. $this->otpFailedCount = $otpFailedCount;
  239. return $this;
  240. }
  241. }