Completed
Push — master ( 1121c7...c4e7d6 )
by wen
13:05
created

Markdown::getDefaultConfigs()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
namespace Sco\Admin\Form\Elements;
4
5
/**
6
 * @see https://github.com/hinesboy/mavonEditor
7
 */
8
class Markdown extends NamedElement
9
{
10
    protected $type = 'markdown';
11
12
    protected $configs;
13
14
    /**
15
     * @return array
16
     */
17
    public function getConfigs(): array
18
    {
19
        if ($this->configs) {
20
            return $this->configs;
21
        }
22
23
        return $this->getDefaultConfigs();
24
    }
25
26
    protected function getDefaultConfigs()
27
    {
28
        return [
29
            'autoDownloadFontAwesome' => false,
30
        ];
31
    }
32
33
    /**
34
     * @param array $configs
35
     *
36
     * @return Simplemde
37
     */
38
    public function setConfigs(array $configs): Simplemde
39
    {
40
        $this->configs = $configs;
41
42
        return $this;
43
    }
44
45
    public function toArray()
46
    {
47
        return parent::toArray() + [
48
                'configs' => $this->getConfigs(),
49
            ];
50
    }
51
}
52