Foreign   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A prepare() 0 18 2
1
<?php
2
3
namespace Eliurkis\Crud\FieldTypes;
4
5
class Foreign
6
{
7
    public static function prepare($name, $options = [], $value = null, $properties = [])
8
    {
9
        // Define the total of columns
10
        $colsSize = 12 / $properties['config']['cols'];
11
12
        $html = '<div class="row i-checks">';
13
        foreach ($options as $key => $option) {
14
            $uniqueId = uniqid('opt', true).md5(mt_rand(1, 1000));
15
            $html .=
16
                '<div class="col-md-'.$colsSize.' col-xs-12">'.
17
                \Form::checkbox($name.'[]', $key, in_array($key, (array) $value), ['id' => $uniqueId]).
18
                \Form::label($uniqueId, $option).
19
                '</div>';
20
        }
21
        $html .= '</div>';
22
23
        return $html;
24
    }
25
}
26