MichelfPHPMarkdownAdapter   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 20
loc 20
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 5 5 1
A transformText() 4 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace MaglMarkdown\Adapter;
4
5
use Michelf\Markdown;
6
7
/**
8
 * This is an implementation that uses Michel Fortin's PHP Markdown to transform the Markup to HTML
9
 *
10
 * @see    http://michelf.ca/projects/php-markdown/ Michel Fortin's PHP Markdown
11
 * @author Matthias Glaub <[email protected]>
12
 */
13 View Code Duplication
class MichelfPHPMarkdownAdapter extends AbstractMichelfPHPMarkdown implements MarkdownAdapterInterface
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...
14
{
15
16
    /**
17
     *
18
     * @var Markdown
19
     */
20
    private $parser;
21
22 1
    public function __construct(array $options = null)
23
    {
24 1
        $this->parser = new Markdown();
25 1
        $this->setParserOptions($this->parser, $options);
26 1
    }
27
28 1
    public function transformText($text)
29
    {
30 1
        return $this->parser->transform($text);
31
    }
32
}
33