×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: Валентин Наумов
Added: Oct 7, 2015 1:10 PM
Views: 7
Tags: rrcode
  1.  {
  2.         $start = $counter = $end = 0;
  3.         $progress = $this->progress;
  4.         $total = count($progress);
  5.         for ($i = 0; $i < $total; $i++) {
  6.             if ($progress[$i]->state === RestoreProgress::STATE_ON_WORK) {
  7.                 $start = $progress[$i]->date;
  8.                 if ($i == $total - 1) {
  9.                     $counter += $this->countRange($start, date('Y-m-d H:i:s'));
  10.                 }
  11.             } elseif ($start != 0) {
  12.                 $counter += $this->countRange($start, $progress[$i]->date);
  13.                 $start = 0;
  14.             }
  15.         }
  16.  
  17.         return $counter;
  18.     }