private function convertTypeDefinitionSpecificData(array $data, MutableTypeDefinitionInterface $typeDefinition)
    {
        if ($typeDefinition instanceof MutableDocumentTypeDefinitionInterface) {
            if (!empty($data[JSONConstants::JSON_TYPE_CONTENTSTREAM_ALLOWED])) {
                $data[JSONConstants::JSON_TYPE_CONTENTSTREAM_ALLOWED] = ContentStreamAllowed::cast(
                    $data[JSONConstants::JSON_TYPE_CONTENTSTREAM_ALLOWED]
                );
            }
        } elseif ($typeDefinition instanceof MutableRelationshipTypeDefinitionInterface) {

            $data[JSONConstants::JSON_TYPE_ALLOWED_SOURCE_TYPES] = array_map(
                'strval',
                array_filter(
                    $data[JSONConstants::JSON_TYPE_ALLOWED_SOURCE_TYPES] ?? [],
                    function ($item) { return !empty($item); }
                )
            );
            $data[JSONConstants::JSON_TYPE_ALLOWED_SOURCE_TYPES] = array_map(
                'strval',
                array_filter(
                    $data[JSONConstants::JSON_TYPE_ALLOWED_SOURCE_TYPES] ?? [],
                    function ($item) { return !empty($item); }
                )
            );
            $data[JSONConstants::JSON_TYPE_ALLOWED_TARGET_TYPES] = array_map(
                'strval',
                array_filter(
                    $data[JSONConstants::JSON_TYPE_ALLOWED_TARGET_TYPES] ?? [],
                    function ($item) { return !empty($item); }
                )
            );

        }

        return $data;
    }
private function convertTypeDefinitionSpecificData(array $data, MutableTypeDefinitionInterface $typeDefinition)
    {
        if ($typeDefinition instanceof MutableDocumentTypeDefinitionInterface) {
            if (!empty($data[JSONConstants::JSON_TYPE_CONTENTSTREAM_ALLOWED])) {
                $data[JSONConstants::JSON_TYPE_CONTENTSTREAM_ALLOWED] = ContentStreamAllowed::cast(
                    $data[JSONConstants::JSON_TYPE_CONTENTSTREAM_ALLOWED]
                );
            }
        } elseif ($typeDefinition instanceof MutableRelationshipTypeDefinitionInterface) {

            $data[JSONConstants::JSON_TYPE_ALLOWED_SOURCE_TYPES] = array_map(
                'strval',
                array_filter(
                    $data[JSONConstants::JSON_TYPE_ALLOWED_SOURCE_TYPES] ?? [],
                    function ($item) { return !empty($item); }
                )
            );
            $data[JSONConstants::JSON_TYPE_ALLOWED_SOURCE_TYPES] = array_map(
                'strval',
                array_filter(
                    $data[JSONConstants::JSON_TYPE_ALLOWED_SOURCE_TYPES] ?? [],
                    function ($item) { return !empty($item); }
                )
            );
            $data[JSONConstants::JSON_TYPE_ALLOWED_TARGET_TYPES] = array_map(
                'strval',
                array_filter(
                    $data[JSONConstants::JSON_TYPE_ALLOWED_TARGET_TYPES] ?? [],
                    function ($item) { return !empty($item); }
                )
            );

        }

        return $data;
    }
private function convertTypeDefinitionSpecificData ( array $ data , MutableTypeDefinitionInterface $ typeDefinition ) { if ( $ typeDefinition instanceof MutableDocumentTypeDefinitionInterface ) { if ( ! empty ( $ data [ JSONConstants :: JSON_TYPE_CONTENTSTREAM_ALLOWED ] ) ) { $ data [ JSONConstants :: JSON_TYPE_CONTENTSTREAM_ALLOWED ] = ContentStreamAllowed :: cast ( $ data [ JSONConstants :: JSON_TYPE_CONTENTSTREAM_ALLOWED ] ) ; } } elseif ( $ typeDefinition instanceof MutableRelationshipTypeDefinitionInterface ) { $ data [ JSONConstants :: JSON_TYPE_ALLOWED_SOURCE_TYPES ] = array_map ( 'strval' , array_filter ( $ data [ JSONConstants :: JSON_TYPE_ALLOWED_SOURCE_TYPES ] ?? [ ] , function ( $ item ) { return ! empty ( $ item ) ; } ) ) ; $ data [ JSONConstants :: JSON_TYPE_ALLOWED_SOURCE_TYPES ] = array_map ( 'strval' , array_filter ( $ data [ JSONConstants :: JSON_TYPE_ALLOWED_SOURCE_TYPES ] ?? [ ] , function ( $ item ) { return ! empty ( $ item ) ; } ) ) ; $ data [ JSONConstants :: JSON_TYPE_ALLOWED_TARGET_TYPES ] = array_map ( 'strval' , array_filter ( $ data [ JSONConstants :: JSON_TYPE_ALLOWED_TARGET_TYPES ] ?? [ ] , function ( $ item ) { return ! empty ( $ item ) ; } ) ) ; } return $ data ; }
Convert specific type definition data so it can be populated to the type definition

@param MutableTypeDefinitionInterface $typeDefinition The type definition to set the data to
@param array $data The data that contains the values that should be applied to the object
@return MutableTypeDefinitionInterface The type definition with the specific data applied
Convert specific type definition data so it can be populated to the type definition