Code Duplication    Length = 12-12 lines in 3 locations

src/EntitySpecificationRepositoryTrait.php 3 locations

@@ 49-60 (lines=12) @@
46
     *
47
     * @return mixed
48
     */
49
    public function matchSingleResult($specification, ResultModifier $modifier = null)
50
    {
51
        $query = $this->getQuery($specification, $modifier);
52
53
        try {
54
            return $query->getSingleResult();
55
        } catch (NonUniqueResultException $e) {
56
            throw new Exception\NonUniqueResultException($e->getMessage(), $e->getCode(), $e);
57
        } catch (NoResultException $e) {
58
            throw new Exception\NoResultException($e->getMessage(), $e->getCode(), $e);
59
        }
60
    }
61
62
    /**
63
     * Get single result or null when you match with a Specification.
@@ 92-103 (lines=12) @@
89
     *
90
     * @return mixed
91
     */
92
    public function matchSingleScalarResult($specification, ResultModifier $modifier = null)
93
    {
94
        $query = $this->getQuery($specification, $modifier);
95
96
        try {
97
            return $query->getSingleScalarResult();
98
        } catch (NonUniqueResultException $e) {
99
            throw new Exception\NonUniqueResultException($e->getMessage(), $e->getCode(), $e);
100
        } catch (NoResultException $e) {
101
            throw new Exception\NoResultException($e->getMessage(), $e->getCode(), $e);
102
        }
103
    }
104
105
    /**
106
     * Get scalar result when you match with a Specification.
@@ 116-127 (lines=12) @@
113
     *
114
     * @return mixed
115
     */
116
    public function matchScalarResult($specification, ResultModifier $modifier = null)
117
    {
118
        $query = $this->getQuery($specification, $modifier);
119
120
        try {
121
            return $query->getScalarResult();
122
        } catch (NonUniqueResultException $e) {
123
            throw new Exception\NonUniqueResultException($e->getMessage(), $e->getCode(), $e);
124
        } catch (NoResultException $e) {
125
            throw new Exception\NoResultException($e->getMessage(), $e->getCode(), $e);
126
        }
127
    }
128
129
    /**
130
     * Prepare a Query with a Specification.