Completed
Push — master ( c891e1...8fa5d0 )
by Beniamin
06:55
created

PDOStatement::bindValue()   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
c 0
b 0
f 0
rs 9.4285
ccs 0
cts 3
cp 0
cc 1
eloc 3
nc 1
nop 2
crap 2
1
<?php
2
3
/**
4
 * This file is part of UnderQuery 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\UnderQuery\Statement;
13
14
use Phuria\UnderQuery\Parameter\QueryParameterInterface;
15
16
/**
17
 * @author Beniamin Jonatan Šimko <[email protected]>
18
 */
19
class PDOStatement implements StatementInterface
20
{
21
    /**
22
     * @var \PDOStatement
23
     */
24
    private $wrappedStatement;
25
26
    /**
27
     * @param \PDOStatement $stmt
28
     */
29 3
    public function __construct(\PDOStatement $stmt)
30
    {
31 3
        $this->wrappedStatement = $stmt;
32 3
    }
33
34
    /**
35
     * @return \PDOStatement
36
     */
37 1
    public function getWrappedStatement()
38
    {
39 1
        return $this->wrappedStatement;
40
    }
41
42
    /**
43
     * @inheritdoc
44
     */
45
    public function bindParameter(QueryParameterInterface $parameter)
46
    {
47
        $this->bindValue($parameter->getName(), $parameter->getValue());
48
49
        return $this;
50
    }
51
52
    /**
53
     * @param QueryParameterInterface[] $parameters
54
     *
55
     * @return $this
56
     */
57
    public function bindParameters($parameters)
58
    {
59
        foreach ($parameters as $parameter) {
60
            $this->bindParameter($parameter);
61
        }
62
63
        return $this;
64
    }
65
66
    /**
67
     * @inheritdoc
68
     */
69
    public function bindValue($name, $value)
70
    {
71
        $this->wrappedStatement->bindValue($name, $value);
72
73
        return $this;
74
    }
75
76
    /**
77
     * @inheritdoc
78
     */
79 1
    public function execute()
80
    {
81 1
        $this->wrappedStatement->execute();
82
83 1
        return $this;
84
    }
85
86
    /**
87
     * @inheritdoc
88
     */
89 1
    public function rowCount()
90
    {
91 1
        return $this->wrappedStatement->rowCount();
92
    }
93
}