added getters & setters
This commit is contained in:
		@@ -1,18 +1,99 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * Copyright (c) 2022. Micha Espey <tracer@24unix.net>
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * For the full copyright and license information, please view the LICENSE
 | 
				
			||||||
 | 
					 * file that was distributed with this source code.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace App\Entity;
 | 
					namespace App\Entity;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use App\Enums\UserAuth;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class User
 | 
					class User
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    public function __construct(
 | 
					    public function __construct(
 | 
				
			||||||
        private string $nick,
 | 
					        private string   $nick = '',
 | 
				
			||||||
        private string $password,
 | 
					        private string   $password = '',
 | 
				
			||||||
        private string $first = '',
 | 
					        private string   $first = '',
 | 
				
			||||||
        private string $last = '',
 | 
					        private string   $last = '',
 | 
				
			||||||
        private int    $id = 0,
 | 
					        private int      $id = 0,
 | 
				
			||||||
        private bool   $isAdmin = false
 | 
					        private bool     $isAdmin = false,
 | 
				
			||||||
 | 
					        private UserAuth $userAuth = UserAuth::AUTH_ANONYMOUS
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        // empty body
 | 
					        // empty body
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function getNick(): string
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return $this->nick;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function setNick(string $nick): void
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $this->nick = $nick;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function getPassword(): string
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return $this->password;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function setPassword(string $password): void
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $this->password = $password;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function getFirst(): string
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return $this->first;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function setFirst(string $first): void
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $this->first = $first;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function getLast(): string
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return $this->last;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function setLast(string $last): void
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $this->last = $last;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function getId(): int
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return $this->id;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function setId(int $id): void
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $this->id = $id;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function isAdmin(): bool
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return $this->isAdmin;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function setIsAdmin(bool $isAdmin): void
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $this->isAdmin = $isAdmin;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function getAuth()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return UserAuth::AUTH_ANONYMOUS;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function setAuth(UserAuth $userAuth)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $this->userAuth = $userAuth;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user