ResponseModel.php 1.22 KB
Newer Older
Jacob Priddy's avatar
Jacob Priddy committed
1 2 3 4 5 6 7
<?php

namespace Source\UseCases\Users\Authenticate;

use Source\Entities\User;
use Source\Entities\Token;

Jacob Priddy's avatar
Jacob Priddy committed
8 9
class ResponseModel
{
Jacob Priddy's avatar
Jacob Priddy committed
10 11 12 13 14 15 16 17 18 19 20
    /**
     * @var User
     */
    protected User $user;

    /**
     * @var Token
     */
    protected Token $token;

    /**
21
     * @var string
Jacob Priddy's avatar
Jacob Priddy committed
22
     */
23 24
    protected string $tokenString;

25 26 27 28 29
    /**
     * @var bool
     */
    protected bool $newUser;

30 31 32 33
    /**
     * @param User   $user
     * @param string $tokenString
     * @param Token  $token
34
     * @param bool   $newUser
35
     */
36
    public function __construct(User $user, string $tokenString, Token $token, bool $newUser = false)
Jacob Priddy's avatar
Jacob Priddy committed
37
    {
Jacob Priddy's avatar
Jacob Priddy committed
38 39
        $this->user = $user;
        $this->token = $token;
40
        $this->tokenString = $tokenString;
41
        $this->newUser = $newUser;
Jacob Priddy's avatar
Jacob Priddy committed
42 43 44 45 46
    }

    /**
     * @return User
     */
Jacob Priddy's avatar
Jacob Priddy committed
47 48
    public function getUser(): User
    {
Jacob Priddy's avatar
Jacob Priddy committed
49 50 51 52 53 54
        return $this->user;
    }

    /**
     * @return Token
     */
Jacob Priddy's avatar
Jacob Priddy committed
55 56
    public function getToken(): Token
    {
Jacob Priddy's avatar
Jacob Priddy committed
57 58
        return $this->token;
    }
59 60 61 62 63 64 65 66

    /**
     * @return string
     */
    public function getRawToken(): string
    {
        return $this->tokenString;
    }
67 68 69 70 71 72 73 74

    /**
     * @return bool
     */
    public function isNewUser(): bool
    {
        return $this->newUser;
    }
Jacob Priddy's avatar
Jacob Priddy committed
75
}