Passed
Pull Request — master (#15)
by Wilmer
01:39
created

Command   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
c 1
b 0
f 0
dl 0
loc 22
rs 10
wmc 5

1 Method

Rating   Name   Duplication   Size   Complexity  
A bindPendingParams() 0 20 5
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Db\Oracle;
6
7
use PDO;
8
use Yiisoft\Db\Command\Command as AbstractCommand;
9
10
/**
11
 * Command represents an Oracle SQL statement to be executed against a database.
12
 */
13
final class Command extends AbstractCommand
14
{
15
    protected function bindPendingParams(): void
16
    {
17
        $paramsPassedByReference = [];
18
        $pdoStatement = $this->getPdoStatement();
19
20
        foreach ($this->pendingParams as $name => $value) {
21
            if (PDO::PARAM_STR === $value[1] && $pdoStatement !== null) {
22
                $paramsPassedByReference[$name] = $value[0];
23
                $pdoStatement->bindParam(
24
                    $name,
25
                    $paramsPassedByReference[$name],
26
                    $value[1],
27
                    strlen($value[0])
28
                );
29
            } elseif ($pdoStatement !== null) {
30
                $pdoStatement->bindValue($name, $value[0], $value[1]);
31
            }
32
        }
33
34
        $this->pendingParams = [];
35
    }
36
}
37