Code Duplication    Length = 7-9 lines in 5 locations

src/BenGorUser/User/Infrastructure/Persistence/SqlUserRepository.php 5 locations

@@ 63-69 (lines=7) @@
60
    /**
61
     * {@inheritdoc}
62
     */
63
    public function userOfId(UserId $anId)
64
    {
65
        $statement = $this->execute('SELECT * FROM user WHERE id = :id', ['id' => $anId->id()]);
66
        if ($row = $statement->fetch(\PDO::FETCH_ASSOC)) {
67
            return $this->buildUser($row);
68
        }
69
    }
70
71
    /**
72
     * {@inheritdoc}
@@ 74-80 (lines=7) @@
71
    /**
72
     * {@inheritdoc}
73
     */
74
    public function userOfEmail(UserEmail $anEmail)
75
    {
76
        $statement = $this->execute('SELECT * FROM user WHERE email = :email', ['email' => $anEmail->email()]);
77
        if ($row = $statement->fetch(\PDO::FETCH_ASSOC)) {
78
            return $this->buildUser($row);
79
        }
80
    }
81
82
    /**
83
     * {@inheritdoc}
@@ 85-93 (lines=9) @@
82
    /**
83
     * {@inheritdoc}
84
     */
85
    public function userOfConfirmationToken(UserToken $aConfirmationToken)
86
    {
87
        $statement = $this->execute('SELECT * FROM user WHERE confirmation_token_token = :confirmationToken', [
88
            'confirmationToken' => $aConfirmationToken->token(),
89
        ]);
90
        if ($row = $statement->fetch(\PDO::FETCH_ASSOC)) {
91
            return $this->buildUser($row);
92
        }
93
    }
94
95
    /**
96
     * {@inheritdoc}
@@ 98-106 (lines=9) @@
95
    /**
96
     * {@inheritdoc}
97
     */
98
    public function userOfInvitationToken(UserToken $anInvitationToken)
99
    {
100
        $statement = $this->execute('SELECT * FROM user WHERE invitation_token_token = :invitationToken', [
101
            'invitationToken' => $anInvitationToken->token(),
102
        ]);
103
        if ($row = $statement->fetch(\PDO::FETCH_ASSOC)) {
104
            return $this->buildUser($row);
105
        }
106
    }
107
108
    /**
109
     * {@inheritdoc}
@@ 111-119 (lines=9) @@
108
    /**
109
     * {@inheritdoc}
110
     */
111
    public function userOfRememberPasswordToken(UserToken $aRememberPasswordToken)
112
    {
113
        $statement = $this->execute('SELECT * FROM user WHERE remember_password_token_token = :rememberPasswordToken', [
114
            'rememberPasswordToken' => $aRememberPasswordToken->token(),
115
        ]);
116
        if ($row = $statement->fetch(\PDO::FETCH_ASSOC)) {
117
            return $this->buildUser($row);
118
        }
119
    }
120
121
    /**
122
     * {@inheritdoc}