You are here

public function LocalTask::incrementLoopCount in Translation Management Tool 8

Increment loop_count property.

Does it depending on current status, new status and new assignee.

Parameters

int $new_status: New status of task.

int $new_tuid: New translator uid.

Overrides LocalTaskInterface::incrementLoopCount

3 calls to LocalTask::incrementLoopCount()
LocalTask::assign in translators/tmgmt_local/src/Entity/LocalTask.php
Assign translation task to passed user.
LocalTask::setStatus in translators/tmgmt_local/src/Entity/LocalTask.php
Updates the status of the task.
LocalTask::unassign in translators/tmgmt_local/src/Entity/LocalTask.php
Unassign translation task.

File

translators/tmgmt_local/src/Entity/LocalTask.php, line 357

Class

LocalTask
Entity class for the local task entity.

Namespace

Drupal\tmgmt_local\Entity

Code

public function incrementLoopCount($new_status, $new_tuid) {
  if ($this
    ->getStatus() == static::STATUS_PENDING && $new_status == static::STATUS_PENDING && $this->tuid->target_id != $new_tuid) {
    ++$this->loop_count->value;
  }
  else {
    if ($this
      ->getStatus() != static::STATUS_UNASSIGNED && $new_status == static::STATUS_UNASSIGNED) {
      ++$this->loop_count->value;
    }
    else {
      if ($this
        ->getStatus() != static::STATUS_UNASSIGNED && $this
        ->getStatus() != static::STATUS_PENDING && $new_status == static::STATUS_PENDING) {
        ++$this->loop_count->value;
      }
    }
  }
}