Completed
Push — develop ( fd1ec4...9ebe7a )
by Schlaefer
02:36
created

Html5Video::_parse()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 8

Duplication

Lines 8
Ratio 100 %

Importance

Changes 0
Metric Value
cc 3
nc 2
nop 3
dl 8
loc 8
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Plugin\BbcodeParser\src\Lib\jBBCode\Definitions;
4
5
use Plugin\BbcodeParser\src\Lib\Helper\UrlParserTrait;
6
use Plugin\BbcodeParser\src\Lib\jBBCode\Definitions\CodeDefinition;
7
8
//@codingStandardsIgnoreStart
9 View Code Duplication
class Html5Audio extends CodeDefinition
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...
10
//@codingStandardsIgnoreEnd
11
{
12
    use UrlParserTrait;
13
14
    protected $_sTagName = 'audio';
15
16
    protected $_sParseContent = false;
17
18
    /**
19
     * {@inheritDoc}
20
     */
21
    protected function _parse($content, $attributes, \JBBCode\ElementNode $node)
22
    {
23
        if (!empty($attributes['src']) && $attributes['src'] === 'upload') {
24
            $content = $this->_linkToUploadedFile($content);
25
        }
26
27
        return "<audio src='$content' controls='controls' preload='metadata' x-webkit-airplay='allow'></audio>";
28
    }
29
}
30
31
//@codingStandardsIgnoreStart
32
class Html5AudioWithAttributes extends Html5Audio
33
//@codingStandardsIgnoreEnd
34
{
35
    protected $_sUseOptions = true;
36
}
37
38
//@codingStandardsIgnoreStart
39 View Code Duplication
class Html5Video extends CodeDefinition
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...
40
//@codingStandardsIgnoreEnd
41
{
42
    use UrlParserTrait;
43
44
    protected $_sTagName = 'video';
45
46
    protected $_sParseContent = false;
47
48
    /**
49
     * {@inheritDoc}
50
     */
51
    protected function _parse($content, $attributes, \JBBCode\ElementNode $node)
52
    {
53
        if (!empty($attributes['src']) && $attributes['src'] === 'upload') {
54
            $content = $this->_linkToUploadedFile($content);
55
        }
56
57
        return "<video src='$content' controls='controls' preload='metadata' x-webkit-airplay='allow'></video>";
58
    }
59
}
60
61
//@codingStandardsIgnoreStart
62
class Html5VideoWithAttributes extends Html5Video
63
//@codingStandardsIgnoreEnd
64
{
65
    protected $_sUseOptions = true;
66
}
67