2018-09-13 14:39:03 +02:00
|
|
|
<?php
|
2018-09-13 16:51:58 +02:00
|
|
|
|
2019-02-17 14:33:19 +01:00
|
|
|
namespace Infinito\Attribut;
|
2018-09-13 14:39:03 +02:00
|
|
|
|
2019-02-17 14:33:19 +01:00
|
|
|
use Infinito\Entity\User;
|
|
|
|
use Infinito\Entity\UserInterface;
|
2018-09-13 14:39:03 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @author kevinfrantz
|
2019-02-03 00:30:53 +01:00
|
|
|
*
|
|
|
|
* @see UserAttributInterface
|
2018-09-13 14:39:03 +02:00
|
|
|
*/
|
2018-09-13 16:51:58 +02:00
|
|
|
trait UserAttribut
|
|
|
|
{
|
2018-09-13 14:39:03 +02:00
|
|
|
/**
|
2019-02-03 00:30:53 +01:00
|
|
|
* @var User|null
|
2018-09-13 14:39:03 +02:00
|
|
|
*/
|
|
|
|
protected $user;
|
2018-09-13 16:51:58 +02:00
|
|
|
|
2019-02-03 00:30:53 +01:00
|
|
|
/**
|
|
|
|
* @param UserInterface $user
|
|
|
|
*/
|
2018-09-24 18:41:26 +02:00
|
|
|
public function setUser(UserInterface $user): void
|
2018-09-13 16:51:58 +02:00
|
|
|
{
|
2018-09-13 14:39:03 +02:00
|
|
|
$this->user = $user;
|
|
|
|
}
|
2018-09-13 16:51:58 +02:00
|
|
|
|
2019-02-03 00:30:53 +01:00
|
|
|
/**
|
|
|
|
* @return UserInterface
|
|
|
|
*/
|
2018-09-24 18:41:26 +02:00
|
|
|
public function getUser(): UserInterface
|
2018-09-13 16:51:58 +02:00
|
|
|
{
|
2018-09-13 14:39:03 +02:00
|
|
|
return $this->user;
|
|
|
|
}
|
2019-02-03 00:30:53 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function hasUser(): bool
|
|
|
|
{
|
|
|
|
return isset($this->user);
|
|
|
|
}
|
2018-09-13 14:39:03 +02:00
|
|
|
}
|