Completed
Pull Request — master (#46)
by ignace nyamagana
05:56 queued 03:24
created

Fragment::__debugInfo()   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.1.1
10
 * @link      https://github.com/thephpleague/uri/
11
 */
12
namespace League\Uri\Components;
13
14
use League\Uri\Interfaces\Fragment as FragmentInterface;
15
16
/**
17
 * Value object representing a URI fragment component.
18
 *
19
 * @package League.uri
20
 * @author  Ignace Nyamagana Butera <[email protected]>
21
 * @since   1.0.0
22
 */
23
class Fragment extends AbstractComponent implements FragmentInterface
24
{
25
    /**
26
     * @inheritdoc
27
     */
28
    protected static $reservedCharactersRegex = "\!\$&'\(\)\*\+,;\=\:\/@\?";
29
30
    /**
31
     * @inheritdoc
32
     */
33 2
    public function __debugInfo()
34
    {
35 2
        return ['fragment' => $this->__toString()];
36
    }
37
38
    /**
39
     * Returns the instance string representation
40
     * with its optional URI delimiters
41
     *
42
     * @return string
43
     */
44 623
    public function getUriComponent()
45
    {
46 623
        $component = $this->__toString();
47 623
        if ('' !== $component) {
48 359
            $component = FragmentInterface::DELIMITER.$component;
49 239
        }
50
51 623
        return $component;
52
    }
53
}
54