ColorPicker::value()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
ccs 2
cts 2
cp 1
crap 1
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