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

MysqlAdapter   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 24
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 8
lcom 0
cbo 1
dl 24
loc 24
ccs 0
cts 16
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B mapDataTypes() 21 21 8

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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