Code Duplication    Length = 8-18 lines in 4 locations

src/Palladium/Mapper/Identity.php 2 locations

@@ 18-32 (lines=15) @@
15
    /**
16
     * @param Entity\Identity $entity
17
     */
18
    public function store(Entity\Identity $entity)
19
    {
20
        $sql = "UPDATE {$this->table}
21
                   SET used_on = :used,
22
                       status = :status
23
                 WHERE identity_id = :id";
24
25
        $statement = $this->connection->prepare($sql);
26
27
        $statement->bindValue(':id', $entity->getId());
28
        $statement->bindValue(':used', $entity->getLastUsed());
29
        $statement->bindValue(':status', $entity->getStatus());
30
31
        $statement->execute();
32
    }
33
34
35
    /**
@@ 38-45 (lines=8) @@
35
    /**
36
     * @param Entity\Identity $entity
37
     */
38
    public function remove(Entity\Identity $entity)
39
    {
40
        $sql = "DELETE FROM {$this->table} WHERE identity_id: id";
41
        $statement = $this->connection->prepare($sql);
42
43
        $statement->bindValue(':id', $entity->getId());
44
        $statement->execute();
45
    }
46
47
48
    /**

src/Palladium/Mapper/IdentityAccount.php 1 location

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

src/Palladium/Mapper/OneTimeIdentity.php 1 location

@@ 82-99 (lines=18) @@
79
    }
80
81
82
    private function updateIdentity(Entity\OneTimeIdentity $entity)
83
    {
84
        $status = Entity\Identity::STATUS_DISCARDED;
85
86
        $sql = "UPDATE {$this->table}
87
                   SET status = :status,
88
                       used_on = :used,
89
                 WHERE identity_id = :id
90
                   AND status = {$status}";
91
92
        $statement = $this->connection->prepare($sql);
93
94
        $statement->bindValue(':id', $entity->getId());
95
        $statement->bindValue(':status', $entity->getStatus());
96
        $statement->bindValue(':used', time());
97
98
        $statement->execute();
99
    }
100
101
}
102