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

RowMarkup   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 95.83%

Importance

Changes 0
Metric Value
wmc 9
lcom 1
cbo 1
dl 0
loc 62
ccs 23
cts 24
cp 0.9583
rs 10
c 0
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A fields() 0 6 1
A getFields() 0 4 1
A shouldSkip() 0 4 1
A isMarkupRow() 0 4 1
A getListValue() 0 4 1
A getEditFormValue() 0 8 1
A getCreateFormValue() 0 7 1
A prepare() 0 6 2
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