Completed
Pull Request — master (#1)
by
unknown
08:32
created

Prepared::setParams()   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 5
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 2
1
<?php
2
namespace Dazzle\PgSQL\Statement;
3
4
use Dazzle\PgSQL\Connection\ConnectorInterface;
5
use Dazzle\Promise\Deferred;
6
7
class Prepared extends Deferred implements PreparedStatement
8
{
9
    use StatementAwareTrait;
10
    use StatementHandlerTrait;
11
12
    protected $prepare;
13
14
    public function __construct(PrepareQuery $prepare)
15
    {
16
        parent::__construct();
17
        $this->prepare = $prepare;
18
    }
19
20
    public function getParams()
21
    {
22
        return $this->prepare->getParams();
23
    }
24
25
    public function setParams(array $params = [])
26
    {
27
        $this->prepare->setParams($params);
28
29
        return $this;
30
    }
31
32
    public function execute(ConnectorInterface $connector)
33
    {
34
        return \pg_send_execute($connector->getStream(), $this->prepare->getName(), $this->getParams());
35
    }
36
37
    public function execPreparedStmt()
38
    {
39
        $connector = $this->prepare->getPipe();
40
        $promise = $this->getPromise();
41
        $connector->appendQuery($this);
42
43
        return $promise;
44
    }
45
}