Repository URL to install this package:
|
Version:
6.2.0 ▾
|
digitalascetic/batch-util
/
CountProgressMonitor.php
|
|---|
<?php
/**
* Created by IntelliJ IDEA.
* User: martino
* Date: 07/04/18
* Time: 10:17
*/
namespace DigitalAscetic\BatchUtil;
/**
* Class CountProgressMonitor
* @package DigitalAscetic\BatchUtil
*/
class CountProgressMonitor extends AbstractProgressMonitor
{
/**
* @var int
*/
private int $count;
/**
* @var int
*/
private int $totalSteps;
/**
* @var array
*/
private array $messages;
/**
* CountProgressMonitor constructor.
*/
public function __construct()
{
parent::__construct();
$this->count = 0;
$this->messages = array();
}
/**
* @param null $data
*/
public function start($data = null): void
{
$this->started = true;
}
/**
* @param null $data
*/
public function advance($data = null): void
{
$this->count++;
}
/**
* @param null $data
*/
public function finish($data = null): void
{
$this->finished = true;
}
/**
* @param null $data
*/
public function message($data = null): void
{
$this->messages[] = $data;
}
/**
* @param int $count
*/
public function setTotalSteps(int $count = 0): void
{
$this->totalSteps = $count;
}
/**
* @return int
*/
public function getCount(): int
{
return $this->count;
}
/**
* @return int
*/
public function getTotalSteps(): int
{
return $this->totalSteps;
}
/**
* @return float
*/
public function getProgressPercent(): float
{
return $this->count / $this->totalSteps;
}
}