Esempio n. 1
0
 /**
  * Get the count of activities with a reason in a given state
  *
  * @param string           $control
  * @param HistoryItemState $state
  * @return int
  */
 public function countControl($control, HistoryItemState $state)
 {
     $cache_key = 'C:' . $control . ':' . $state->key();
     if (array_key_exists($cache_key, $this->completion_cache)) {
         return $this->completion_cache[$cache_key];
     }
     $count = 0;
     foreach ($this->history as $history_item) {
         /** @var WorkflowHistoryItem $history_item */
         if ($history_item->getControl() == $control && $history_item->getState() == $state) {
             $count++;
         }
     }
     $this->completion_cache[$cache_key] = $count;
     return $count;
 }