URI_Template
[ class tree: URI_Template ] [ index: URI_Template ] [ all elements ]

Class: URI_Template

Source Location: /URI_Template-0.3.3/URI/Template.php

Class Overview


Parser for URI Templates


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • 2007-2008 Martin Jansen

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 55]
Parser for URI Templates

This class implements parsing of URI Templates as defined in the IETF's URI Template draft.



[ Top ]


Class Variables

$template =  ''

[line 62]

The URI template string.
  • Var: URI template string
  • Access: protected

Type:   string


[ Top ]

$values = array()

[line 69]

The array containing the replacement variables.
  • Var: Array of replacement variables
  • Access: protected

Type:   array


[ Top ]



Method Detail

__construct (Constructor)   [line 76]

URI_Template __construct( string $template)

Constructor method
  • Access: public

Parameters:

string   $template     URI Template string

[ Top ]

getTemplateVariables   [line 125]

array getTemplateVariables( )

Return an array containing the template variables names.
  • Return: Array of template variables names
  • Access: public

[ Top ]

operationJoin   [line 239]

string operationJoin( array $variables, string $arg)

Implements the 'join' operator.

For each variable from the first parameter that is defined and non-empty create a keyvalue string that is the concatenation of the variable name, '=', and the variable value. All elements are in turn concatenated with the value of the second parameter.

  • Access: protected

Parameters:

array   $variables     List of variables
string   $arg     Join needle

[ Top ]

operationList   [line 266]

string operationList( array $variables, string $arg)

Implements the 'list' operator.

Joins the elements of the first element of the first parameter with the value of the second parameter.

  • Access: protected

Parameters:

array   $variables     List of variables. Only the first element is used and this must be an array.
string   $arg     Join needle

[ Top ]

operationNeg   [line 308]

string operationNeg( array $variables, string $arg)

Implements the 'neg' operator.

If all the variables from the first parameter are empty then this method returns the value of the second parameter. Otherwise an empty string is returned.

  • Access: protected

Parameters:

array   $variables     List of variables
string   $arg     Return value

[ Top ]

operationOpt   [line 284]

string operationOpt( array $variables, string $arg)

Implements the 'opt' operator.

If one or more variables from the first parameter are non-empty then this method returns the value of the second parameter. Otherwise an empty string is returned.

  • Access: protected

Parameters:

array   $variables     List of variables
string   $arg     Return value

[ Top ]

operationPrefix   [line 186]

string operationPrefix( array $variables, string $arg)

Implements the 'prefix' operator.

Adds the value of the second parameter to the beginning of the first element from the first parameter and returns the resulting string. The value of the second parameter may be an array.

  • Access: protected

Parameters:

array   $variables     List of variables. Only the first element is used.
string   $arg     Prefix string

[ Top ]

operationSuffix   [line 213]

string operationSuffix( array $variables, string $arg)

Implements the 'suffix' operator.

Appends the value of the second parameter to the first element of the first parameter and returns the resulting string. The value of the second parameter may be an array.

  • Access: protected

Parameters:

array   $variables     List of variables. Only the first element is used.
string   $arg     String to append to the first element of $variables.

[ Top ]

parseExpansion   [line 329]

array parseExpansion( string $expansion)

Parses an expansion into its components
  • Return: Array with three elements containing the name of the operation, the operation argument and the variables from the expansion
  • See: appendix_a)
  • Access: protected

Parameters:

string   $expansion     Expansion

[ Top ]

substitute   [line 93]

string substitute( array $values, [boolean $URLencode = true])

Substitutes template expansions in the URI template.
  • Return: URI
  • Access: public

Parameters:

array   $values     Associative array with replacements for the variables in the expansions
boolean   $URLencode     Boolean variable determing if the replacements should be encoded according to RFC 1738 or or not. Default is true, i.e. the replacements are encoded.

[ Top ]

_substitute   [line 149]

string _substitute( array $matches)

Callback method for handling a single replacement.

Parameters:

array   $matches     an Array of matched elements

[ Top ]


Documentation generated on Mon, 06 Dec 2010 00:00:02 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.