You are here

private function UriTemplate::parseExpression in Auth0 Single Sign On 8.2

Parse an expression into parts

Parameters

string $expression Expression to parse:

Return value

array Returns an associative array of parts

1 call to UriTemplate::parseExpression()
UriTemplate::expandMatch in vendor/guzzlehttp/guzzle/src/UriTemplate.php
Process an expansion

File

vendor/guzzlehttp/guzzle/src/UriTemplate.php, line 61

Class

UriTemplate
Expands URI templates. Userland implementation of PECL uri_template.

Namespace

GuzzleHttp

Code

private function parseExpression($expression) {
  $result = [];
  if (isset(self::$operatorHash[$expression[0]])) {
    $result['operator'] = $expression[0];
    $expression = substr($expression, 1);
  }
  else {
    $result['operator'] = '';
  }
  foreach (explode(',', $expression) as $value) {
    $value = trim($value);
    $varspec = [];
    if ($colonPos = strpos($value, ':')) {
      $varspec['value'] = substr($value, 0, $colonPos);
      $varspec['modifier'] = ':';
      $varspec['position'] = (int) substr($value, $colonPos + 1);
    }
    elseif (substr($value, -1) === '*') {
      $varspec['modifier'] = '*';
      $varspec['value'] = substr($value, 0, -1);
    }
    else {
      $varspec['value'] = (string) $value;
      $varspec['modifier'] = '';
    }
    $result['values'][] = $varspec;
  }
  return $result;
}