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

FieldTypeGuesser::getTypeAndOptions()   B

Complexity

Conditions 4
Paths 4

Size

Total Lines 25
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 25
rs 8.5806
cc 4
eloc 16
nc 4
nop 1
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