Completed
Push — master ( 2d7ca6...a6d5b0 )
by wen
15:16
created

Tinymce::getPlugins()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Sco\Admin\Form\Elements;
4
5
class Tinymce extends NamedElement
6
{
7
    protected $type = 'tinymce';
8
9
    protected $size = 'basic';
10
11
    protected $options = [];
12
13
    protected $baseUrl;
14
15
    protected $plugins;
16
17
    public function basicToolbar()
18
    {
19
        $this->size = 'basic';
20
21
        return $this;
22
    }
23
24
    public function simpleToolbar()
25
    {
26
        $this->size = 'simple';
27
28
        return $this;
29
    }
30
31
    /**
32
     * @param array $toolbar
33
     *
34
     * @return Tinymce
35
     */
36
    public function setToolbar(array $toolbar)
37
    {
38
        $this->options['toolbar'] = $toolbar;
39
40
        return $this;
41
    }
42
43
    /**
44
     * @return mixed
45
     */
46
    public function getBaseUrl()
47
    {
48
        if ($this->baseUrl) {
49
            return $this->baseUrl;
50
        }
51
        return url('js/tinymce');
52
    }
53
54
    /**
55
     * @param mixed $baseUrl
56
     *
57
     * @return Tinymce
58
     */
59
    public function setBaseUrl($baseUrl)
60
    {
61
        $this->baseUrl = $baseUrl;
62
63
        return $this;
64
    }
65
66
    /**
67
     * @return mixed
68
     */
69
    public function getPlugins()
70
    {
71
        return $this->plugins;
72
    }
73
74
    /**
75
     * @param mixed $plugins
76
     *
77
     * @return Tinymce
78
     */
79
    public function setPlugins($plugins)
80
    {
81
        $this->plugins = $plugins;
82
83
        return $this;
84
    }
85
86
    /**
87
     * @return mixed
88
     */
89
    public function getOptions()
90
    {
91
        return $this->options;
92
    }
93
94
    /**
95
     * @param mixed $options
96
     *
97
     * @return Tinymce
98
     */
99
    public function setOptions($options)
100
    {
101
        $this->options = $options;
0 ignored issues
show
Documentation Bug introduced by
It seems like $options of type * is incompatible with the declared type array of property $options.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
102
103
        return $this;
104
    }
105
106
    public function toArray()
107
    {
108
        $data = [
109
            'size'    => $this->size,
110
            'baseUrl' => $this->getBaseUrl(),
111
            'options' => $this->getOptions(),
112
        ];
113
        if (($plugins = $this->getPlugins())) {
114
            $data['plugins'] = $plugins;
115
        }
116
117
        return parent::toArray() + $data;
118
    }
119
}
120