Viewing File: /usr/local/cpanel/whostmgr/docroot/cgi/ncssl/source/src/Entity/User.php

<?php

namespace App\Entity;

use App\Repository\UserRepository;
use Doctrine\ORM\Mapping as ORM;
use League\OAuth2\Client\Token\AccessToken;
use League\OAuth2\Client\Token\AccessTokenInterface;
use Symfony\Component\Security\Core\User\UserInterface;

#[ORM\Entity(repositoryClass: UserRepository::class)]
#[ORM\Table(name: "users")]
class User implements UserInterface
{
    #[ORM\Id]
    #[ORM\GeneratedValue]
    #[ORM\Column(nullable: true)]
    private ?int $id = null;

    #[ORM\Column(type: 'string', length: 100, nullable: true)]
    private ?string $name = null;

    #[ORM\Column(type: 'string', length: 100, nullable: true)]
    private ?string $ncLogin = null;

    #[ORM\Column(type: 'boolean', nullable: false, options: ["default" => 1])]
    private int $autoRedirect = 1;

    #[ORM\Column(type: 'json', nullable: true)]
    private ?array $accessToken = null;

    public function getId(): ?int
    {
        return $this->id;
    }

    public function getName(): ?string
    {
        return $this->name;
    }

    public function setName(string $name): static
    {
        $this->name = $name;

        return $this;
    }

    /**
     * A visual identifier that represents this user.
     *
     * @see UserInterface
     */
    public function getUserIdentifier(): string
    {
        return (string) $this->name;
    }

    /**
     * @see UserInterface
     */
    public function getRoles(): array
    {
        return ['ROLE_USER'];
    }

    /**
     * @see UserInterface
     */
    public function eraseCredentials(): void
    {

    }

    /**
     * @return string|null
     */
    public function getNcLogin(): ?string
    {
        return $this->ncLogin;
    }

    /**
     * @param string|null $ncLogin
     */
    public function setNcLogin(?string $ncLogin): void
    {
        $this->ncLogin = $ncLogin;
    }

    /**
     * @return int
     */
    public function getAutoRedirect(): int
    {
        return $this->autoRedirect;
    }

    /**
     * @param int $autoRedirect
     */
    public function setAutoRedirect(int $autoRedirect): void
    {
        $this->autoRedirect = $autoRedirect;
    }

    /**
     * @return AccessToken|null
     */
    public function getAccessToken(): ?AccessToken
    {
        return $this->accessToken ? new AccessToken($this->accessToken) : null;
    }

    /**
     * @param AccessToken|null $accessToken
     */
    public function setAccessToken(?AccessToken $accessToken): void
    {
        $this->accessToken = $accessToken instanceof AccessTokenInterface ? $accessToken->jsonSerialize() : null;
    }
}
Back to Directory File Manager