InputTypeResolverTrait   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 21
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getInputFor() 0 11 3
1
<?php
2
3
namespace Scaffolder\Compilers\Support;
4
5
trait InputTypeResolverTrait
6
{
7
    /**
8
     * Get the input for the field.
9
     *
10
     * @param $fieldData
11
     *
12
     * @return string
13
     */
14
    public static function getInputFor($fieldData)
15
    {
16
        if ($fieldData->type->ui == 'text')
17
        {
18
            return '{!! Form::text(\'%s\', (isset($model)) ? $model->' . $fieldData->name . ' : null) !!}';
19
        }
20
        elseif ($fieldData->type->ui == 'textarea')
21
        {
22
            return '{!! Form::textarea(\'%s\', (isset($model)) ? $model->' . $fieldData->name . ' : null) !!}';
23
        }
24
    }
25
}