$code =
[];
foreach ($value as $k =>
$v) { $code[$k] =
$this->
dumpValue($v);
} return $code;
} elseif ($value instanceof Reference
) { return $this->
getServiceCall((string) $value,
$value);
} elseif ($value instanceof Parameter
) { return $this->
getParameterCall((string) $value);
} elseif ($value instanceof Expression
) { return $this->
getExpressionCall((string) $value);
} elseif ($value instanceof Definition
) { return new TaggedValue('service',
(new Parser())->
parse("_:\n".
$this->
addService('_',
$value), Yaml::PARSE_CUSTOM_TAGS
)['_'
]['_'
]);
} elseif ($value instanceof \UnitEnum
) { return new TaggedValue('php/const',
sprintf('%s::%s',
$value::
class,
$value->name
));
} elseif ($value instanceof AbstractArgument
) { return new TaggedValue('abstract',
$value->
getText());
} elseif (\
is_object($value) || \
is_resource($value)) { throw new RuntimeException(sprintf('Unable to dump a service container if a parameter is an object or a resource, got "%s".',
get_debug_type($value)));
} return $value;
}