Code Duplication    Length = 14-15 lines in 3 locations

src/Palladium/Mapper/Identity.php 1 location

@@ 19-32 (lines=14) @@
16
    /**
17
     * @param Entity\Identity $entity
18
     */
19
    public function store(Entity\Identity $entity)
20
    {
21
        $table = $this->config['accounts']['identities'];
22
23
        $sql = "UPDATE $table
24
                   SET used_on = FROM_UNIXTIME(:used)
25
                 WHERE identity_id = :id";
26
27
        $statement = $this->connection->prepare($sql);
28
29
        $statement->bindValue(':id', $entity->getId());
30
        $statement->bindValue(':used', $entity->getLastUsed());
31
        $statement->execute();
32
    }
33
34
35
    /**

src/Palladium/Mapper/IdentityCollection.php 1 location

@@ 29-43 (lines=15) @@
26
    }
27
28
29
    private function updateStatus(Entity\IdentityCollection $collection)
30
    {
31
        $table = $this->config['accounts']['identities'];
32
33
        $sql = "UPDATE {$table}
34
                   SET status = :status
35
                 WHERE identity_id = :id";
36
        $statement = $this->connection->prepare($sql);
37
38
        foreach ($collection as $entity) {
39
            $statement->bindValue(':id', $entity->getId());
40
            $statement->bindValue(':status', $entity->getStatus());
41
            $statement->execute();
42
        }
43
    }
44
45
46
    /**

src/Palladium/Mapper/IdentityUser.php 1 location

@@ 14-27 (lines=14) @@
11
    /**
12
     * @param Entity\Identity $entity
13
     */
14
    public function store(Entity\Identity $entity)
15
    {
16
        $table = $this->config['accounts']['identities'];
17
18
        $sql = "UPDATE $table
19
                   SET user_id = :user
20
                 WHERE identity_id = :id";
21
22
        $statement = $this->connection->prepare($sql);
23
24
        $statement->bindValue(':id', $entity->getId());
25
        $statement->bindValue(':user', $entity->getUserId());
26
        $statement->execute();
27
    }
28
}
29