Skip to content
Browse files

Misc phpcs

  • Loading branch information...
1 parent 547c3a0 commit 830e9a36a0647d035c5d881e9221ab3d6b1703a8 @CloCkWeRX CloCkWeRX committed Dec 20, 2011
Showing with 85 additions and 49 deletions.
  1. +40 −26 HTML/Progress2/Generator.php
  2. +45 −23 HTML/Progress2/Monitor.php
View
66 HTML/Progress2/Generator.php
@@ -139,10 +139,11 @@ class HTML_Progress2_Generator extends HTML_QuickForm_Controller
* @since version 2.0.0 (2005-10-01)
* @access public
*/
- function HTML_Progress2_Generator($controllerName = 'ProgressGenerator',
- $attributes = array(),
- $errorPrefs = array())
- {
+ function HTML_Progress2_Generator(
+ $controllerName = 'ProgressGenerator',
+ $attributes = array(),
+ $errorPrefs = array()
+ ) {
$this->__construct($controllerName, $attributes, $errorPrefs);
}
@@ -181,29 +182,36 @@ function HTML_Progress2_Generator($controllerName = 'ProgressGenerator',
* @access protected
* @throws HTML_PROGRESS2_ERROR_INVALID_INPUT
*/
- function __construct($controllerName = 'ProgressGenerator',
- $attributes = array(),
- $errorPrefs = array())
- {
- $this->_progress = new HTML_Progress2($errorPrefs,
- HTML_PROGRESS2_BAR_HORIZONTAL,
- 0, 100);
+ function __construct(
+ $controllerName = 'ProgressGenerator',
+ $attributes = array(),
+ $errorPrefs = array()
+ ) {
+ $this->_progress = new HTML_Progress2(
+ $errorPrefs,
+ HTML_PROGRESS2_BAR_HORIZONTAL,
+ 0, 100
+ );
if (!is_string($controllerName)) {
- return $this->_progress->raiseError(HTML_PROGRESS2_ERROR_INVALID_INPUT,
+ return $this->_progress->raiseError(
+ HTML_PROGRESS2_ERROR_INVALID_INPUT,
'exception',
array('var' => '$controllerName',
'was' => gettype($controllerName),
'expected' => 'string',
- 'paramnum' => 1));
+ 'paramnum' => 1)
+ );
} elseif (!is_array($attributes)) {
- return $this->_progress->raiseError(HTML_PROGRESS2_ERROR_INVALID_INPUT,
+ return $this->_progress->raiseError(
+ HTML_PROGRESS2_ERROR_INVALID_INPUT,
'exception',
array('var' => '$attributes',
'was' => gettype($attributes),
'expected' => 'array',
- 'paramnum' => 2));
+ 'paramnum' => 2)
+ );
}
// build a new modal controller
@@ -219,7 +227,8 @@ function __construct($controllerName = 'ProgressGenerator',
$sess =& $this->container();
if (count($sess['defaults']) == 0) {
- $this->setDefaults(array(
+ $this->setDefaults(
+ array(
'shape' => HTML_PROGRESS2_BAR_HORIZONTAL,
'way' => 'natural',
'autosize' => true,
@@ -256,7 +265,8 @@ function __construct($controllerName = 'ProgressGenerator',
'stringweight' => 'normal',
'phpcss' => array('P' => true)
- ));
+ )
+ );
}
}
@@ -272,16 +282,19 @@ function __construct($controllerName = 'ProgressGenerator',
* @since version 2.1.0 (2006-08-12)
* @access public
*/
- function &singleton($controllerName = 'ProgressGenerator',
- $attributes = array(),
- $errorPrefs = array())
- {
+ function &singleton(
+ $controllerName = 'ProgressGenerator',
+ $attributes = array(),
+ $errorPrefs = array()
+ ) {
static $generator;
if (!isset($generator)) {
- $generator =& new HTML_Progress2_Generator($controllerName,
- $attributes,
- $errorPrefs);
+ $generator =& new HTML_Progress2_Generator(
+ $controllerName,
+ $attributes,
+ $errorPrefs
+ );
}
return $generator;
@@ -418,7 +431,8 @@ function isIncludeable($file)
{
foreach (explode(PATH_SEPARATOR, ini_get('include_path')) as $path) {
if (file_exists($path . DIRECTORY_SEPARATOR . $file)
- && is_readable($path . DIRECTORY_SEPARATOR . $file)) {
+ && is_readable($path . DIRECTORY_SEPARATOR . $file)
+ ) {
return true;
}
}
@@ -612,4 +626,4 @@ function createProgressStructure()
return $structure;
}
}
-?>
+?>
View
68 HTML/Progress2/Monitor.php
@@ -412,20 +412,28 @@ function isCanceled()
function run()
{
if ($this->isCanceled()) {
- $this->_postNotification('onCancel',
- array('handler' => __FUNCTION__,
- 'value' => $this->_progress->getValue()));
+ $this->_postNotification(
+ 'onCancel',
+ array('handler' => __FUNCTION__,
+ 'value' => $this->_progress->getValue())
+ );
}
if ($this->isStarted()) {
$this->_progress->_status = 'show';
- $this->_postNotification('onSubmit',
- array('handler' => __FUNCTION__,
- 'value' => $this->_progress->getValue()));
+ $this->_postNotification(
+ 'onSubmit',
+ array('handler' => __FUNCTION__,
+ 'value' => $this->_progress->getValue())
+ );
+
$this->_progress->run();
- $this->_postNotification('onLoad',
- array('handler' => __FUNCTION__,
- 'value' => $this->_progress->getValue()));
+
+ $this->_postNotification(
+ 'onLoad',
+ array('handler' => __FUNCTION__,
+ 'value' => $this->_progress->getValue())
+ );
}
}
@@ -445,12 +453,14 @@ function run()
function setProgressElement(&$bar)
{
if (!is_a($bar, 'HTML_Progress2')) {
- return $this->_progress->raiseError(HTML_PROGRESS2_ERROR_INVALID_INPUT,
+ return $this->_progress->raiseError(
+ HTML_PROGRESS2_ERROR_INVALID_INPUT,
'exception',
array('var' => '$bar',
'was' => gettype($bar),
'expected' => 'HTML_Progress2 object',
- 'paramnum' => 1));
+ 'paramnum' => 1)
+ );
}
$this->_progress = $bar;
@@ -489,12 +499,14 @@ function &getProgressElement()
function getStyle($raw = true)
{
if (!is_bool($raw)) {
- return $this->raiseError(HTML_PROGRESS2_ERROR_INVALID_INPUT,
+ return $this->raiseError(
+ HTML_PROGRESS2_ERROR_INVALID_INPUT,
'exception',
array('var' => '$raw',
'was' => gettype($raw),
'expected' => 'boolean',
- 'paramnum' => 1));
+ 'paramnum' => 1)
+ );
}
return $this->_progress->getStyle($raw);
@@ -516,12 +528,14 @@ function getStyle($raw = true)
function getScript($raw = true)
{
if (!is_bool($raw)) {
- return $this->raiseError(HTML_PROGRESS2_ERROR_INVALID_INPUT,
+ return $this->raiseError(
+ HTML_PROGRESS2_ERROR_INVALID_INPUT,
'exception',
array('var' => '$raw',
'was' => gettype($raw),
'expected' => 'boolean',
- 'paramnum' => 1));
+ 'paramnum' => 1)
+ );
}
return $this->_progress->getScript($raw);
@@ -586,12 +600,14 @@ function display()
function accept(&$renderer)
{
if (!is_a($renderer, 'HTML_QuickForm_Renderer')) {
- return $this->_progress->raiseError(HTML_PROGRESS2_ERROR_INVALID_INPUT,
+ return $this->_progress->raiseError(
+ HTML_PROGRESS2_ERROR_INVALID_INPUT,
'exception',
array('var' => '$renderer',
'was' => gettype($renderer),
'expected' => 'HTML_QuickForm_Renderer object',
- 'paramnum' => 1));
+ 'paramnum' => 1)
+ );
}
$this->_form->accept($renderer);
}
@@ -621,27 +637,33 @@ function accept(&$renderer)
function setCaption($caption = ' ', $args = array())
{
if (!is_string($caption)) {
- return $this->_progress->raiseError(HTML_PROGRESS2_ERROR_INVALID_INPUT,
+ return $this->_progress->raiseError(
+ HTML_PROGRESS2_ERROR_INVALID_INPUT,
'exception',
array('var' => '$caption',
'was' => gettype($caption),
'expected' => 'string',
- 'paramnum' => 1));
+ 'paramnum' => 1)
+ );
} elseif (!is_array($args)) {
- return $this->_progress->raiseError(HTML_PROGRESS2_ERROR_INVALID_INPUT,
+ return $this->_progress->raiseError(
+ HTML_PROGRESS2_ERROR_INVALID_INPUT,
'exception',
array('var' => '$args',
'was' => gettype($args),
'expected' => 'array',
- 'paramnum' => 2));
+ 'paramnum' => 2)
+ );
}
foreach ($args as $name => $value) {
$caption = str_replace("%$name%", $value, $caption);
}
- $this->_progress->setLabelAttributes($this->caption['id'],
- array('value' => $caption));
+ $this->_progress->setLabelAttributes(
+ $this->caption['id'],
+ array('value' => $caption)
+ );
}
/**

0 comments on commit 830e9a3

Please sign in to comment.
Something went wrong with that request. Please try again.