Update to Drupal 8.1.7. For more information, see https://www.drupal.org/project/drupal/releases/8.1.7

This commit is contained in:
Pantheon Automation 2016-07-18 09:07:48 -07:00 committed by Greg Anderson
parent 38ba7c357d
commit e9f047ccf8
61 changed files with 1613 additions and 561 deletions

View file

@ -15,25 +15,25 @@ class UriTemplate
private $variables;
/** @var array Hash for quick operator lookups */
private static $operatorHash = array(
'' => array('prefix' => '', 'joiner' => ',', 'query' => false),
'+' => array('prefix' => '', 'joiner' => ',', 'query' => false),
'#' => array('prefix' => '#', 'joiner' => ',', 'query' => false),
'.' => array('prefix' => '.', 'joiner' => '.', 'query' => false),
'/' => array('prefix' => '/', 'joiner' => '/', 'query' => false),
';' => array('prefix' => ';', 'joiner' => ';', 'query' => true),
'?' => array('prefix' => '?', 'joiner' => '&', 'query' => true),
'&' => array('prefix' => '&', 'joiner' => '&', 'query' => true)
);
private static $operatorHash = [
'' => ['prefix' => '', 'joiner' => ',', 'query' => false],
'+' => ['prefix' => '', 'joiner' => ',', 'query' => false],
'#' => ['prefix' => '#', 'joiner' => ',', 'query' => false],
'.' => ['prefix' => '.', 'joiner' => '.', 'query' => false],
'/' => ['prefix' => '/', 'joiner' => '/', 'query' => false],
';' => ['prefix' => ';', 'joiner' => ';', 'query' => true],
'?' => ['prefix' => '?', 'joiner' => '&', 'query' => true],
'&' => ['prefix' => '&', 'joiner' => '&', 'query' => true]
];
/** @var array Delimiters */
private static $delims = array(':', '/', '?', '#', '[', ']', '@', '!', '$',
'&', '\'', '(', ')', '*', '+', ',', ';', '=');
private static $delims = [':', '/', '?', '#', '[', ']', '@', '!', '$',
'&', '\'', '(', ')', '*', '+', ',', ';', '='];
/** @var array Percent encoded delimiters */
private static $delimsPct = array('%3A', '%2F', '%3F', '%23', '%5B', '%5D',
private static $delimsPct = ['%3A', '%2F', '%3F', '%23', '%5B', '%5D',
'%40', '%21', '%24', '%26', '%27', '%28', '%29', '%2A', '%2B', '%2C',
'%3B', '%3D');
'%3B', '%3D'];
public function expand($template, array $variables)
{
@ -60,7 +60,7 @@ class UriTemplate
*/
private function parseExpression($expression)
{
$result = array();
$result = [];
if (isset(self::$operatorHash[$expression[0]])) {
$result['operator'] = $expression[0];
@ -71,12 +71,12 @@ class UriTemplate
foreach (explode(',', $expression) as $value) {
$value = trim($value);
$varspec = array();
$varspec = [];
if ($colonPos = strpos($value, ':')) {
$varspec['value'] = substr($value, 0, $colonPos);
$varspec['modifier'] = ':';
$varspec['position'] = (int) substr($value, $colonPos + 1);
} elseif (substr($value, -1) == '*') {
} elseif (substr($value, -1) === '*') {
$varspec['modifier'] = '*';
$varspec['value'] = substr($value, 0, -1);
} else {
@ -98,9 +98,9 @@ class UriTemplate
*/
private function expandMatch(array $matches)
{
static $rfc1738to3986 = array('+' => '%20', '%7e' => '~');
static $rfc1738to3986 = ['+' => '%20', '%7e' => '~'];
$replacements = array();
$replacements = [];
$parsed = self::parseExpression($matches[1]);
$prefix = self::$operatorHash[$parsed['operator']]['prefix'];
$joiner = self::$operatorHash[$parsed['operator']]['joiner'];
@ -119,7 +119,7 @@ class UriTemplate
if (is_array($variable)) {
$isAssoc = $this->isAssoc($variable);
$kvp = array();
$kvp = [];
foreach ($variable as $key => $var) {
if ($isAssoc) {
@ -131,14 +131,14 @@ class UriTemplate
if (!$isNestedArray) {
$var = rawurlencode($var);
if ($parsed['operator'] == '+' ||
$parsed['operator'] == '#'
if ($parsed['operator'] === '+' ||
$parsed['operator'] === '#'
) {
$var = $this->decodeReserved($var);
}
}
if ($value['modifier'] == '*') {
if ($value['modifier'] === '*') {
if ($isAssoc) {
if ($isNestedArray) {
// Nested arrays must allow for deeply nested
@ -160,7 +160,7 @@ class UriTemplate
if (empty($variable)) {
$actuallyUseQuery = false;
} elseif ($value['modifier'] == '*') {
} elseif ($value['modifier'] === '*') {
$expanded = implode($joiner, $kvp);
if ($isAssoc) {
// Don't prepend the value name when using the explode
@ -181,17 +181,17 @@ class UriTemplate
}
} else {
if ($value['modifier'] == ':') {
if ($value['modifier'] === ':') {
$variable = substr($variable, 0, $value['position']);
}
$expanded = rawurlencode($variable);
if ($parsed['operator'] == '+' || $parsed['operator'] == '#') {
if ($parsed['operator'] === '+' || $parsed['operator'] === '#') {
$expanded = $this->decodeReserved($expanded);
}
}
if ($actuallyUseQuery) {
if (!$expanded && $joiner != '&') {
if (!$expanded && $joiner !== '&') {
$expanded = $value['value'];
} else {
$expanded = $value['value'] . '=' . $expanded;