diff -r 000000000000 -r 4eba9c11703f web/Zend/ProgressBar/Adapter.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/Zend/ProgressBar/Adapter.php Mon Dec 13 18:29:26 2010 +0100 @@ -0,0 +1,113 @@ +setOptions($options); + } elseif ($options instanceof Zend_Config) { + $this->setConfig($options); + } + } + + /** + * Set options via a Zend_Config instance + * + * @param Zend_Config $config + * @return Zend_ProgressBar_Adapter + */ + public function setConfig(Zend_Config $config) + { + $this->setOptions($config->toArray()); + + return $this; + } + + /** + * Set options via an array + * + * @param array $options + * @return Zend_ProgressBar_Adapter + */ + public function setOptions(array $options) + { + foreach ($options as $key => $value) { + if (in_array(strtolower($key), $this->_skipOptions)) { + continue; + } + + $method = 'set' . ucfirst($key); + if (method_exists($this, $method)) { + $this->$method($value); + } + } + + return $this; + } + + /** + * Notify the adapter about an update + * + * @param float $current Current progress value + * @param float $max Max progress value + * @param float $percent Current percent value + * @param integer $timeTaken Taken time in seconds + * @param integer $timeRemaining Remaining time in seconds + * @param string $text Status text + * @return void + */ + abstract public function notify($current, $max, $percent, $timeTaken, $timeRemaining, $text); + + /** + * Called when the progress is explicitly finished + * + * @return void + */ + abstract public function finish(); +}