Code Duplication    Length = 22-22 lines in 2 locations

src/Repository/StatementRepository.php 2 locations

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