GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

ColumnCreator::create()   C
last analyzed

Complexity

Conditions 13
Paths 13

Size

Total Lines 31
Code Lines 28

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 31
rs 5.1234
cc 13
eloc 28
nc 13
nop 3

How to fix   Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
namespace Rentgen\Database\Column;
4
5
use Rentgen\Exception\NotSupportedException;
6
7
class ColumnCreator
8
{
9
    public function create($name, $type, array $options = array())
10
    {
11
        switch ($type) {
12
            case 'string':
13
                return new StringColumn($name, $options);
14
            case 'text':
15
                return new TextColumn($name, $options);
16
            case 'integer':
17
                return new IntegerColumn($name, $options);
18
            case 'biginteger':
19
                return new BigIntegerColumn($name, $options);
20
            case 'smallinteger':
21
                return new SmallIntegerColumn($name, $options);
22
            case 'float':
23
                return new FloatColumn($name, $options);
24
            case 'decimal':
25
                return new DecimalColumn($name, $options);
26
            case 'boolean':
27
                return new BooleanColumn($name, $options);
28
            case 'date':
29
                return new DateColumn($name, $options);
30
            case 'time':
31
                return new TimeColumn($name, $options);
32
            case 'datetime':
33
                return new DateTimeColumn($name, $options);
34
            case 'binary':
35
                return new BinaryColumn($name, $options);
36
            default:
37
                throw new NotSupportedException(sprintf('Type %s is not suppoted.', $type));
38
        }
39
    }
40
}
41