OCI8   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 67
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 31
c 2
b 0
f 0
dl 0
loc 67
ccs 0
cts 4
cp 0
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A decodeParamConstant() 0 3 2
A isParamConstant() 0 3 2
1
<?php
2
3
/**
4
 * For the full copyright and license information, please view
5
 * the LICENSE file that was distributed with this source code.
6
 *
7
 * @see https://github.com/ecphp
8
 */
9
10
declare(strict_types=1);
11
12
namespace EcPhp\DoctrineOci8\Doctrine\DBAL\Driver\OCI8;
13
14
final class OCI8
15
{
16
    public const PARAM_AFC = 0xA060;
17
18
    public const PARAM_AVC = 0xA061;
19
20
    public const PARAM_BDOUBLE = 0xA016;
21
22
    public const PARAM_BFILEE = 0xA072;
23
24
    public const PARAM_BFLOAT = 0xA015;
25
26
    public const PARAM_BIN = 0xA017;
27
28
    public const PARAM_BLOB = 0xA071;
29
30
    public const PARAM_BOOL = 0xA0FC;
31
32
    public const PARAM_CFILEE = 0xA073;
33
34
    // OCI8::PARAM_* constants are prefixed with binary 1010 (0xA) in the -4th nibble.
35
    public const PARAM_CHR = 0xA001;
36
37
    public const PARAM_CLOB = 0xA070;
38
39
    public const PARAM_CURSOR = 0xA074;
40
41
    public const PARAM_FLT = 0xA004;
42
43
    public const PARAM_INT = 0xA003;
44
45
    public const PARAM_LBI = 0xA018;
46
47
    public const PARAM_LNG = 0xA008;
48
49
    public const PARAM_LVC = 0xA05E;
50
51
    public const PARAM_MAX = 0xAFFF;
52
53
    public const PARAM_NTY = 0xA06C;
54
55
    public const PARAM_NUM = 0xA002;
56
57
    public const PARAM_ODT = 0xA09C;
58
59
    public const PARAM_PREFIX = 0xA000;
60
61
    public const PARAM_ROWID = 0xA068;
62
63
    public const PARAM_STR = 0xA005;
64
65
    public const PARAM_UIN = 0xA044;
66
67
    public const PARAM_VCS = 0xA009;
68
69
    public const RETURN_CURSORS = 0x0200;
70
71
    public const RETURN_RESOURCES = 0x0100;
72
73
    public static function decodeParamConstant(int $value): int
74
    {
75
        return self::isParamConstant($value) ? ($value & ~self::PARAM_PREFIX) : $value;
76
    }
77
78
    public static function isParamConstant(int $value): bool
79
    {
80
        return self::PARAM_PREFIX <= $value && self::PARAM_MAX >= $value;
81
    }
82
}
83