Completed
Pull Request — develop (#59)
by
unknown
05:37
created

HtmlEncoder   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 31
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A encode() 0 6 2
1
<?php
2
3
namespace Fabfuel\Prophiler\Toolbar\Formatter\Encoder;
4
5
class HtmlEncoder implements EncoderInterface
6
{
7
8
    const ENCODER_FLAGS = ENT_QUOTES | ENT_HTML5 | ENT_SUBSTITUTE;
9
10
    /**
11
     * @var string
12
     */
13
    protected $encoding;
14
15
    /**
16
     * @param string $encoding
17
     */
18
    public function __construct($encoding = '')
19
    {
20
        $this->encoding = $encoding;
21
    }
22
23
    /**
24
     * @param string $encode
25
     *
26
     * @return string
27
     */
28
    public function encode($encode)
29
    {
30
        return is_string($encode)
31
            ? htmlentities($encode, static::ENCODER_FLAGS, '', false)
32
            : $encode;
33
    }
34
35
}
36