Completed
Push — master ( d1f44d...2f7083 )
by Kamil
02:59
created

QueryCommand::getFields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Dazzle\MySQL\Protocol\Command;
4
5
use Dazzle\MySQL\Protocol\Command;
6
use Dazzle\MySQL\Protocol\QueryInterface;
7
use Dazzle\MySQL\SQLResultInterface;
8
9
class QueryCommand extends Command implements SQLResultInterface
10
{
11
    public $query;
12
    public $fields;
13
    public $insertId;
14
    public $affectedRows;
15
16
    /**
17
     * @var int
18
     */
19
    protected $id = self::QUERY;
20
21
    /**
22
     * @override
23
     * @inheritDoc
24
     */
25
    public function getSQL()
26
    {
27
        return ($this->context instanceof QueryInterface) ? $this->context->getSQL() : $this->context;
28
    }
29
30
    /**
31
     * @override
32
     * @inheritDoc
33
     */
34
    public function getRows()
35
    {
36
        return $this->resultRows;
0 ignored issues
show
Bug introduced by
The property resultRows does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
37
    }
38
39
    /**
40
     * @override
41
     * @inheritDoc
42
     */
43
    public function getFields()
44
    {
45
        return $this->resultFields;
0 ignored issues
show
Bug introduced by
The property resultFields does not seem to exist. Did you mean fields?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
46
    }
47
}
48