1
0
mirror of https://github.com/guzzle/guzzle.git synced 2025-02-25 10:33:18 +01:00
This commit is contained in:
Michael Dowling 2012-08-12 15:27:41 -07:00
parent 6ee1c502b5
commit c004df0aca
3 changed files with 23 additions and 13 deletions

View File

@ -27,8 +27,7 @@ class ParserRegistry
*
* @param string $name Name of the parser to retrieve
*
* @return mixed|null Returns null if the parser is not found or cannot
* be instantiated
* @return mixed|null Returns null if the parser is not found or cannot be instantiated
*/
public static function get($name)
{

View File

@ -9,35 +9,45 @@ namespace Guzzle\Parser\UriTemplate;
*/
class UriTemplate implements UriTemplateInterface
{
/**
* @var string URI template
*/
private $template;
/**
* @var array Variables to use in the template expansion
*/
private $variables;
/**
* @var string Regex used to parse expressions
*/
private static $regex = '/\{{1,2}([^\}]+)\}{1,2}/';
/**
* @var array Hash for quick operator lookups
*/
private static $operatorHash = array(
'+' => true, '#' => true, '.' => true, '/' => true, ';' => true,
'?' => true, '&' => true
'+' => true, '#' => true, '.' => true, '/' => true, ';' => true, '?' => true, '&' => true
);
/**
* @var array Delimiters
*/
private static $delims = array(':', '/', '?', '#', '[', ']', '@', '!', '$', '&', '\'', '(', ')', '*', '+', ',', ';', '=');
private static $delims = array(
':', '/', '?', '#', '[', ']', '@', '!', '$', '&', '\'', '(', ')', '*', '+', ',', ';', '='
);
/**
* @var array Percent encoded delimiters
*/
private static $delimsPct = array('%3A', '%2F', '%3F', '%23', '%5B', '%5D', '%40', '%21', '%24', '%26', '%27', '%28', '%29', '%2A', '%2B', '%2C', '%3B', '%3D');
private static $delimsPct = array(
'%3A', '%2F', '%3F', '%23', '%5B', '%5D', '%40', '%21', '%24', '%26', '%27', '%28', '%29', '%2A', '%2B', '%2C',
'%3B', '%3D'
);
/**
* Expand the URI template using the supplied variables
*
* @param string $template URI Template to expand
* @param array $variables Variables to use with the expansion
*
* @return string Returns the expanded template
* {@inheritdoc}
*/
public function expand($template, array $variables)
{

View File

@ -12,6 +12,7 @@ interface UriTemplateInterface
/**
* Expand the URI template using the supplied variables
*
* @param string $template URI Template to expand
* @param array $variables Variables to use with the expansion
*
* @return string Returns the expanded template