for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* League.Uri (http://uri.thephpleague.com)
*
* @package League.uri
* @author Ignace Nyamagana Butera <[email protected]>
* @copyright 2013-2015 Ignace Nyamagana Butera
* @license https://github.com/thephpleague/uri/blob/master/LICENSE (MIT License)
* @version 4.2.0
* @link https://github.com/thephpleague/uri/
*/
namespace League\Uri\Components;
use League\Uri\Interfaces\Fragment as FragmentInterface;
* Value object representing a URI fragment component.
* @since 1.0.0
class Fragment extends AbstractComponent implements FragmentInterface
{
* Returns the component literal value
* @return string|null
public function getContent()
if (null === $this->data) {
return null;
}
$regexp = '/(?:[^'.self::$unreservedChars.self::$subdelimChars.'\:\/@\?]+
|%(?!'.self::$encodedChars.'))/x';
return $this->encode($this->data, $regexp);
* Return the decoded string representation of the component
* @return string
public function getValue()
return (string) $this->data;
* Returns the instance string representation
* with its optional URI delimiters
public function getUriComponent()
$component = $this->__toString();
if (null !== $this->data) {
return FragmentInterface::DELIMITER.$component;
return $component;