| @@ 42-63 (lines=22) @@ | ||
| 39 | /** |
|
| 40 | * {@inheritdoc} |
|
| 41 | */ |
|
| 42 | public function findStatementById(StatementId $statementId, Actor $authority = null) |
|
| 43 | { |
|
| 44 | $criteria = array('id' => $statementId->getValue()); |
|
| 45 | ||
| 46 | if (null !== $authority) { |
|
| 47 | $criteria['authority'] = $authority; |
|
| 48 | } |
|
| 49 | ||
| 50 | $mappedStatement = $this->repository->findStatement($criteria); |
|
| 51 | ||
| 52 | if (null === $mappedStatement) { |
|
| 53 | throw new NotFoundException('No statements could be found matching the given criteria.'); |
|
| 54 | } |
|
| 55 | ||
| 56 | $statement = $mappedStatement->getModel(); |
|
| 57 | ||
| 58 | if ($statement->isVoidStatement()) { |
|
| 59 | throw new NotFoundException('The stored statement is a voiding statement.'); |
|
| 60 | } |
|
| 61 | ||
| 62 | return $statement; |
|
| 63 | } |
|
| 64 | ||
| 65 | /** |
|
| 66 | * {@inheritdoc} |
|
| @@ 68-89 (lines=22) @@ | ||
| 65 | /** |
|
| 66 | * {@inheritdoc} |
|
| 67 | */ |
|
| 68 | public function findVoidedStatementById(StatementId $voidedStatementId, Actor $authority = null) |
|
| 69 | { |
|
| 70 | $criteria = array('id' => $voidedStatementId->getValue()); |
|
| 71 | ||
| 72 | if (null !== $authority) { |
|
| 73 | $criteria['authority'] = $authority; |
|
| 74 | } |
|
| 75 | ||
| 76 | $mappedStatement = $this->repository->findStatement($criteria); |
|
| 77 | ||
| 78 | if (null === $mappedStatement) { |
|
| 79 | throw new NotFoundException('No voided statements could be found matching the given criteria.'); |
|
| 80 | } |
|
| 81 | ||
| 82 | $statement = $mappedStatement->getModel(); |
|
| 83 | ||
| 84 | if (!$statement->isVoidStatement()) { |
|
| 85 | throw new NotFoundException('The stored statement is no voiding statement.'); |
|
| 86 | } |
|
| 87 | ||
| 88 | return $statement; |
|
| 89 | } |
|
| 90 | ||
| 91 | /** |
|
| 92 | * {@inheritdoc} |
|