X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fconsolidation%2Frobo%2Fsrc%2FCommon%2FProgressIndicatorAwareTrait.php;fp=vendor%2Fconsolidation%2Frobo%2Fsrc%2FCommon%2FProgressIndicatorAwareTrait.php;h=060e039a18440e15d6d1b237f68898a928ec63b2;hp=0000000000000000000000000000000000000000;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0 diff --git a/vendor/consolidation/robo/src/Common/ProgressIndicatorAwareTrait.php b/vendor/consolidation/robo/src/Common/ProgressIndicatorAwareTrait.php new file mode 100644 index 000000000..060e039a1 --- /dev/null +++ b/vendor/consolidation/robo/src/Common/ProgressIndicatorAwareTrait.php @@ -0,0 +1,135 @@ +progressIndicator = $progressIndicator; + + return $this; + } + + /** + * @return null|bool + */ + protected function hideProgressIndicator() + { + if (!$this->progressIndicator) { + return; + } + return $this->progressIndicator->hideProgressIndicator(); + } + + protected function showProgressIndicator() + { + if (!$this->progressIndicator) { + return; + } + $this->progressIndicator->showProgressIndicator(); + } + + /** + * @param bool $visible + */ + protected function restoreProgressIndicator($visible) + { + if (!$this->progressIndicator) { + return; + } + $this->progressIndicator->restoreProgressIndicator($visible); + } + + /** + * @return int + */ + protected function getTotalExecutionTime() + { + if (!$this->progressIndicator) { + return 0; + } + return $this->progressIndicator->getExecutionTime(); + } + + protected function startProgressIndicator() + { + $this->startTimer(); + if ($this instanceof VerbosityThresholdInterface + && !$this->verbosityMeetsThreshold()) { + return; + } + if (!$this->progressIndicator) { + return; + } + $totalSteps = $this->progressIndicatorSteps(); + $this->progressIndicator->startProgressIndicator($totalSteps, $this); + } + + /** + * @return bool + */ + protected function inProgress() + { + if (!$this->progressIndicator) { + return false; + } + return $this->progressIndicator->inProgress(); + } + + protected function stopProgressIndicator() + { + $this->stopTimer(); + if (!$this->progressIndicator) { + return; + } + $this->progressIndicator->stopProgressIndicator($this); + } + + protected function disableProgressIndicator() + { + $this->stopTimer(); + if (!$this->progressIndicator) { + return; + } + $this->progressIndicator->disableProgressIndicator(); + } + + protected function detatchProgressIndicator() + { + $this->setProgressIndicator(null); + } + + /** + * @param int $steps + */ + protected function advanceProgressIndicator($steps = 1) + { + if (!$this->progressIndicator) { + return; + } + $this->progressIndicator->advanceProgressIndicator($steps); + } +}