for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
class Category extends \Suricate\DBObject
{
protected $tableName = 'categories';
protected $tableIndex = 'id';
public function __construct()
parent::__construct();
$database = new \Suricate\Database();
$database->configure([
'type' => 'sqlite',
'file' => '/tmp/test.db',
]);
$this->dbLink = $database;
$this->dbVariables = [
'id',
'name',
'parent_id',
];
$this->protectedVariables = [
'prot_var',
'unloadable',
}
protected function accessToProtectedVariable($name)
switch ($name) {
case 'prot_var':
$this->prot_var = 42;
prot_var
return true;
break;
break
The break statement is not necessary if it is preceded for example by a return statement:
return
switch ($x) { case 1: return 'foo'; break; // This break is not necessary and can be left off. }
If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.
case
case 'unloadable':
return false;