src/acdhOeaw/util/MetadataCollection.php
private function filterResources(string $namespace, int $singleOutNmsp): array {
        $result = array();

        echo self::$debug ? "Filtering resources...\n" : '';
        foreach ($this->resources() as $res) {
            echo self::$debug ? "\t" . $res->getUri() . "\n" : '';

            $nonIdProps = array_diff($res->propertyUris(), array(RC::idProp()));
            $inNmsp     = false;
            $ids        = array();
            foreach ($res->allResources(RC::idProp()) as $id) {
                $id     = $id->getUri();
                $ids[]  = $id;
                $inNmsp = $inNmsp || strpos($id, $namespace) === 0;
            }

            if (count($ids) == 0) {
                echo self::$debug ? "\t\tskipping - no ids\n" : '';
            } elseif ($this->fedora->isAcdhId($res->getUri())) {
                echo self::$debug ? "\t\tskipping - ACDH UUID\n" : '';
            } elseif (count($nonIdProps) == 0 && $this->isIdElsewhere($res)) {
                echo self::$debug ? "\t\tskipping - single id assigned to another resource\n" : '';
            } elseif (count($nonIdProps) == 0 && $singleOutNmsp !== MetadataCollection::CREATE && !$inNmsp) {
                echo self::$debug ? "\t\tskipping - onlyIds, outside namespace and mode == MetadataCollection::SKIP\n" : '';
            } else {
                echo self::$debug ? "\t\tincluding\n" : '';
                $result[] = $res;
            }
        }

        return $result;
    }
private function filterResources(string $namespace, int $singleOutNmsp): array {
        $result = array();

        echo self::$debug ? "Filtering resources...\n" : '';
        foreach ($this->resources() as $res) {
            echo self::$debug ? "\t" . $res->getUri() . "\n" : '';

            $nonIdProps = array_diff($res->propertyUris(), array(RC::idProp()));
            $inNmsp     = false;
            $ids        = array();
            foreach ($res->allResources(RC::idProp()) as $id) {
                $id     = $id->getUri();
                $ids[]  = $id;
                $inNmsp = $inNmsp || strpos($id, $namespace) === 0;
            }

            if (count($ids) == 0) {
                echo self::$debug ? "\t\tskipping - no ids\n" : '';
            } elseif ($this->fedora->isAcdhId($res->getUri())) {
                echo self::$debug ? "\t\tskipping - ACDH UUID\n" : '';
            } elseif (count($nonIdProps) == 0 && $this->isIdElsewhere($res)) {
                echo self::$debug ? "\t\tskipping - single id assigned to another resource\n" : '';
            } elseif (count($nonIdProps) == 0 && $singleOutNmsp !== MetadataCollection::CREATE && !$inNmsp) {
                echo self::$debug ? "\t\tskipping - onlyIds, outside namespace and mode == MetadataCollection::SKIP\n" : '';
            } else {
                echo self::$debug ? "\t\tincluding\n" : '';
                $result[] = $res;
            }
        }

        return $result;
    }
private function filterResources ( string $ namespace , int $ singleOutNmsp ) : array { $ result = array ( ) ; echo self :: $ debug ? "Filtering resources...\n" : '' ; foreach ( $ this -> resources ( ) as $ res ) { echo self :: $ debug ? "\t" . $ res -> getUri ( ) . "\n" : '' ; $ nonIdProps = array_diff ( $ res -> propertyUris ( ) , array ( RC :: idProp ( ) ) ) ; $ inNmsp = false ; $ ids = array ( ) ; foreach ( $ res -> allResources ( RC :: idProp ( ) ) as $ id ) { $ id = $ id -> getUri ( ) ; $ ids [ ] = $ id ; $ inNmsp = $ inNmsp || strpos ( $ id , $ namespace ) === 0 ; } if ( count ( $ ids ) == 0 ) { echo self :: $ debug ? "\t\tskipping - no ids\n" : '' ; } elseif ( $ this -> fedora -> isAcdhId ( $ res -> getUri ( ) ) ) { echo self :: $ debug ? "\t\tskipping - ACDH UUID\n" : '' ; } elseif ( count ( $ nonIdProps ) == 0 && $ this -> isIdElsewhere ( $ res ) ) { echo self :: $ debug ? "\t\tskipping - single id assigned to another resource\n" : '' ; } elseif ( count ( $ nonIdProps ) == 0 && $ singleOutNmsp !== MetadataCollection :: CREATE && ! $ inNmsp ) { echo self :: $ debug ? "\t\tskipping - onlyIds, outside namespace and mode == MetadataCollection::SKIP\n" : '' ; } else { echo self :: $ debug ? "\t\tincluding\n" : '' ; $ result [ ] = $ res ; } } return $ result ; }
Returns set of resources to be imported skipping all other.
@param string $namespace repository resources will be created for all
resources in this namespace
@param int $singleOutNmsp should repository resources be created
representing URIs outside $namespace (MetadataCollection::SKIP or
MetadataCollection::CREATE)
@return array
Returns set of resources to be imported skipping all other .