Completed
Pull Request — dev (#6)
by Arnaud
07:28 queued 04:28
created

FieldTypeGuesser   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 28
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B getTypeAndOptions() 0 25 4
1
<?php
2
3
namespace LAG\AdminBundle\Utils;
4
5
6
class FieldTypeGuesser
7
{
8
    public function getTypeAndOptions($doctrineType)
9
    {
10
        $fieldOptions = [];
11
12
        if ($doctrineType == 'string') {
13
            $fieldOptions = [
14
                'type' => 'string',
15
                'options' => [
16
17
                    'length' => 100
18
                ]
19
            ];
20
        } else if ($doctrineType == 'boolean') {
21
            $fieldOptions = [
22
                'type' => 'boolean',
23
                'options' => []
24
            ];
25
        } else if ($doctrineType == 'datetime') {
26
            $fieldOptions = [
27
                'type' => 'date',
28
                'options' => []
29
            ];
30
        }
31
        return $fieldOptions;
32
    }
33
}
34