public function mint($url, $xml, $manual = false)
    {

        // @todo event handler, message
        if (!$this->isClientAuthenticated()) {
            $this->setResponse("responsecode", "MT009");
            return false;
        }

        // Validate URL and URL Domain
        $this->setResponse('url', $url);
        $validDomain = URLValidator::validDomains(
            $url, $this->getAuthenticatedClient()->domains
        );
        if (!$validDomain) {
            $this->setResponse("responsecode", "MT014");
            return false;
        }

        // construct DOI 

        if($manual===true){
            $doiValue = XMLValidator::getDOIValue($xml);
        }else{
            $doiValue = $this->getNewDOI();
            // replaced doiValue
            $xml = XMLValidator::replaceDOIValue($doiValue, $xml);
        }

        $this->setResponse('doi', $doiValue);

        // validation on the DOIValue
        // Validate xml
        if($this->validateXML($xml) === false){
            $this->setResponse('responsecode', 'MT006');
            return false;
        }

        //update the database DOIRepository

        $doi = $this->insertNewDOI($doiValue,$xml,$url);

        // mint using dataciteClient

        $result = $this->dataciteClient->mint($doiValue, $url, $xml);

        if ($result === true) {
            $this->setResponse('responsecode', 'MT001');
            $this->doiRepo->doiUpdate($doi, array('status'=>'ACTIVE'));
        } else {
            $this->setResponse('responsecode', 'MT005');
            $this->setResponse('verbosemessage', array_first($this->dataciteClient->getErrors()));
        }

        return $result;
    }
public function mint($url, $xml, $manual = false)
    {

        // @todo event handler, message
        if (!$this->isClientAuthenticated()) {
            $this->setResponse("responsecode", "MT009");
            return false;
        }

        // Validate URL and URL Domain
        $this->setResponse('url', $url);
        $validDomain = URLValidator::validDomains(
            $url, $this->getAuthenticatedClient()->domains
        );
        if (!$validDomain) {
            $this->setResponse("responsecode", "MT014");
            return false;
        }

        // construct DOI 

        if($manual===true){
            $doiValue = XMLValidator::getDOIValue($xml);
        }else{
            $doiValue = $this->getNewDOI();
            // replaced doiValue
            $xml = XMLValidator::replaceDOIValue($doiValue, $xml);
        }

        $this->setResponse('doi', $doiValue);

        // validation on the DOIValue
        // Validate xml
        if($this->validateXML($xml) === false){
            $this->setResponse('responsecode', 'MT006');
            return false;
        }

        //update the database DOIRepository

        $doi = $this->insertNewDOI($doiValue,$xml,$url);

        // mint using dataciteClient

        $result = $this->dataciteClient->mint($doiValue, $url, $xml);

        if ($result === true) {
            $this->setResponse('responsecode', 'MT001');
            $this->doiRepo->doiUpdate($doi, array('status'=>'ACTIVE'));
        } else {
            $this->setResponse('responsecode', 'MT005');
            $this->setResponse('verbosemessage', array_first($this->dataciteClient->getErrors()));
        }

        return $result;
    }
public function mint ( $ url , $ xml , $ manual = false ) { // @todo event handler, message if ( ! $ this -> isClientAuthenticated ( ) ) { $ this -> setResponse ( "responsecode" , "MT009" ) ; return false ; } // Validate URL and URL Domain $ this -> setResponse ( 'url' , $ url ) ; $ validDomain = URLValidator :: validDomains ( $ url , $ this -> getAuthenticatedClient ( ) -> domains ) ; if ( ! $ validDomain ) { $ this -> setResponse ( "responsecode" , "MT014" ) ; return false ; } // construct DOI  if ( $ manual === true ) { $ doiValue = XMLValidator :: getDOIValue ( $ xml ) ; } else { $ doiValue = $ this -> getNewDOI ( ) ; // replaced doiValue $ xml = XMLValidator :: replaceDOIValue ( $ doiValue , $ xml ) ; } $ this -> setResponse ( 'doi' , $ doiValue ) ; // validation on the DOIValue // Validate xml if ( $ this -> validateXML ( $ xml ) === false ) { $ this -> setResponse ( 'responsecode' , 'MT006' ) ; return false ; } //update the database DOIRepository $ doi = $ this -> insertNewDOI ( $ doiValue , $ xml , $ url ) ; // mint using dataciteClient $ result = $ this -> dataciteClient -> mint ( $ doiValue , $ url , $ xml ) ; if ( $ result === true ) { $ this -> setResponse ( 'responsecode' , 'MT001' ) ; $ this -> doiRepo -> doiUpdate ( $ doi , array ( 'status' => 'ACTIVE' ) ) ; } else { $ this -> setResponse ( 'responsecode' , 'MT005' ) ; $ this -> setResponse ( 'verbosemessage' , array_first ( $ this -> dataciteClient -> getErrors ( ) ) ) ; } return $ result ; }
Mint a new DOI

@param $url
@param $xml
@return bool
Mint a new DOI