QuoteHandler::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Kaloa\Renderer\Inigo\Handler;
4
5
use Kaloa\Renderer\Inigo\Handler\ProtoHandler;
6
use Kaloa\Renderer\Inigo\Parser;
7
8
/**
9
 *
10
 */
11
final class QuoteHandler extends ProtoHandler
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
12
{
13
    /**
14
     *
15
     */
16 18
    public function __construct()
17
    {
18 18
        $this->name = 'quote';
19 18
        $this->type = Parser::TAG_OUTLINE | Parser::TAG_FORCE_PARAGRAPHS;
20 18
        $this->defaultParam = 'author';
21 18
    }
22
23
    /**
24
     *
25
     * @param  array  $data
26
     * @return string
27
     */
28 1
    public function draw(array $data)
29
    {
30 1
        $ret = '';
31
32 1
        if ($data['front']) {
33 1
            $author = $this->fillParam($data, 'author', '');
34
35 1
            if ('' !== $author) {
36 1
                $ret .= '<p>' . $this->e($author) . ':</p>' . "\n\n";
37 1
            }
38
39 1
            $ret .= '<blockquote>' . "\n";
40 1
        } else {
41 1
            $ret .= '</blockquote>' . "\n\n";
42
        }
43
44 1
        return $ret;
45
    }
46
}
47