Replace passing “by value” with “by reference”

This commit is contained in:
Vasilii Zolotukhin 2019-09-18 17:12:45 +10:00 committed by David Garcia
parent f64acb148b
commit 0d1958d8b6

View File

@ -152,7 +152,6 @@ class Member extends HttpApi
case 'vars': case 'vars':
if (is_array($value)) { if (is_array($value)) {
$value = json_encode($value); $value = json_encode($value);
$parameters[$field] = $value;
} }
// We should assert that "vars"'s $value is a string. // We should assert that "vars"'s $value is a string.
// no break // no break
@ -195,12 +194,11 @@ class Member extends HttpApi
Assert::stringNotEmpty($address); Assert::stringNotEmpty($address);
Assert::isArray($parameters); Assert::isArray($parameters);
foreach ($parameters as $field => $value) { foreach ($parameters as $field => &$value) {
switch ($field) { switch ($field) {
case 'vars': case 'vars':
if (is_array($value)) { if (is_array($value)) {
$value = json_encode($value); $value = json_encode($value);
$parameters[$field] = $value;
} }
// We should assert that "vars"'s $value is a string. // We should assert that "vars"'s $value is a string.
// no break // no break