/**
  * 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)) {
         /**
          * FIXME: temporarily disabled due to a bug.
          */
         //            $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);
     }
 }
Esempio n. 2
0
 /**
  * @return array
  */
 public function getWarning()
 {
     $result = array();
     $QA = new QA($this->source, $this->translation);
     $QA->performConsistencyCheck();
     if ($QA->thereAreNotices()) {
         $notices = $QA->getNoticesJSON();
         $notices = json_decode($notices, true);
         //the outer if it's here because $notices can be
         //an empty string and json_decode will fail into null value
         if (!empty($notices)) {
             $result = array_merge($result, Utils::array_column($notices, 'debug'));
         }
         $tag_mismatch = $QA->getMalformedXmlStructs();
         $tag_order_mismatch = $QA->getTargetTagPositionError();
         if (count($tag_mismatch) > 0) {
             $result[] = sprintf("Tag Mismatch ( %d )", count($tag_mismatch));
         }
         if (count($tag_order_mismatch) > 0) {
             $result[] = sprintf("Tag order mismatch ( %d )", count($tag_order_mismatch));
         }
     }
     $this->warnings = $result;
 }