Source of file AbstractAdapter.php
Size: 2,315 Bytes - Last Modified: 2014-03-12T23:21:18+01:00
/home/theseer/Downloads/ZendFramework-2.3.0/library/Zend/ProgressBar/Adapter/AbstractAdapter.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 | <?php /** * Zend Framework (http://framework.zend.com/) * * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace Zend\ProgressBar\Adapter; use Traversable; use Zend\Stdlib\ArrayUtils; /** * Abstract class for Zend\ProgressBar Adapters */ abstract class AbstractAdapter { /** * Option keys to skip when calling setOptions() * * @var array */ protected $skipOptions = array( 'options', 'config', ); /** * Create a new adapter * * $options may be either be an array or a Zend\Config object which * specifies adapter related options. * * @param array|Traversable $options */ public function __construct($options = null) { if ($options instanceof Traversable) { $options = ArrayUtils::iteratorToArray($options); } if (is_array($options)) { $this->setOptions($options); } } /** * Set options via an array * * @param array $options * @return AbstractAdapter */ 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 int $timeTaken Taken time in seconds * @param int $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(); } |