1 | <?php |
||
25 | final class StatementRepository implements StatementRepositoryInterface |
||
26 | { |
||
27 | /** |
||
28 | * @var Statement[] |
||
29 | */ |
||
30 | private $statements = array(); |
||
31 | |||
32 | /** |
||
33 | * {@inheritdoc} |
||
34 | */ |
||
35 | 24 | public function findStatementById(StatementId $statementId, Actor $authority = null) |
|
36 | { |
||
37 | 24 | if (!isset($this->statements[$statementId->getValue()])) { |
|
38 | 1 | throw new NotFoundException(sprintf('A statement with id "%s" could not be found.', $statementId->getValue())); |
|
39 | } |
||
40 | |||
41 | 23 | $statement = $this->statements[$statementId->getValue()]; |
|
42 | |||
43 | 23 | if ($statement->isVoidStatement()) { |
|
44 | 1 | throw new NotFoundException(sprintf('The statement with id "%s" is a voiding statement.', $statementId->getValue())); |
|
45 | } |
||
46 | |||
47 | 22 | return $statement; |
|
48 | } |
||
49 | |||
50 | /** |
||
51 | * {@inheritdoc} |
||
52 | */ |
||
53 | 6 | public function findVoidedStatementById(StatementId $voidedStatementId, Actor $authority = null) |
|
67 | |||
68 | /** |
||
69 | * {@inheritdoc} |
||
70 | */ |
||
71 | public function findStatementsBy(StatementsFilter $criteria, Actor $authority = null) |
||
75 | |||
76 | /** |
||
77 | * {@inheritdoc} |
||
78 | */ |
||
79 | 54 | public function storeStatement(Statement $statement, $flush = true) |
|
89 | } |
||
90 |