StaticLabel::getLabel()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 3
c 1
b 0
f 0
nc 3
nop 2
dl 0
loc 8
ccs 4
cts 4
cp 1
crap 3
rs 10
1
<?php namespace Distilleries\FormBuilder\Helpers;
2
3
class StaticLabel {
4
5
    const STATUS_OFFLINE = 0;
6
    const STATUS_ONLINE = 1;
7
8 30
    public static function yesNo($id = null)
9
    {
10
        $items = [
11 30
            self::STATUS_OFFLINE => trans('form-builder::form.no'),
12 30
            self::STATUS_ONLINE  => trans('form-builder::form.yes'),
13
        ];
14
15 30
        return self::getLabel($items, $id);
16
17
    }
18
19 30
    public static function getLabel($items, $id = null)
20
    {
21 30
        if (isset($id))
22
        {
23 8
            return isset($items[$id]) ? $items[$id] : trans('form-builder::form.na');
24
        }
25
26 24
        return $items;
27
    }
28
}