Exemplo n.º 1
0
    /**
     * Performs a check on single segment
     *
     */
    private function __segmentWarningsCall() {

        $this->result[ 'details' ] = null;
        $this->result[ 'token' ]   = $this->__postInput->token;
        $this->result[ 'total' ]   = 0;

        $QA = new QA( $this->__postInput->src_content, $this->__postInput->trg_content );
        $QA->performConsistencyCheck();
        
        if(is_array($this->__postInput->glossaryList) && !empty($this->__postInput->glossaryList)) {
            $QA->performGlossaryCheck( $this->__postInput->glossaryList );
        }

        if ( $QA->thereAreNotices() ) {
//        if ( $QA->thereAreErrors() ) {
            $this->result[ 'details' ]                 = array();
            $this->result[ 'details' ][ 'id_segment' ] = $this->__postInput->id;
//            $this->result[ 'details' ][ 'warnings' ]   = $QA->getErrorsJSON();
//            $this->result[ 'total' ]                                             = count( $QA->getErrors() );
            $this->result[ 'details' ][ 'warnings' ]                = $QA->getNoticesJSON();
            $this->result[ 'details' ][ 'tag_mismatch' ]            = $QA->getMalformedXmlStructs();
            $this->result[ 'details' ][ 'tag_mismatch' ][ 'order' ] = $QA->getTargetTagPositionError();
            $this->result[ 'total' ]                                = count( $QA->getNotices() );
//temp
			
//            Log::doLog($this->__postInput->trg_content);
//            Log::doLog($this->result);

        }

    }