Completed
Push — master ( 93f504...996b1b )
by ignace nyamagana
03:50
created

Pass::getContent()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 11
ccs 6
cts 6
cp 1
rs 9.4285
cc 2
eloc 6
nc 2
nop 0
crap 2
1
<?php
2
/**
3
 * League.Uri (http://uri.thephpleague.com)
4
 *
5
 * @package   League.uri
6
 * @author    Ignace Nyamagana Butera <[email protected]>
7
 * @copyright 2013-2015 Ignace Nyamagana Butera
8
 * @license   https://github.com/thephpleague/uri/blob/master/LICENSE (MIT License)
9
 * @version   4.2.0
10
 * @link      https://github.com/thephpleague/uri/
11
 */
12
namespace League\Uri\Components;
13
14
use League\Uri\Interfaces\Pass as PassInterface;
15
16
/**
17
 * Value object representing a URI pass component.
18
 *
19
 * @package League.uri
20
 * @author  Ignace Nyamagana Butera <[email protected]>
21
 * @since   1.0.0
22
 */
23
class Pass extends AbstractComponent implements PassInterface
24
{
25
    /**
26
     * @inheritdoc
27
     */
28 447
    public function getContent()
29
    {
30 447
        if (null === $this->data) {
31 255
            return $this->data;
32
        }
33
34 198
        $regexp = '/(?:[^'.self::$unreservedChars.self::$subdelimChars.'\:]+
35 198
            |%(?!'.self::$encodedChars.'))/x';
36
37 198
        return $this->encode((string) $this->data, $regexp);
38
    }
39
40
    /**
41
     * Return the decoded string representation of the component
42
     *
43
     * @return string
44
     */
45 30
    public function getValue()
46
    {
47 30
        return (string) $this->data;
48
    }
49
50
    /**
51
     * @inheritdoc
52
     */
53 2
    public function __debugInfo()
54
    {
55 2
        return ['pass' => $this->getContent()];
56
    }
57
}
58