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

HtmlEncoder   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 36
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A encode() 0 6 2
A getFlags() 0 4 1
1
<?php
2
3
namespace Fabfuel\Prophiler\Toolbar\Formatter\Encoder;
4
5
class HtmlEncoder implements EncoderInterface
6
{
7
8
    /**
9
     * @var string
10
     */
11
    protected $encoding;
12
13
    /**
14
     * @param string $encoding
15
     */
16
    public function __construct($encoding = '')
17
    {
18
        $this->encoding = $encoding;
19
    }
20
21
    /**
22
     * @param string $encode
23
     *
24
     * @return string
25
     */
26
    public function encode($encode)
27
    {
28
        return is_string($encode)
29
            ? htmlentities($encode, static::getFlage(), '', false)
0 ignored issues
show
Bug introduced by
The method getFlage() does not seem to exist on object<Fabfuel\Prophiler...er\Encoder\HtmlEncoder>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
30
            : $encode;
31
    }
32
33
    /**
34
     * @return int
35
     */
36
    protected static function getFlags()
37
    {
38
        return ENT_QUOTES | ENT_HTML5 | ENT_SUBSTITUTE;
39
    }
40
}
41