Passed
Pull Request — master (#721)
by Florian
09:26
created

TextEditor   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 19
c 1
b 0
f 0
dl 0
loc 37
rs 10
wmc 4

3 Methods

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