Completed
Push — master ( 145f77...f73370 )
by James Ekow Abaka
04:01
created

MysqlAdapter::mapDataTypes()   B

Complexity

Conditions 8
Paths 8

Size

Total Lines 21
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 8.512

Importance

Changes 4
Bugs 1 Features 1
Metric Value
c 4
b 1
f 1
dl 0
loc 21
ccs 12
cts 15
cp 0.8
rs 7.1428
cc 8
eloc 17
nc 8
nop 1
crap 8.512
1
<?php
2
namespace ntentan\nibii\adapters;
3
4
class MysqlAdapter extends \ntentan\nibii\DriverAdapter
5
{
6 4
    public function mapDataTypes($nativeType)
7
    {
8
        switch($nativeType)
9
        {
10 4
            case 'int':
11 4
                return 'integer';
12 4
            case 'varchar':
13 4
                return 'string';
14 4
            case 'tinyint':
15 2
                return 'boolean';
16 4
            case 'timestamp':
17 2
            case 'datetime':
18 2
                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