src/snac/client/webui/util/ConstellationPostMapper.php
/**
     * Parse SCM
     *
     * Parses the SCM out of the parameter and returns a list of SCM objects
     *
     * @param string[][] $objectWithSCM Array with SCM data included
     * @param string $short The short name of the containing object, as defined in the edit page
     * @param int $i The ID of the containing object, as defined in the edit page
     * @return \snac\data\SNACControlMetadata[] Array of snac control metadata
     */
Parse SCM
Parses the SCM out of the parameter and returns a list of SCM objects

@param string[][] $objectWithSCM Array with SCM data included
@param string $short The short name of the containing object, as defined in the edit page
@param int $i The ID of the containing object, as defined in the edit page
@return \snac\data\SNACControlMetadata[] Array of snac control metadata
Parse SCM Parses the SCM out of the parameter and returns a list of SCM objects @param string [] [] $objectWithSCM Array with SCM data included @param string $short The short name of the containing object as defined in the edit page @param int $i The ID of the containing object as defined in the edit page @return \ snac \ data \ SNACControlMetadata [] Array of snac control metadata
private function parseSCM($objectWithSCM, $short, $i) {
        if (! isset($objectWithSCM) || $objectWithSCM == null || ! isset($objectWithSCM["scm"]) ||
                 $objectWithSCM["scm"] == null || $objectWithSCM["scm"] == "")
            return array ();
        $scmArray = array ();
        foreach ($objectWithSCM["scm"] as $j => $scm) {
            if (($scm["id"] == null || $scm["id"] == "") && $scm["operation"] != "insert")
                continue;
            $scmObject = new \snac\data\SNACControlMetadata();
            if (!$this->mapAsNew) {
                if ($scm["id"] != "")
                    $scmObject->setID($scm["id"]);
                if ($scm["version"] != "")
                    $scmObject->setVersion($scm["version"]);
            }
            $scmObject->setOperation($this->getOperation($scm));
            $scmObject->setSubCitation($scm[""] ?? '');
            $scmObject->setSourceData($scm["sourceData"]);
            $scmObject->setNote($scm["note"]);
            if (isset($scm["descriptiveRule"]))
                $scmObject->setDescriptiveRule($this->parseTerm($scm["descriptiveRule"]));
            $scmObject->setLanguage($this->parseSubLanguage($scm, "scm_". $short, $j . "_". $i));
            if (isset($scm["citation"]) && isset($scm["citation"]["id"]) && $scm["citation"]["id"] != "") {
                $tmpSource = new \snac\data\Source();
                $tmpSource->setID($scm["citation"]["id"]);
                $scmObject->setCitation($tmpSource);
            }
            $this->addToMapping("scm_".$short, $j . "_". $i, $scm, $scmObject);
            array_push($scmArray, $scmObject);
        }
        return $scmArray;
    }
private function parseSCM ( $ objectWithSCM , $ short , $ i ) { if ( ! isset ( $ objectWithSCM ) || $ objectWithSCM == null || ! isset ( $ objectWithSCM [ " scm " ] ) || $ objectWithSCM [ " scm " ] == null || $ objectWithSCM [ " scm " ] == " " ) return array ( ) ; $ scmArray = array ( ) ; foreach ( $ objectWithSCM [ " scm " ] as $ j => $ scm ) { if ( ( $ scm [ " id " ] == null || $ scm [ " id " ] == " " ) && $ scm [ " operation " ] != " insert " ) continue ; $ scmObject = new \ snac \ data \ SNACControlMetadata ( ) ; if ( ! $ this -> mapAsNew ) { if ( $ scm [ " id " ] != " " ) $ scmObject -> setID ( $ scm [ " id " ] ) ; if ( $ scm [ " version " ] != " " ) $ scmObject -> setVersion ( $ scm [ " version " ] ) ; } $ scmObject -> setOperation ( $ this -> getOperation ( $ scm ) ) ; $ scmObject -> setSubCitation ( $ scm [ " " ] ?? '' ) ; $ scmObject -> setSourceData ( $ scm [ " sourceData " ] ) ; $ scmObject -> setNote ( $ scm [ " note " ] ) ; if ( isset ( $ scm [ " descriptiveRule " ] ) ) $ scmObject -> setDescriptiveRule ( $ this -> parseTerm ( $ scm [ " descriptiveRule " ] ) ) ; $ scmObject -> setLanguage ( $ this -> parseSubLanguage ( $ scm , " scm_ " . $ short , $ j . " _ " . $ i ) ) ; if ( isset ( $ scm [ " citation " ] ) && isset ( $ scm [ " citation " ] [ " id " ] ) && $ scm [ " citation " ] [ " id " ] != " " ) { $ tmpSource = new \ snac \ data \ Source ( ) ; $ tmpSource -> setID ( $ scm [ " citation " ] [ " id " ] ) ; $ scmObject -> setCitation ( $ tmpSource ) ; } $ this -> addToMapping ( " scm_ " . $ short , $ j . " _ " . $ i , $ scm , $ scmObject ) ; array_push ( $ scmArray , $ scmObject ) ; } return $ scmArray ; }
Parse SCM
 Parses the SCM out of the parameter and returns a list of SCM objects
Parse SCM Parses the SCM out of the parameter and returns a list of SCM objects
// parse through the SCM array // If there is a citation ID, then create a dummy source for it.