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

HtmlEncoder::encode()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 2
eloc 4
nc 2
nop 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