Completed
Push — dev ( 5713e7...bd9957 )
by James Ekow Abaka
03:41
created

MysqlAdapter::mapDataTypes()   B

Complexity

Conditions 8
Paths 8

Size

Total Lines 21

Duplication

Lines 21
Ratio 100 %

Code Coverage

Tests 13
CRAP Score 8.4218

Importance

Changes 0
Metric Value
dl 21
loc 21
ccs 13
cts 16
cp 0.8125
rs 8.4444
c 0
b 0
f 0
cc 8
nc 8
nop 1
crap 8.4218
1
<?php
2
namespace ntentan\nibii\adapters;
3
4 View Code Duplication
class MysqlAdapter extends \ntentan\nibii\DriverAdapter
5
{
6 14
    public function mapDataTypes($nativeType)
7
    {
8 14
        switch($nativeType)
9
        {
10 14
            case 'int':
11 14
                return 'integer';
12 14
            case 'varchar':
13 14
                return 'string';
14 11
            case 'tinyint':
15 11
                return 'boolean';
16 11
            case 'timestamp':
17 2
            case 'datetime':
18 11
                return 'datetime';
19 2
            case 'text':
20 2
                return 'text';
21
            case 'date':
22
                return 'date';
23
            default:
24
                throw new \Exception("Unknown type {$nativeType}");
25
        }
26
    }
27
}
28