Passed
Push — master ( f6e0b1...9f2568 )
by Yaro
23:37
created

Markdown::getEditFormView()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9

Duplication

Lines 9
Ratio 100 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 9
loc 9
rs 9.9666
c 0
b 0
f 0
ccs 5
cts 5
cp 1
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
namespace Yaro\Jarboe\Table\Fields;
4
5
use Illuminate\Http\Request;
6
use Yaro\Jarboe\Table\Fields\Traits\Orderable;
7
use Yaro\Jarboe\Table\Fields\Traits\Translatable;
8
9
class Markdown extends AbstractField
10
{
11
    use Orderable;
12
    use Translatable;
13
14 1
    public function value(Request $request)
15
    {
16 1
        $value = parent::value($request);
17
18 1
        return is_array($value) ? $value : (string) $value;
19
    }
20
21 1 View Code Duplication
    public function getListView($model)
22
    {
23 1
        $template = 'list';
24 1
        if ($this->isTranslatable()) {
25
            $template .= '_translatable';
26
        }
27
28 1
        return view('jarboe::crud.fields.markdown.'. $template, [
29 1
            'model' => $model,
30 1
            'field' => $this,
31
        ]);
32
    }
33
34 1 View Code Duplication
    public function getEditFormView($model)
35
    {
36 1
        $template = $this->isReadonly() ? 'readonly' : 'edit';
37
38 1
        return view('jarboe::crud.fields.markdown.'. $template, [
39 1
            'model' => $model,
40 1
            'field' => $this,
41
        ]);
42
    }
43
44 1
    public function getCreateFormView()
45
    {
46 1
        return view('jarboe::crud.fields.markdown.create', [
47 1
            'field' => $this,
48
        ]);
49
    }
50
}
51