chg: pkg: make a massive refactor to the backend and remove all unnecessary deps - and make small refactors for the frontend too #4
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of the SplendidBear Websites' projects.
|
||||
*
|
||||
@@ -10,166 +10,97 @@
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use App\Repository\GamerRepository;
|
||||
use DateTime;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping\Column;
|
||||
use Doctrine\ORM\Mapping\Entity;
|
||||
use Doctrine\ORM\Mapping\GeneratedValue;
|
||||
use Doctrine\ORM\Mapping\Id;
|
||||
|
||||
/**
|
||||
* Class Gamer
|
||||
*
|
||||
* @package App\Entity
|
||||
* @author system7 <https://www.splendidbear.org>
|
||||
*
|
||||
* @ORM\Entity(repositoryClass="App\Repository\GamerRepository")
|
||||
* @package App\Entity
|
||||
* @author Lang <https://www.splendidbear.org>
|
||||
* @category Class
|
||||
* @license https://www.gnu.org/licenses/lgpl-3.0.en.html GNU Lesser General Public License
|
||||
* @link www.splendidbear.org
|
||||
* @since 2026. 04. 09.
|
||||
*/
|
||||
#[Entity(repositoryClass: GamerRepository::class)]
|
||||
class Gamer
|
||||
{
|
||||
/**
|
||||
* @ORM\Id()
|
||||
* @ORM\GeneratedValue()
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private $id;
|
||||
#[Id, GeneratedValue, Column]
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*
|
||||
* @ORM\Column(name="user_name", type="string", length=100, nullable=false)
|
||||
*/
|
||||
private $userName;
|
||||
#[Column(length: 100)]
|
||||
private ?string $userName = null;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*
|
||||
* @ORM\Column(name="ip", type="string", length=20, nullable=true)
|
||||
*/
|
||||
private $ip;
|
||||
#[Column(length: 20, nullable: true)]
|
||||
private ?string $ip = null;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
* $ip='0.0.0.0';
|
||||
* $ip=$_SERVER['REMOTE_ADDR'];
|
||||
* $clientDetails = json_decode(file_get_contents("http://ipinfo.io/$ip/json"));
|
||||
* echo "You're logged in from: <b>" . $clientDetails->country . "</b>";
|
||||
*
|
||||
* function GetIP()
|
||||
* {
|
||||
* if ( getenv("HTTP_CLIENT_IP") ) {
|
||||
* $ip = getenv("HTTP_CLIENT_IP");
|
||||
* } elseif ( getenv("HTTP_X_FORWARDED_FOR") ) {
|
||||
* $ip = getenv("HTTP_X_FORWARDED_FOR");
|
||||
* if ( strstr($ip, ',') ) {
|
||||
* $tmp = explode(',', $ip);
|
||||
* $ip = trim($tmp[0]);
|
||||
* }
|
||||
* } else {
|
||||
* $ip = getenv("REMOTE_ADDR");
|
||||
* }
|
||||
* return $ip;
|
||||
* }
|
||||
*/
|
||||
#[Column(length: 100, nullable: true)]
|
||||
private ?string $country = null;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="country", type="string", length=100, nullable=true)
|
||||
*/
|
||||
private $country;
|
||||
#[Column(nullable: true)]
|
||||
private ?string $userAgent = null;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @see http://symfony.com/doc/current/components/http_foundation.html
|
||||
*
|
||||
* @ORM\Column(name="user_agent", type="string", length=255, nullable=true)
|
||||
*/
|
||||
private $userAgent;
|
||||
#[Column(type: Types::DATETIME_MUTABLE)]
|
||||
private ?DateTime $connTimestamp = null;
|
||||
|
||||
/**
|
||||
* @var \DateTime
|
||||
*
|
||||
* @ORM\Column(name="conn_timestamp", type="datetime", nullable=false)
|
||||
*/
|
||||
private $connTimestamp;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getUserName(): ?string
|
||||
{
|
||||
return $this->userName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $userName
|
||||
*/
|
||||
public function setUserName(?string $userName): void
|
||||
{
|
||||
$this->userName = $userName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getIp(): ?string
|
||||
{
|
||||
return $this->ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $ip
|
||||
*/
|
||||
public function setIp(?string $ip): void
|
||||
{
|
||||
$this->ip = $ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCountry(): string
|
||||
public function getCountry(): ?string
|
||||
{
|
||||
return $this->country;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $country
|
||||
*/
|
||||
public function setCountry(string $country): void
|
||||
public function setCountry(?string $country): void
|
||||
{
|
||||
$this->country = $country;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getUserAgent(): string
|
||||
public function getUserAgent(): ?string
|
||||
{
|
||||
return $this->userAgent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $userAgent
|
||||
*/
|
||||
public function setUserAgent(string $userAgent): void
|
||||
public function setUserAgent(?string $userAgent): void
|
||||
{
|
||||
$this->userAgent = $userAgent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getConnTimestamp(): \DateTime
|
||||
public function getConnTimestamp(): ?DateTime
|
||||
{
|
||||
return $this->connTimestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \DateTime $connTimestamp
|
||||
*/
|
||||
public function setConnTimestamp(\DateTime $connTimestamp): void
|
||||
public function setConnTimestamp(?DateTime $connTimestamp): void
|
||||
{
|
||||
$this->connTimestamp = $connTimestamp;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user