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

Markdown   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 5
c 0
b 0
f 0
lcom 1
cbo 1
dl 0
loc 44
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getConfigs() 0 8 2
A getDefaultConfigs() 0 6 1
A setConfigs() 0 6 1
A toArray() 0 6 1
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