You are here

class PDTarget in GlobalLink Connect for Drupal 7.7

Hierarchy

Expanded class hierarchy of PDTarget

File

gl_ws/glc/model/Target.inc.php, line 3

View source
class PDTarget {

  /**
   * Unique document identifier.
   */
  public $clientIdentifier;

  /**
   * Name of the document
   */
  public $documentName;

  /**
   * Document ticket
   */
  public $documentTicket;

  /**
   *  Target's source locale
   */
  public $sourceLocale;

  /**
   * Target's target locale
   */
  public $targetLocale;

  /**
   * Array of target metadata
   */
  public $metadata;

  /**
   * Target ticket
   */
  public $ticket;

  /**
   * PDWordCount of target
   */
  public $wordCount;
  function __construct($externalTarget) {
    $this->documentName = $externalTarget->document->documentInfo->name;
    $this->sourceLocale = $externalTarget->sourceLanguage->locale;
    $this->targetLocale = $externalTarget->targetLanguage->locale;
    $this->ticket = $externalTarget->ticket;
    $this->documentTicket = $externalTarget->document->ticket;
    $this->wordCount = $externalTarget->document->documentInfo->wordCount;
    $this->clientIdentifier = $externalTarget->document->documentInfo->clientIdentifier;
    if (isset($externalTarget->tmStatistics)) {
      $this->wordCount = new WordCount($externalTarget->tmStatistics->inContextMatchWordCount, $externalTarget->tmStatistics->oneHundredMatchWordCount, $externalTarget->tmStatistics->repetitionWordCount, $externalTarget->tmStatistics->noMatchWordCount, $externalTarget->tmStatistics->totalWordCount);
    }
    if (isset($externalTarget->targetInfo->metadata) && is_array($externalTarget->targetInfo->metadata)) {
      foreach ($externalTarget->targetInfo->metadata as $k => $v) {
        $this->metadata[$k] = $v;
      }
    }
    if (isset($externalTarget->document->documentInfo->metadata)) {
      $this->metadata = array();
      $metadatas = is_array($externalTarget->document->documentInfo->metadata) ? $externalTarget->document->documentInfo->metadata : array(
        $externalTarget->document->documentInfo->metadata,
      );
      foreach ($metadatas as $meta) {
        $this->metadata[$meta->key] = $meta->value;
      }
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PDTarget::$clientIdentifier public property Unique document identifier.
PDTarget::$documentName public property Name of the document
PDTarget::$documentTicket public property Document ticket
PDTarget::$metadata public property Array of target metadata
PDTarget::$sourceLocale public property Target's source locale
PDTarget::$targetLocale public property Target's target locale
PDTarget::$ticket public property Target ticket
PDTarget::$wordCount public property PDWordCount of target
PDTarget::__construct function