StrikethroughDelimiterProcessor   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

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

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getOpeningCharacter() 0 4 1
A getClosingCharacter() 0 4 1
A getMinLength() 0 4 1
A getDelimiterUse() 0 4 1
A process() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the league/commonmark-ext-strikethrough package.
5
 *
6
 * (c) Colin O'Dell <[email protected]> and uAfrica.com (http://uafrica.com)
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace League\CommonMark\Ext\Strikethrough;
13
14
use League\CommonMark\Delimiter\DelimiterInterface;
15
use League\CommonMark\Delimiter\Processor\DelimiterProcessorInterface;
16
use League\CommonMark\Extension\Strikethrough\StrikethroughDelimiterProcessor as CoreProcessor;
17
use League\CommonMark\Inline\Element\AbstractStringContainer;
18
19
/**
20
 * @deprecated The league/commonmark-ext-strikethrough extension is now deprecated. All functionality has been moved into league/commonmark 1.3+, so use that instead.
21
 */
22
final class StrikethroughDelimiterProcessor implements DelimiterProcessorInterface
23
{
24
    private $coreProcessor;
25
26
    public function __construct()
27
    {
28
        @trigger_error(sprintf('league/commonmark-ext-strikethrough is deprecated; use %s from league/commonmark 1.3+ instead', CoreProcessor::class), E_USER_DEPRECATED);
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
29
        $this->coreProcessor = new CoreProcessor();
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function getOpeningCharacter(): string
36
    {
37
        return $this->coreProcessor->getOpeningCharacter();
38
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43
    public function getClosingCharacter(): string
44
    {
45
        return $this->coreProcessor->getClosingCharacter();
46
    }
47
48
    /**
49
     * {@inheritdoc}
50
     */
51
    public function getMinLength(): int
52
    {
53
        return $this->coreProcessor->getMinLength();
54
    }
55
56
    /**
57
     * {@inheritdoc}
58
     */
59
    public function getDelimiterUse(DelimiterInterface $opener, DelimiterInterface $closer): int
60
    {
61
        return $this->coreProcessor->getDelimiterUse($opener, $closer);
62
    }
63
64
    /**
65
     * {@inheritdoc}
66
     */
67
    public function process(AbstractStringContainer $opener, AbstractStringContainer $closer, int $delimiterUse)
68
    {
69
        return $this->coreProcessor->process($opener, $closer, $delimiterUse);
70
    }
71
}
72