Completed
Push — master ( 798e92...ea2dad )
by Yaro
04:12 queued 26s
created

RowMarkup::getEditFormValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Yaro\Jarboe\Table\Fields\Markup;
4
5
use Illuminate\Http\Request;
6
use Yaro\Jarboe\Table\CRUD;
7
use Yaro\Jarboe\Table\Fields\AbstractField;
8
9
class RowMarkup extends AbstractField
10
{
11
    protected $fields = [];
12
13 3
    public function fields(array $fields)
14
    {
15 3
        $this->fields = $fields;
16
17 3
        return $this;
18
    }
19
20 4
    public function getFields(): array
21
    {
22 4
        return $this->fields;
23
    }
24
25
    protected $hidden = [
26
        'list'   => true,
27
        'edit'   => false,
28
        'create' => false,
29
    ];
30
31 1
    public function shouldSkip(Request $request)
32
    {
33 1
        return true;
34
    }
35
36 2
    public function isMarkupRow()
37
    {
38 2
        return true;
39
    }
40
41 1
    public function getListValue($model)
42
    {
43 1
        return '';
44
    }
45
46
    // TODO: interface type-hinting
47 1
    public function prepare(CRUD $crud)
48
    {
49 1
        foreach ($this->fields as $field) {
50 1
            $field->prepare($crud);
51
        }
52
    }
53
54 1
    public function getEditFormValue($model)
55
    {
56 1
        return view('jarboe::crud.inc.edit.tab', [
57 1
            'item'     => $model,
58 1
            'fields'   => $this->getFields(),
59 1
            'rowsLeft' => 12,
60
        ]);
61
    }
62
63 1
    public function getCreateFormValue()
64
    {
65 1
        return view('jarboe::crud.inc.create.tab', [
66 1
            'fields'   => $this->getFields(),
67 1
            'rowsLeft' => 12,
68
        ]);
69
    }
70
}
71