mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
PSR2: Automatic fixes
This commit is contained in:
parent
1b1e921e3d
commit
4b7d31377b
@ -402,14 +402,15 @@ class GDBackend extends Object implements Image_Backend, Flushable
|
||||
switch ($angle) {
|
||||
case 90:
|
||||
imagesetpixel($rotate, $y, $destHeight - $x - 1, $color);
|
||||
break;
|
||||
break;
|
||||
case 180:
|
||||
imagesetpixel($rotate, $destWidth - $x - 1, $destHeight - $y - 1, $color);
|
||||
break;
|
||||
break;
|
||||
case 270:
|
||||
imagesetpixel($rotate, $destWidth - $y - 1, $x, $color);
|
||||
break;
|
||||
default: $rotate = $this->gd;
|
||||
break;
|
||||
default:
|
||||
$rotate = $this->gd;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -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++) {
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -126,19 +126,19 @@ abstract class Object
|
||||
switch ($argString[0]) {
|
||||
case '"':
|
||||
$result = stripcslashes(substr($argString, 1, -1));
|
||||
break;
|
||||
break;
|
||||
case "'":
|
||||
$result = str_replace(array("\\\\", "\\'"), array("\\", "'"), substr($argString, 1, -1));
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
throw new Exception("Bad T_CONSTANT_ENCAPSED_STRING arg $argString");
|
||||
throw new Exception("Bad T_CONSTANT_ENCAPSED_STRING arg $argString");
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case T_DNUMBER:
|
||||
$result = (double)$token[1];
|
||||
break;
|
||||
break;
|
||||
|
||||
case T_LNUMBER:
|
||||
$result = (int)$token[1];
|
||||
@ -150,25 +150,28 @@ abstract class Object
|
||||
end($bucket);
|
||||
$currentKey = current($bucket);
|
||||
array_pop($bucket);
|
||||
break;
|
||||
break;
|
||||
|
||||
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;
|
||||
break;
|
||||
|
||||
case T_ARRAY:
|
||||
$result = array();
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -331,7 +331,6 @@ abstract class Database
|
||||
// Switch command type
|
||||
switch ($writeInfo['command']) {
|
||||
case "update":
|
||||
|
||||
// Build update
|
||||
$query = new SQLUpdate("\"$table\"", $this->escapeColumnKeys($fieldValues));
|
||||
|
||||
|
@ -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()');
|
||||
}
|
||||
|
@ -392,7 +392,7 @@ class Versioned extends DataExtension implements TemplateGlobalProvider
|
||||
$stageTable = $this->stageTable($table, $stage);
|
||||
$query->renameTable($table, $stageTable);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
// Reading a specific stage, but only return items that aren't in any other stage
|
||||
case 'stage_unique':
|
||||
@ -420,7 +420,7 @@ class Versioned extends DataExtension implements TemplateGlobalProvider
|
||||
$query->addWhere('"'.$baseTable.'"."ID" NOT IN (SELECT "ID" FROM "'.$tempName.'")');
|
||||
$query->renameTable($tempName, $excludingTable);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
// Return all version instances
|
||||
case 'archive':
|
||||
@ -516,9 +516,9 @@ class Versioned extends DataExtension implements TemplateGlobalProvider
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
throw new InvalidArgumentException("Bad value for query parameter Versioned.mode: "
|
||||
throw new InvalidArgumentException("Bad value for query parameter Versioned.mode: "
|
||||
. $dataQuery->getQueryParam('Versioned.mode'));
|
||||
}
|
||||
}
|
||||
|
@ -124,11 +124,11 @@ class ThemeResourceLoader
|
||||
switch ($package) {
|
||||
case 'silverstripe/framework':
|
||||
$modulePath = FRAMEWORK_DIR;
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'silverstripe/cms':
|
||||
$modulePath = CMS_DIR;
|
||||
break;
|
||||
break;
|
||||
|
||||
default:
|
||||
list($vendor, $modulePath) = explode('/', $parts[0], 2);
|
||||
|
Loading…
Reference in New Issue
Block a user