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

EntityFetcherMock::count()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
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