FieldTypes::addFieldType()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Hechoenlaravel\JarvisFoundation\Field;
4
5
/**
6
 * Class FieldTypes
7
 * @package Hechoenlaravel\JarvisFoundation\Field
8
 */
9
class FieldTypes
10
{
11
    /**
12
     * The field types registred
13
     * @var array
14
     */
15
    public $types = [];
16
17
18
    /**
19
     * Add a field type to the stack
20
     * @param $field
21
     */
22
    public function addFieldType($field)
23
    {
24
        $this->types[$field['type']] = $field['class'];
25
    }
26
27
    public function getFieldClass($type)
28
    {
29
        return app($this->types[$type]);
30
    }
31
}
32