Completed
Push — master ( 375486...00a9d7 )
by Beniamin
02:41
created

PDOStatement::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 0
cts 3
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
crap 2
1
<?php
2
3
/**
4
 * This file is part of Phuria SQL Builder package.
5
 *
6
 * Copyright (c) 2016 Beniamin Jonatan Šimko
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Phuria\SQLBuilder\Statement;
13
14
/**
15
 * @author Beniamin Jonatan Šimko <[email protected]>
16
 */
17
class PDOStatement implements StatementInterface
18
{
19
    /**
20
     * @var \PDOStatement $wrappedStatement
21
     */
22
    private $wrappedStatement;
23
24
    /**
25
     * @param \PDOStatement $statement
26
     */
27 2
    public function __construct(\PDOStatement $statement)
28
    {
29 2
        $this->wrappedStatement = $statement;
30 2
    }
31
32
    /**
33
     * @inheritdoc
34
     */
35
    public function bindValue($parameter, $value)
36
    {
37
        $this->wrappedStatement->bindValue($parameter, $value);
38
39
        return $this;
40
    }
41
42
    /**
43
     * @inheritdoc
44
     */
45
    public function rowCount()
46
    {
47
        return $this->wrappedStatement->rowCount();
48
    }
49
50
    /**
51
     * @inheritdoc
52
     */
53
    public function execute()
54
    {
55
        $this->wrappedStatement->execute();
56
57
        return $this;
58
    }
59
60
    /**
61
     * @inheritdoc
62
     */
63
    public function fetch($mode = \PDO::FETCH_ASSOC)
64
    {
65
        if (0 === $this->rowCount()) {
66
            return null;
67
        }
68
69
        return $this->wrappedStatement->fetch($mode);
70
    }
71
}