Completed
Push — master ( c1b59a...ea89b8 )
by Sébastien
03:58
created

PdoMysqlMapping   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 44
ccs 24
cts 24
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B getDatatypeMapping() 0 36 1
1
<?php
2
3
namespace Soluble\Metadata\Reader\Mapping;
4
5
use Soluble\Datatype\Column;
6
use ArrayObject;
7
8
class PdoMysqlMapping
9
{
10
11
    /**
12
     *
13
     * @return ArrayObject
14
     */
15 3
    public static function getDatatypeMapping()
16
    {
17 3
        $mapping = new ArrayObject([
18 3
            'STRING' => ['type' => Column\Type::TYPE_STRING, 'native' => 'CHAR'],
19 3
            'VAR_STRING' => ['type' => Column\Type::TYPE_STRING, 'native' => 'VARCHAR'],
20
            // BLOBS ARE CURRENTLY SENT AS TEXT
21
            // I DIDN'T FIND THE WAY TO MAKE THE DIFFERENCE !!!
22 3
            'BLOB' => ['type' => Column\Type::TYPE_BLOB, 'native' => 'BLOB'],
23
            // integer
24 3
            'TINY' => ['type' => Column\Type::TYPE_INTEGER, 'native' => 'TINYINT'],
25 3
            'SHORT' => ['type' => Column\Type::TYPE_INTEGER, 'native' => 'SMALLINT'],
26 3
            'INT24' => ['type' => Column\Type::TYPE_INTEGER, 'native' => 'MEDIUMINT'],
27 3
            'LONG' => ['type' => Column\Type::TYPE_INTEGER, 'native' => 'INTEGER'],
28 3
            'LONGLONG' => ['type' => Column\Type::TYPE_INTEGER, 'native' => 'BIGINT'],
29
            // timestamps
30 3
            'TIMESTAMP' => ['type' => Column\Type::TYPE_DATETIME, 'native' => 'TIMESTAMP'],
31 3
            'DATETIME' => ['type' => Column\Type::TYPE_DATETIME, 'native' => 'DATETIME'],
32
            // dates
33 3
            'DATE' => ['type' => Column\Type::TYPE_DATE, 'native' => 'DATE'],
34 3
            'NEWDATE' => ['type' => Column\Type::TYPE_DATE, 'native' => 'DATE'],
35
            // time
36 3
            'TIME' => ['type' => Column\Type::TYPE_TIME, 'native' => 'TIME'],
37
            // decimals
38 3
            'DECIMAL' => ['type' => Column\Type::TYPE_DECIMAL, 'native' => 'DECIMAL'],
39 3
            'NEWDECIMAL' => ['type' => Column\Type::TYPE_DECIMAL, 'native' => 'DECIMAL'],
40 3
            'FLOAT' => ['type' => Column\Type::TYPE_FLOAT, 'native' => 'FLOAT'],
41 3
            'DOUBLE' => ['type' => Column\Type::TYPE_FLOAT, 'native' => 'DOUBLE'],
42
            // boolean
43 3
            'BIT' => ['type' => Column\Type::TYPE_BIT, 'native' => 'BIT'],
44 3
            'BOOLEAN' => ['type' => Column\Type::TYPE_BOOLEAN, 'native' => 'BOOLEAN'],
45 3
            'GEOMETRY' => ['type' => Column\Type::TYPE_SPATIAL_GEOMETRY, 'native' => null]
46 3
        ]);
47
48
49 3
        return $mapping;
50
    }
51
}
52