Passed
Pull Request — master (#721)
by Florian
14:00 queued 04:02
created

TextEditor::fontarray()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 1
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace JeroenNoten\LaravelAdminLte\Components;
4
5
use Illuminate\View\Component;
6
7
class TextEditor extends Component
8
{
9
    public $id;
10
    public $name;
11
    public $label;
12
    public $placeholder;
13
    public $topclass;
14
    public $inputclass;
15
    public $body;
16
    public $disabled;
17
    public $required;
18
    public $height;
19
    public $fonts;
20
    public $def_fonts = ['Arial', 'Arial Black', 'Comic Sans MS', 'Courier New', 'Impact', 'Montserrat',  'Open Sans', 'Ubuntu', 'Rajdhani'];
21
22
    public function __construct(
23
            $id, $name = null,
24
            $label = 'Input Label', $placeholder = null,
25
            $topclass = null, $inputclass = null,
26
            $body = null, $disabled = false, $required = false,
27
            $height = 500, $fonts = null
28
        ) {
29
        $this->id = $id;
30
        $this->name = $name;
31
        $this->label = $label;
32
        $this->placeholder = $placeholder;
33
        $this->topclass = $topclass;
34
        $this->inputclass = $inputclass;
35
        $this->body = $body;
36
        $this->required = $required;
37
        $this->disabled = $disabled;
38
        $this->height = $height;
39
        $this->fonts = $fonts;
40
    }
41
42
    public function fontarray()
43
    {
44
        return $this->fonts == null ? json_encode($this->def_fonts) : $this->fonts;
45
    }
46
47
    public function render()
48
    {
49
        return view('adminlte::text-editor');
50
    }
51
}
52