PSR2: Automatic fixes

This commit is contained in:
Damian Mooyman 2016-11-29 12:33:28 +13:00
parent 1b1e921e3d
commit 4b7d31377b
No known key found for this signature in database
GPG Key ID: 78B823A10DE27D1A
12 changed files with 73 additions and 59 deletions

View File

@ -409,7 +409,8 @@ class GDBackend extends Object implements Image_Backend, Flushable
case 270:
imagesetpixel($rotate, $destWidth - $y - 1, $x, $color);
break;
default: $rotate = $this->gd;
default:
$rotate = $this->gd;
};
}
}

View File

@ -744,16 +744,16 @@ class Email extends ViewableData
public static function obfuscate($email, $method = 'visible')
{
switch ($method) {
case 'direction' :
case 'direction':
Requirements::customCSS(
'span.codedirection { unicode-bidi: bidi-override; direction: rtl; }',
'codedirectionCSS'
);
return '<span class="codedirection">' . strrev($email) . '</span>';
case 'visible' :
case 'visible':
$obfuscated = array('@' => ' [at] ', '.' => ' [dot] ', '-' => ' [dash] ');
return strtr($email, $obfuscated);
case 'hex' :
case 'hex':
$encoded = '';
for ($x=0; $x < strlen($email);
$x++) {

View File

@ -489,7 +489,7 @@ class Config
return false;
}
static protected function check_key_or_value_contained_in_suppress_array($k, $v, $suppresses)
protected static function check_key_or_value_contained_in_suppress_array($k, $v, $suppresses)
{
foreach ($suppresses as $suppress) {
list($sk, $sv) = $suppress;
@ -500,7 +500,7 @@ class Config
return false;
}
static protected function filter_array_by_suppress_array($array, $suppress)
protected static function filter_array_by_suppress_array($array, $suppress)
{
$res = array();

View File

@ -237,13 +237,13 @@ function translate_memstring($memString)
{
switch (strtolower(substr($memString, -1))) {
case "k":
return round(substr($memString, 0, -1)*1024);
return round(substr($memString, 0, -1)*1024);
case "m":
return round(substr($memString, 0, -1)*1024*1024);
return round(substr($memString, 0, -1)*1024*1024);
case "g":
return round(substr($memString, 0, -1)*1024*1024*1024);
return round(substr($memString, 0, -1)*1024*1024*1024);
default:
return round($memString);
return round($memString);
}
}

View File

@ -89,14 +89,14 @@ trait CustomMethods
);
}
}
case isset($config['wrap']) :
case isset($config['wrap']):
array_unshift($arguments, $config['method']);
return call_user_func_array(array($this, $config['wrap']), $arguments);
case isset($config['function']) :
case isset($config['function']):
return $config['function']($this, $arguments);
default :
default:
throw new BadMethodCallException(
"Object->__call(): extra method $method is invalid on $class:"
. var_export($config, true)

View File

@ -154,18 +154,21 @@ abstract class Object
case T_STRING:
switch ($token[1]) {
case 'true': $result = true;
case 'true':
$result = true;
break;
case 'false': $result = false;
break;
case 'false':
$result = false;
break;
case 'null': $result = null;
break;
case 'null':
$result = null;
$forceResult = true;
break;
break;
default:
throw new Exception("Bad T_STRING arg '{$token[1]}'");
throw new Exception("Bad T_STRING arg '{$token[1]}'");
}
break;

View File

@ -92,21 +92,26 @@ class CliTestReporter extends SapphireTestReporter
{
// Status indicator, a la PHPUnit
switch ($this->currentTest['status']) {
case TEST_FAILURE: echo CLI::text("F", "red", null, true);
case TEST_FAILURE:
echo CLI::text("F", "red", null, true);
break;
case TEST_ERROR: echo CLI::text("E", "red", null, true);
break;
case TEST_ERROR:
echo CLI::text("E", "red", null, true);
break;
case TEST_INCOMPLETE: echo CLI::text("I", "yellow");
break;
case TEST_INCOMPLETE:
echo CLI::text("I", "yellow");
break;
case TEST_SUCCESS: echo CLI::text(".", "green");
break;
case TEST_SUCCESS:
echo CLI::text(".", "green");
break;
default: echo CLI::text("?", "yellow");
break;
default:
echo CLI::text("?", "yellow");
break;
break;
}
static $colCount = 0;

View File

@ -452,18 +452,22 @@ class SapphireTestReporter implements PHPUnit_Framework_TestListener
foreach ($suite['tests'] as $test) {
$testCount++;
switch ($test['status']) {
case TEST_ERROR: $errorCount++;
case TEST_ERROR:
$errorCount++;
break;
case TEST_INCOMPLETE: $incompleteCount++;
break;
case TEST_INCOMPLETE:
$incompleteCount++;
break;
case TEST_SUCCESS: $passCount++;
break;
case TEST_SUCCESS:
$passCount++;
break;
case TEST_FAILURE: $failCount++;
break;
case TEST_FAILURE:
$failCount++;
break;
break;
}
// Report test error

View File

@ -331,7 +331,6 @@ abstract class Database
// Switch command type
switch ($writeInfo['command']) {
case "update":
// Build update
$query = new SQLUpdate("\"$table\"", $this->escapeColumnKeys($fieldValues));

View File

@ -405,12 +405,14 @@ class DataList extends ViewableData implements SS_List, Filterable, Sortable, Li
// Validate and process arguments
$arguments = func_get_args();
switch (sizeof($arguments)) {
case 1: $filters = $arguments[0];
case 1:
$filters = $arguments[0];
break;
case 2: $filters = array($arguments[0] => $arguments[1]);
break;
case 2:
$filters = array($arguments[0] => $arguments[1]);
break;
break;
default:
throw new InvalidArgumentException('Incorrect number of arguments passed to filter()');
}