Ajde_Component_Markdown::processStatic()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 2
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
include 'Markdown/markdown.php';
4
5
class Ajde_Component_Markdown extends Ajde_Component
6
{
7
    public static function processStatic(Ajde_Template_Parser $parser, $attributes)
8
    {
9
        $instance = new self($parser, $attributes);
10
11
        return $instance->process();
12
    }
13
14
    protected function _init()
15
    {
16
        return [
17
            'text' => 'toHtml',
18
        ];
19
    }
20
21
    public function process()
22
    {
23
        switch ($this->_attributeParse()) {
24
            case 'toHtml':
25
                $text = $this->attributes['text'];
26
27
                return Markdown($text);
28
                break;
0 ignored issues
show
Unused Code introduced by
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
29
        }
30
        // TODO:
31
        throw new Ajde_Component_Exception('Missing required attributes for component call');
32
    }
33
}
34