Completed
Push — master ( 03e1a0...07d10c )
by ignace nyamagana
04:33
created

Pass::getDecoded()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 8
ccs 2
cts 2
cp 1
crap 2
rs 9.4285
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 450
    public function getContent()
29
    {
30 450
        if (null === $this->data) {
31 255
            return $this->data;
32
        }
33
34 201
        $regexp = '/(?:[^'.self::$unreservedChars.self::$subdelimChars.'\:]+
35 201
            |%(?!'.self::$encodedChars.'))/x';
36
37 201
        return $this->encode((string) $this->data, $regexp);
38
    }
39
40
    /**
41
     * Return the decoded string representation of the component
42
     *
43
     * @return null|string
44
     */
45 30
    public function getDecoded()
46
    {
47 30
        if (null === $this->data) {
48
            return null;
49
        }
50
51
        return $this->data;
52
    }
53 2
54
    /**
55 2
     * @inheritdoc
56
     */
57
    public function __debugInfo()
58
    {
59
        return ['pass' => $this->getContent()];
60
    }
61
}
62