Completed
Push — master ( 086a41...409693 )
by Thomas
25s queued 11s
created

EntityFetcherMock   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 7
c 1
b 0
f 0
dl 0
loc 22
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A one() 0 7 2
A count() 0 3 1
1
<?php
2
3
namespace ORM\Testing;
4
5
use ORM\EntityFetcher;
6
7
class EntityFetcherMock extends EntityFetcher
8
{
9
    /** @var array */
10
    protected $currentResult;
11
12
    /** @var EntityManagerMock */
13
    public $entityManager;
14
15
    /** {@inheritDoc} */
16
    public function one()
17
    {
18
        if ($this->currentResult === null) {
19
            $this->currentResult = $this->entityManager->getResults($this->class, $this);
0 ignored issues
show
Bug introduced by
It seems like $this->class can also be of type ORM\Entity; however, parameter $class of ORM\Testing\EntityManagerMock::getResults() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

19
            $this->currentResult = $this->entityManager->getResults(/** @scrutinizer ignore-type */ $this->class, $this);
Loading history...
20
        }
21
22
        return array_shift($this->currentResult);
23
    }
24
25
    /** {@inheritDoc} */
26
    public function count()
27
    {
28
        return count($this->entityManager->getResults($this->class, $this));
0 ignored issues
show
Bug introduced by
It seems like $this->class can also be of type ORM\Entity; however, parameter $class of ORM\Testing\EntityManagerMock::getResults() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

28
        return count($this->entityManager->getResults(/** @scrutinizer ignore-type */ $this->class, $this));
Loading history...
29
    }
30
}
31