Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' of git://git.zendframework.com/zf into mikaelkael
Browse files Browse the repository at this point in the history
  • Loading branch information
mikaelkael committed Jul 7, 2010
2 parents b288c81 + e331113 commit bc3b794
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 15 deletions.
9 changes: 5 additions & 4 deletions src/Adapter/Adapter.php → src/Adapter/AbstractAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
* @namespace
*/
namespace Zend\ProgressBar\Adapter;
use Zend\Config;

use Zend\Config\Config;

/**
* Abstract class for Zend_ProgressBar_Adapters
Expand All @@ -33,7 +34,7 @@
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Adapter
abstract class AbstractAdapter
{
/**
* Option keys to skip when calling setOptions()
Expand All @@ -57,7 +58,7 @@ public function __construct($options = null)
{
if (is_array($options)) {
$this->setOptions($options);
} elseif ($options instanceof Config\Config) {
} elseif ($options instanceof Config) {
$this->setConfig($options);
}
}
Expand All @@ -68,7 +69,7 @@ public function __construct($options = null)
* @param \Zend\Config\Config $config
* @return \Zend\ProgressBar\Adapter\Adapter
*/
public function setConfig(Config\Config $config)
public function setConfig(Config $config)
{
$this->setOptions($config->toArray());

Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/Console.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Console extends Adapter
class Console extends AbstractAdapter
{
/**
* Percentage value of the progress
Expand Down
11 changes: 6 additions & 5 deletions src/Adapter/JsPull.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,22 @@
* @namespace
*/
namespace Zend\ProgressBar\Adapter;
use Zend\Json;

use Zend\JSON\JSON;

/**
* Zend_ProgressBar_Adapter_JsPull offers a simple method for updating a
* progressbar in a browser.
*
* @uses \Zend\Json\Json
* @uses \Zend\JSON\JSON
* @uses \Zend\ProgressBar\Adapter\Adapter
* @category Zend
* @package Zend_ProgressBar
* @uses Zend_ProgressBar_Adapter_Interface
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class JsPull extends Adapter
class JsPull extends AbstractAdapter
{
/**
* Wether to exit after json data send or not
Expand Down Expand Up @@ -78,7 +79,7 @@ public function notify($current, $max, $percent, $timeTaken, $timeRemaining, $te
'finished' => false
);

$data = Json\Json::encode($arguments);
$data = JSON::encode($arguments);

// Output the data
$this->_outputData($data);
Expand All @@ -91,7 +92,7 @@ public function notify($current, $max, $percent, $timeTaken, $timeRemaining, $te
*/
public function finish()
{
$data = Json\Json::encode(array('finished' => true));
$data = JSON::encode(array('finished' => true));

$this->_outputData($data);
}
Expand Down
8 changes: 5 additions & 3 deletions src/Adapter/JsPush.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,21 @@
*/
namespace Zend\ProgressBar\Adapter;

use Zend\JSON\JSON;

/**
* Zend_ProgressBar_Adapter_JsPush offers a simple method for updating a
* progressbar in a browser.
*
* @uses \Zend\Json\Json
* @uses \Zend\JSON\JSON
* @uses \Zend\ProgressBar\Adapter\Adapter
* @category Zend
* @package Zend_ProgressBar
* @uses Zend_ProgressBar_Adapter_Interface
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class JsPush extends Adapter
class JsPush extends AbstractAdapter
{
/**
* Name of the JavaScript method to call on update
Expand Down Expand Up @@ -99,7 +101,7 @@ public function notify($current, $max, $percent, $timeTaken, $timeRemaining, $te
);

$data = '<script type="text/javascript">'
. 'parent.' . $this->_updateMethodName . '(' . \Zend\Json\Json::encode($arguments) . ');'
. 'parent.' . $this->_updateMethodName . '(' . JSON::encode($arguments) . ');'
. '</script>';

// Output the data
Expand Down
2 changes: 1 addition & 1 deletion src/ProgressBar.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class ProgressBar
* @param string $persistenceNamespace
* @throws \Zend\ProgressBar\Exception When $min is greater than $max
*/
public function __construct(Adapter\Adapter $adapter, $min = 0, $max = 100, $persistenceNamespace = null)
public function __construct(Adapter\AbstractAdapter $adapter, $min = 0, $max = 100, $persistenceNamespace = null)
{
// Check min/max values and set them
if ($min > $max) {
Expand Down
2 changes: 1 addition & 1 deletion test/ProgressBarTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public function getText()
}
}

class MockUp extends \Zend\ProgressBar\Adapter\Adapter
class MockUp extends \Zend\ProgressBar\Adapter\AbstractAdapter
{
protected $_current;
protected $_max;
Expand Down

0 comments on commit bc3b794

Please sign in to comment.