EmptyResultSet::getIterator()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
/**
4
 * This file is part of the Kdyby (http://www.kdyby.org)
5
 *
6
 * Copyright (c) 2008 Filip Procházka ([email protected])
7
 *
8
 * For the full copyright and license information, please view the file license.txt that was distributed with this source code.
9
 */
10
11
namespace Kdyby\Doctrine;
12
13
use Doctrine\ORM;
14
use Doctrine\ORM\ORMException;
15
use Doctrine\ORM\Tools\Pagination\Paginator as ResultPaginator;
16
use Kdyby;
17
use Kdyby\Persistence\Queryable;
18
use Nette;
19
use Nette\Utils\Strings;
20
use Nette\Utils\Paginator as UIPaginator;
21
22
23
24
/**
25
 * Null object for usage with pair to ResultSet
26
 *
27
 * @author Filip Procházka <[email protected]>
28
 */
29
class EmptyResultSet extends ResultSet
30
{
31
32
	public function __construct()
33
	{
34
		// empty constructor
35
	}
36
37
38
39
	public function clearSorting()
40
	{
41
		// do nothing
42
		return $this;
43
	}
44
45
46
47
	public function applySorting($columns)
48
	{
49
		// do nothing
50
		return $this;
51
	}
52
53
54
55
	public function applyPaging($offset, $limit)
56
	{
57
		// do nothing
58
		return $this;
59
	}
60
61
62
63
	public function applyPaginator(UIPaginator $paginator, $itemsPerPage = NULL)
64
	{
65
		// do nothing
66
		return $this;
67
	}
68
69
70
71
	public function isEmpty()
72
	{
73
		return TRUE;
74
	}
75
76
77
78
	public function getTotalCount()
79
	{
80
		return 0;
81
	}
82
83
84
85
	public function getIterator($hydrationMode = ORM\AbstractQuery::HYDRATE_OBJECT)
86
	{
87
		return new \ArrayIterator();
88
	}
89
90
91
92
	public function toArray($hydrationMode = ORM\AbstractQuery::HYDRATE_OBJECT)
93
	{
94
		return [];
95
	}
96
97
98
99
	public function count()
100
	{
101
		return 0;
102
	}
103
104
}
105