| @@ 57-69 (lines=13) @@ | ||
| 54 | * @return SharesToken |
|
| 55 | * @throws TokenDoesNotExistException |
|
| 56 | */ |
|
| 57 | public function getByToken(string $token) { |
|
| 58 | $qb = $this->getTokensSelectSql(); |
|
| 59 | $this->limitToToken($qb, $token); |
|
| 60 | ||
| 61 | $cursor = $qb->execute(); |
|
| 62 | $data = $cursor->fetch(); |
|
| 63 | $cursor->closeCursor(); |
|
| 64 | if ($data === false) { |
|
| 65 | throw new TokenDoesNotExistException('Unknown share token'); |
|
| 66 | } |
|
| 67 | ||
| 68 | return $this->parseTokensSelectSql($data); |
|
| 69 | } |
|
| 70 | ||
| 71 | ||
| 72 | /** |
|
| @@ 75-87 (lines=13) @@ | ||
| 72 | * @return string |
|
| 73 | * @throws TokenDoesNotExistException |
|
| 74 | */ |
|
| 75 | public function getTokenByShareId(int $shareId) { |
|
| 76 | $qb = $this->getSharesSelectSql(); |
|
| 77 | $this->limitToId($qb, $shareId); |
|
| 78 | ||
| 79 | $cursor = $qb->execute(); |
|
| 80 | $data = $cursor->fetch(); |
|
| 81 | $cursor->closeCursor(); |
|
| 82 | if ($data === false) { |
|
| 83 | throw new TokenDoesNotExistException('Unknown share token'); |
|
| 84 | } |
|
| 85 | ||
| 86 | return $this->get('token', $data, 'notfound'); |
|
| 87 | } |
|
| 88 | ||
| 89 | ||
| 90 | /** |
|