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

User::getValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
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\User as UserInterface;
15
16
/**
17
 * Value object representing a URI user component.
18
 *
19
 * @package League.uri
20
 * @author  Ignace Nyamagana Butera <[email protected]>
21
 * @since   1.0.0
22
 */
23
class User extends AbstractComponent implements UserInterface
24
{
25
    /**
26
     * @inheritdoc
27
     */
28 870
    public function getContent()
29
    {
30 870
        if (null === $this->data) {
31 678
            return $this->data;
32
        }
33
34 240
        $regexp = '/(?:[^'.self::$unreservedChars.self::$subdelimChars.']+
35 240
            |%(?!'.self::$encodedChars.'))/x';
36
37 240
        return $this->encode((string) $this->data, $regexp);
38
    }
39
40
    /**
41
     * @inheritdoc
42
     */
43 2
    public function __debugInfo()
44
    {
45 2
        return ['user' => $this->getContent()];
46
    }
47
48
    /**
49
     * Return the decoded string representation of the component
50
     *
51
     * @return string
52
     */
53 30
    public function getValue()
54
    {
55 30
        return (string) $this->data;
56
    }
57
}
58