You are here

protected function JsonPathReplacer::serializeMember in Subrequests 8.2

Same name and namespace in other branches
  1. 3.x src/JsonPathReplacer.php \Drupal\subrequests\JsonPathReplacer::serializeMember()

Makes sure that the subject for replacement is a string.

This is an abstraction to be able to treat 'uri' and 'body' replacements the same way.

@returns string The serialized member.

Parameters

string $member_name: Either 'body' or 'uri'.

mixed $value: The contents of the URI or the subrequest body.

1 call to JsonPathReplacer::serializeMember()
JsonPathReplacer::doReplaceTokensInLocation in src/JsonPathReplacer.php
Creates replacements for either the body or the URI.

File

src/JsonPathReplacer.php, line 202

Class

JsonPathReplacer

Namespace

Drupal\subrequests

Code

protected function serializeMember($member_name, $value) {
  return $member_name === 'body' ? Json::encode($value) : $value;
}