| Conditions | 2 |
| Paths | 2 |
| Total Lines | 27 |
| Code Lines | 11 |
| Lines | 26 |
| Ratio | 96.3 % |
| Tests | 11 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | 1 | View Code Duplication | public function fetch(Entity\Identity $entity) |
| 36 | { |
||
| 37 | $sql = "SELECT identity_id AS id, |
||
| 38 | parent_id AS parentId, |
||
| 39 | account_id AS accountId, |
||
| 40 | status AS status, |
||
| 41 | hash AS hash, |
||
| 42 | token_expires_on AS tokenEndOfLife |
||
| 43 | 1 | FROM {$this->table} |
|
| 44 | WHERE token = :token |
||
| 45 | AND token_action = :action |
||
| 46 | AND token_expires_on > :expires"; |
||
| 47 | |||
| 48 | 1 | $statement = $this->connection->prepare($sql); |
|
| 49 | |||
| 50 | 1 | $statement->bindValue(':token', $entity->getToken()); |
|
| 51 | 1 | $statement->bindValue(':action', $entity->getTokenAction()); |
|
| 52 | 1 | $statement->bindValue(':expires', $entity->getTokenEndOfLife()); |
|
| 53 | |||
| 54 | 1 | $statement->execute(); |
|
| 55 | |||
| 56 | 1 | $data = $statement->fetch(); |
|
| 57 | |||
| 58 | 1 | if ($data) { |
|
| 59 | 1 | $this->applyValues($entity, $data); |
|
| 60 | } |
||
| 61 | 1 | } |
|
| 62 | } |
||
| 63 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.