Text   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 28
c 1
b 0
f 0
dl 0
loc 52
rs 10
ccs 21
cts 21
cp 1
wmc 9

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getEditFormView() 0 7 2
A getListView() 0 10 2
A getCreateFormView() 0 6 1
A value() 0 8 4
1
<?php
2
3
namespace Yaro\Jarboe\Table\Fields;
4
5
use Illuminate\Http\Request;
6
use Yaro\Jarboe\Table\Fields\Traits\BelongsToArray;
7
use Yaro\Jarboe\Table\Fields\Traits\Clipboard;
8
use Yaro\Jarboe\Table\Fields\Traits\Inline;
9
use Yaro\Jarboe\Table\Fields\Traits\Maskable;
10
use Yaro\Jarboe\Table\Fields\Traits\Maxlength;
11
use Yaro\Jarboe\Table\Fields\Traits\Nullable;
12
use Yaro\Jarboe\Table\Fields\Traits\Orderable;
13
use Yaro\Jarboe\Table\Fields\Traits\Placeholder;
14
use Yaro\Jarboe\Table\Fields\Traits\Tooltip;
15
use Yaro\Jarboe\Table\Fields\Traits\Translatable;
16
17
class Text extends AbstractField
0 ignored issues
show
Bug introduced by
The type Yaro\Jarboe\Table\Fields\AbstractField was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
18
{
19
    use Orderable;
20
    use Nullable;
21
    use Tooltip;
22
    use Clipboard;
23
    use Inline;
24
    use Translatable;
25
    use Maskable;
26
    use Placeholder;
27
    use Maxlength;
28
    use BelongsToArray;
29
30 5
    public function value(Request $request)
31
    {
32 5
        $value = parent::value($request);
33 5
        if (is_null($value) && $this->isNullable()) {
34 2
            return null;
35
        }
36
37 5
        return is_array($value) ? $value : (string) $value;
38
    }
39
40 2
    public function getListView($model)
41
    {
42 2
        $template = 'list';
43 2
        if ($this->isTranslatable()) {
44 1
            $template .= '_translatable';
45
        }
46
47 2
        return view('jarboe::crud.fields.text.'. $template, [
48 2
            'model' => $model,
49 2
            'field' => $this,
50
        ]);
51
    }
52
53 1
    public function getEditFormView($model)
54
    {
55 1
        $template = $this->isReadonly() ? 'readonly' : 'edit';
56
57 1
        return view('jarboe::crud.fields.text.'. $template, [
58 1
            'model' => $model,
59 1
            'field' => $this,
60
        ]);
61
    }
62
63 1
    public function getCreateFormView()
64
    {
65 1
        $template = 'create';
66
67 1
        return view('jarboe::crud.fields.text.'. $template, [
68 1
            'field' => $this,
69
        ]);
70
    }
71
}
72