MySqlGrammar   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 16
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A typeFloat() 0 7 3
1
<?php
2
/**
3
 * @package   fisharebest/laravel-floats
4
 * @copyright 2020 "Greg Roach" <[email protected]>
5
 * @licence   MIT
6
 */
7
namespace Fisharebest\LaravelFloats;
8
9
use Illuminate\Database\Schema\Grammars\MySqlGrammar as BaseMySqlGrammar;
10
use Illuminate\Support\Fluent;
11
12
class MySqlGrammar extends BaseMySqlGrammar
13
{
14
    /**
15
     * Create the column definition for a float type.
16
     *
17
     * @param  Fluent $column
18
     *
19
     * @return string
20
     */
21
    protected function typeFloat(Fluent $column)
22
    {
23
        if ($column->total && $column->places) {
24
            return "float({$column->total}, {$column->places})";
25
        }
26
27
        return 'float';
28
    }
29
}
30