ColorPicker::getEditFormView()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 4
c 0
b 0
f 0
nc 2
nop 1
dl 0
loc 7
ccs 5
cts 5
cp 1
crap 2
rs 10
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\Placeholder;
8
9
class ColorPicker 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...
10
{
11
    use Orderable;
12
    use Placeholder;
13
14
    const HEX = 'hex';
15
    const RGBA = 'rgba';
16
17
    protected $type = self::HEX;
18
19 1
    public function value(Request $request)
20
    {
21 1
        return (string) parent::value($request);
22
    }
23
24 2
    public function type($type)
25
    {
26 2
        $type = strtolower($type);
27
        switch ($type) {
28 2
            case self::HEX:
29 2
            case self::RGBA:
30 1
                $this->type = $type;
31 1
                break;
32
            default:
33 1
                $this->type = self::HEX;
34
        }
35
36 2
        return $this;
37
    }
38
39 3
    public function getType()
40
    {
41 3
        return $this->type;
42
    }
43
44 1
    public function getListView($model)
45
    {
46 1
        return view('jarboe::crud.fields.color-picker.list', [
47 1
            'model' => $model,
48 1
            'field' => $this,
49
        ]);
50
    }
51
52 1
    public function getEditFormView($model)
53
    {
54 1
        $template = $this->isReadonly() ? 'readonly' : 'edit';
55
56 1
        return view('jarboe::crud.fields.color-picker.'. $template, [
57 1
            'model' => $model,
58 1
            'field' => $this,
59
        ]);
60
    }
61
62 1
    public function getCreateFormView()
63
    {
64 1
        return view('jarboe::crud.fields.color-picker.create', [
65 1
            'field' => $this,
66
        ]);
67
    }
68
}
69