src/acdhOeaw/schema/file/File.php
protected function mergeMetadata(Resource $current, Resource $new): Resource {
        // title handling logic:
        // if title is not provided by an external metadata (also when there is
        // no external metadata) and current
        $oldTitle = $current->getLiteral(RC::titleProp());
        $extTitle = null;

        $meta = $current->merge($new, array(RC::idProp()));

        if ($this->metaLookup) {
            $extMeta  = $this->metaLookup->getMetadata($this->path, $new, $this->metaLookupRequire);
            $extTitle = $extMeta->getLiteral(RC::titleProp());
        }
        if ($oldTitle !== null && $extTitle === null) {
            $meta->delete(RC::titleProp());
            $meta->addLiteral(RC::titleProp(), $oldTitle, $oldTitle->getLang());
        }

        return $meta;
    }
protected function mergeMetadata(Resource $current, Resource $new): Resource {
        // title handling logic:
        // if title is not provided by an external metadata (also when there is
        // no external metadata) and current
        $oldTitle = $current->getLiteral(RC::titleProp());
        $extTitle = null;

        $meta = $current->merge($new, array(RC::idProp()));

        if ($this->metaLookup) {
            $extMeta  = $this->metaLookup->getMetadata($this->path, $new, $this->metaLookupRequire);
            $extTitle = $extMeta->getLiteral(RC::titleProp());
        }
        if ($oldTitle !== null && $extTitle === null) {
            $meta->delete(RC::titleProp());
            $meta->addLiteral(RC::titleProp(), $oldTitle, $oldTitle->getLang());
        }

        return $meta;
    }
protected function mergeMetadata ( Resource $ current , Resource $ new ) : Resource { // title handling logic: // if title is not provided by an external metadata (also when there is // no external metadata) and current $ oldTitle = $ current -> getLiteral ( RC :: titleProp ( ) ) ; $ extTitle = null ; $ meta = $ current -> merge ( $ new , array ( RC :: idProp ( ) ) ) ; if ( $ this -> metaLookup ) { $ extMeta = $ this -> metaLookup -> getMetadata ( $ this -> path , $ new , $ this -> metaLookupRequire ) ; $ extTitle = $ extMeta -> getLiteral ( RC :: titleProp ( ) ) ; } if ( $ oldTitle !== null && $ extTitle === null ) { $ meta -> delete ( RC :: titleProp ( ) ) ; $ meta -> addLiteral ( RC :: titleProp ( ) , $ oldTitle , $ oldTitle -> getLang ( ) ) ; } return $ meta ; }
Merges metadata coming from the Fedora and generated by the class.

Preserves the resource title if it already exists.

@param Resource $current current Fedora resource metadata
@param Resource $new metadata generated by the class
@return Resource final metadata
Merges metadata coming from the Fedora and generated by the class .