Code Duplication    Length = 21-25 lines in 2 locations

src/Palladium/Mapper/CookieIdentity.php 1 location

@@ 92-112 (lines=21) @@
89
    }
90
91
92
    private function createCookie(Entity\CookieIdentity $entity)
93
    {
94
        $table = $this->config['accounts']['identities'];
95
        $sql = "INSERT INTO {$table}
96
                       (user_id, type, status, identifier, fingerprint, hash, expires_on)
97
                VALUES (:user, :type, :status, :series, :fingerprint, :hash, FROM_UNIXTIME(:expires))";
98
99
        $statement = $this->connection->prepare($sql);
100
101
        $statement->bindValue(':user', $entity->getUserId());
102
        $statement->bindValue(':type', $entity->getType());
103
        $statement->bindValue(':status', $entity->getStatus());
104
        $statement->bindValue(':series', $entity->getSeries());
105
        $statement->bindValue(':fingerprint', $entity->getFingerprint());
106
        $statement->bindValue(':hash', $entity->getHash());
107
        $statement->bindValue(':expires', $entity->getExpiresOn());
108
109
        $statement->execute();
110
111
        $entity->setId($this->connection->lastInsertId());
112
    }
113
114
115
    private function updateCookie(Entity\CookieIdentity $entity)

src/Palladium/Mapper/EmailIdentity.php 1 location

@@ 120-144 (lines=25) @@
117
    }
118
119
120
    private function updateIdentity(Entity\Identity $entity)
121
    {
122
        $table = $this->config['accounts']['identities'];
123
124
        $sql = "UPDATE {$table}
125
                   SET hash = :hash,
126
                       status = :status,
127
                       expires_on = :expires,
128
                       token = :token,
129
                       token_action = :action,
130
                       token_expires_on = :token_eol
131
                 WHERE identity_id = :id";
132
133
         $statement = $this->connection->prepare($sql);
134
135
         $statement->bindValue(':id', $entity->getId());
136
         $statement->bindValue(':hash', $entity->getHash());
137
         $statement->bindValue(':status', $entity->getStatus());
138
         $statement->bindValue(':expires', $entity->getExpiresOn());
139
         $statement->bindValue(':token', $entity->getToken());
140
         $statement->bindValue(':action', $entity->getTokenAction());
141
         $statement->bindValue(':token_eol', $entity->getTokenEndOfLife());
142
143
         $statement->execute();
144
    }
145
}
146