CodeExplorer encodeExtensions example
private function encodeStruct(Struct
$struct, ResponseFields
$fields, array
$data, ?string
$alias = null
): array
{ $alias =
$alias ??
$struct->
getApiAlias();
foreach ($data as $property =>
$value) { if ($property === 'customFields' &&
$value ===
[]) { $data[$property] =
$value =
new \
stdClass();
} if ($property === 'extensions'
) { $data[$property] =
$this->
encodeExtensions($struct,
$fields,
$value);
if (empty($data[$property])) { unset($data[$property]);
} continue;
} if (!
$this->
isAllowed($alias,
(string) $property,
$fields) && !
$fields->
hasNested($alias,
(string) $property)) { unset($data[$property]);