Passed
Push — master ( d023d7...4e8d12 )
by Ron
01:40
created

RunnableSelect::fetch()   A

Complexity

Conditions 6
Paths 1

Size

Total Lines 19
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 14
dl 0
loc 19
rs 9.2222
c 2
b 0
f 0
cc 6
nc 1
nop 4
1
<?php
2
3
namespace Kir\MySQL\Builder;
4
5
use Generator;
6
use IteratorAggregate;
7
use Kir\MySQL\Tools\AliasReplacer;
8
use Kir\MySQL\Builder\Helpers\DBIgnoreRow;
9
10
/**
11
 * @extends IteratorAggregate<int, array<string, mixed>>
12
 */
13
interface RunnableSelect extends IteratorAggregate {
14
	/**
15
	 * @return AliasReplacer
16
	 */
17
	public function aliasReplacer(): AliasReplacer;
18
19
	/**
20
	 * @param array<string, mixed> $values
21
	 * @return $this
22
	 */
23
	public function bindValues(array $values);
24
25
	/**
26
	 * @param string $key
27
	 * @param string|int|bool|float|null $value
28
	 * @return $this
29
	 */
30
	public function bindValue(string $key, $value);
31
32
	/**
33
	 * @return $this
34
	 */
35
	public function clearValues();
36
37
	/**
38
	 * @param bool $preserveTypes
39
	 * @return $this
40
	 */
41
	public function setPreserveTypes(bool $preserveTypes = true);
42
43
	/**
44
	 * @param null|callable(array<string, mixed>): array<string, mixed>|callable(array<string, mixed>): void|callable(array<string, mixed>): DBIgnoreRow $callback
45
	 * @return array<int, array<string, mixed>>
46
	 */
47
	public function fetchRows($callback = null): array;
48
49
	/**
50
	 * @param null|callable(array<string, mixed>): (array<mixed, mixed>|null|void) $callback
51
	 * @return Generator<int, array<string, mixed>>
52
	 */
53
	public function fetchRowsLazy($callback = null);
54
55
	/**
56
	 * @param null|callable(array<string, mixed>): array<string, mixed>|callable(array<string, mixed>): void|callable(array<string, mixed>): DBIgnoreRow $callback
57
	 * @return array<string, mixed>
58
	 */
59
	public function fetchRow($callback = null): array;
60
61
	/**
62
	 * @template T
63
	 * @template U
64
	 * @param class-string<T> $className
0 ignored issues
show
Documentation Bug introduced by
The doc comment class-string<T> at position 0 could not be parsed: Unknown type name 'class-string' at position 0 in class-string<T>.
Loading history...
65
	 * @param null|callable(T): U $callback
66
	 * @return T[]|U[]
67
	 */
68
	public function fetchObjects(string $className = 'stdClass', $callback = null): array;
69
70
	/**
71
	 * @template T
72
	 * @template U
73
	 * @param class-string<T> $className
0 ignored issues
show
Documentation Bug introduced by
The doc comment class-string<T> at position 0 could not be parsed: Unknown type name 'class-string' at position 0 in class-string<T>.
Loading history...
74
	 * @param null|callable(T): U $callback
75
	 * @return Generator<int, T|U>
76
	 */
77
	public function fetchObjectsLazy($className = null, $callback = null);
78
79
	/**
80
	 * @template T
81
	 * @template U
82
	 * @param class-string<T> $className
0 ignored issues
show
Documentation Bug introduced by
The doc comment class-string<T> at position 0 could not be parsed: Unknown type name 'class-string' at position 0 in class-string<T>.
Loading history...
83
	 * @param null|callable(T): U $callback
84
	 * @return T|U
85
	 */
86
	public function fetchObject($className = null, $callback = null);
87
88
	/**
89
	 * @param bool $treatValueAsArray
90
	 * @return array<mixed, mixed>
91
	 */
92
	public function fetchKeyValue($treatValueAsArray = false): array;
93
94
	/**
95
	 * @param string[] $fields
96
	 * @return array<string, array<int, mixed>>
97
	 */
98
	public function fetchGroups(array $fields): array;
99
100
	/**
101
	 * @template T
102
	 * @param null|callable(null|bool|int|float|string): T $fn
103
	 * @return array<int, T|string>
104
	 */
105
	public function fetchArray(?callable $fn = null): array;
106
107
	/**
108
	 * @template TDefault
109
	 * @template TCastFn
110
	 * @param TDefault $default
0 ignored issues
show
Bug introduced by
The type Kir\MySQL\Builder\TDefault was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
111
	 * @param null|callable(null|bool|string|int|float): TCastFn $fn
112
	 * @return null|bool|string|int|float|TDefault|TCastFn
0 ignored issues
show
Bug introduced by
The type Kir\MySQL\Builder\TCastFn was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
113
	 */
114
	public function fetchValue($default = null, ?callable $fn = null);
115
116
	/**
117
	 * @return int
118
	 */
119
	public function getFoundRows(): int;
120
121
	/**
122
	 * @return Generator<int, array<string, mixed>>
123
	 */
124
	public function getIterator();
125
}
126