src/snac/util/EACCPFSerializer.php
/**
     * Export a constellation as EAC-CPF
     *
     * The input is a constellation in toArray() format, that is a PHP associative array. If you have a
     * Constellation object and want to export that, simply pass $yourConstellation->toArray() as param
     * $expCon.
     *
     * @param string[] $expCon Array of string that is the result of Constellation->toArray()
     * @return string $cpfXML a string containing an EAC-CPF XML file.
     */
Export a constellation as EAC-CPF
The input is a constellation in toArray() format, that is a PHP associative array. If you have a
Constellation object and want to export that, simply pass $yourConstellation->toArray() as param
$expCon.

@param string[] $expCon Array of string that is the result of Constellation->toArray()
@return string $cpfXML a string containing an EAC-CPF XML file.
Export a constellation as EAC - CPF The input is a constellation in toArray () format that is a PHP associative array . If you have a Constellation object and want to export that simply pass $yourConstellation - > toArray () as param $expCon . @param string [] $expCon Array of string that is the result of Constellation - > toArray () @return string $cpfXML a string containing an EAC - CPF XML file .
private function serializeCore($expCon) {
        $data['data'] = $expCon;
        $loader = new \Twig_Loader_Filesystem(\snac\Config::$CPF_TEMPLATE_DIR);
        $twig = new \Twig_Environment($loader, array());
        $filter = new \Twig_SimpleFilter('decode_entities', function ($string) {
                return html_entity_decode($string);
            });
        $twig->addFilter($filter);
        $this->cpfSameAs($data['data']);
        $data['currentDate'] = date('Y-m-d');
        $xml = new \SimpleXMLElement($twig->render("EAC-CPF_template.xml", $data));
        $domxml = new \DOMDocument('1.0');
        $domxml->preserveWhiteSpace = false;
        $domxml->formatOutput = true;
        $domxml->loadXML($xml->asXML());
        $cpfXML = $domxml->saveXML();
        return $cpfXML;
    }
private function serializeCore ( $ expCon ) { $ data [ 'data' ] = $ expCon ; $ loader = new \ Twig_Loader_Filesystem ( \ snac \ Config :: $ CPF_TEMPLATE_DIR ) ; $ twig = new \ Twig_Environment ( $ loader , array ( ) ) ; $ filter = new \ Twig_SimpleFilter ( 'decode_entities' , function ( $ string ) { return html_entity_decode ( $ string ) ; } ) ; $ twig -> addFilter ( $ filter ) ; $ this -> cpfSameAs ( $ data [ 'data' ] ) ; $ data [ 'currentDate' ] = date ( 'Y-m-d' ) ; $ xml = new \ SimpleXMLElement ( $ twig -> render ( " EAC-CPF_template.xml " , $ data ) ) ; $ domxml = new \ DOMDocument ( '1.0' ) ; $ domxml -> preserveWhiteSpace = false ; $ domxml -> formatOutput = true ; $ domxml -> loadXML ( $ xml -> asXML ( ) ) ; $ cpfXML = $ domxml -> saveXML ( ) ; return $ cpfXML ; }
Export a constellation as EAC-CPF
 The input is a constellation in toArray() format, that is a PHP associative array.
Export a constellation as EAC - CPF The input is a constellation in toArray () format that is a PHP associative array .
/*
         * Create a custom filter and connect it to the Twig filter via the environment. Yes, the second arg
         * is an inline anonymous function. Looks like a closure.
         */