protected function serializeContext(array $contextVariables) { $serializedContextArray = []; foreach ($contextVariables as $variableName => $contextValue) { // TODO This relies on a converter being available from the context value type to string if ($contextValue !== null) { $serializedContextArray[$variableName]['type'] = $this->getTypeForContextValue($contextValue); $serializedContextArray[$variableName]['value'] = $this->propertyMapper->convert($contextValue, 'string'); } } return $serializedContextArray; }