Completed
Push — dev ( 65a8c9...5713e7 )
by James Ekow Abaka
03:59
created

MysqlAdapter::mapDataTypes()   B

Complexity

Conditions 8
Paths 8

Size

Total Lines 21

Duplication

Lines 21
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 72

Importance

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