The method listZombies uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$sql .= " FROM $user_table as user, $login_table as access
WHERE
access.login_date = (SELECT MAX(a.login_date)
FROM $login_table as a
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The parameter $active_only is not named in camelCase. Open
public static function listZombies(
$ceiling,
$active_only = true,
$from = 0,
$count = 10,
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
Variable "user_table" is not in valid camel caps format Open
$sql .= " FROM $user_table as user, $login_table as access, $access_url_rel_user_table as url
- Exclude checks
Variable "user_table" is not in valid camel caps format Open
$user_table = Database::get_main_table(TABLE_MAIN_USER);
- Exclude checks
Variable "current_url_id" is not in valid camel caps format Open
$current_url_id = api_get_current_access_url_id();
- Exclude checks
Variable "user_table" is not in valid camel caps format Open
$sql .= " FROM $user_table as user, $login_table as access
- Exclude checks
Variable "access_url_rel_user_table" is not in valid camel caps format Open
$access_url_rel_user_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
- Exclude checks
Variable "login_table" is not in valid camel caps format Open
FROM $login_table as a
- Exclude checks
Missing parameter name Open
* @param $ceiling
- Exclude checks
Method name "ZombieManager::deactivate_zombies" is not in camel caps format Open
public static function deactivate_zombies($ceiling)
- Exclude checks
Missing function doc comment Open
public static function last_year()
- Exclude checks
Variable "access_url_rel_user_table" is not in valid camel caps format Open
$sql .= " FROM $user_table as user, $login_table as access, $access_url_rel_user_table as url
- Exclude checks
Variable "login_table" is not in valid camel caps format Open
$sql .= " FROM $user_table as user, $login_table as access
- Exclude checks
Variable "login_table" is not in valid camel caps format Open
$login_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
- Exclude checks
Variable "login_table" is not in valid camel caps format Open
$sql .= " FROM $user_table as user, $login_table as access, $access_url_rel_user_table as url
- Exclude checks
Variable "login_table" is not in valid camel caps format Open
FROM $login_table as a
- Exclude checks
Variable "active_only" is not in valid camel caps format Open
if ($active_only) {
- Exclude checks
Variable "current_url_id" is not in valid camel caps format Open
url.user_id = user.user_id AND url.access_url_id=$current_url_id";
- Exclude checks
Method name "ZombieManager::last_year" is not in camel caps format Open
public static function last_year()
- Exclude checks
Variable "active_only" is not in valid camel caps format Open
$active_only = true,
- Exclude checks
The variable $user_table is not named in camelCase. Open
public static function listZombies(
$ceiling,
$active_only = true,
$from = 0,
$count = 10,
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $login_table is not named in camelCase. Open
public static function listZombies(
$ceiling,
$active_only = true,
$from = 0,
$count = 10,
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $current_url_id is not named in camelCase. Open
public static function listZombies(
$ceiling,
$active_only = true,
$from = 0,
$count = 10,
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $current_url_id is not named in camelCase. Open
public static function listZombies(
$ceiling,
$active_only = true,
$from = 0,
$count = 10,
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $user_table is not named in camelCase. Open
public static function listZombies(
$ceiling,
$active_only = true,
$from = 0,
$count = 10,
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $user_table is not named in camelCase. Open
public static function listZombies(
$ceiling,
$active_only = true,
$from = 0,
$count = 10,
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $access_url_rel_user_table is not named in camelCase. Open
public static function listZombies(
$ceiling,
$active_only = true,
$from = 0,
$count = 10,
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $login_table is not named in camelCase. Open
public static function listZombies(
$ceiling,
$active_only = true,
$from = 0,
$count = 10,
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $access_url_rel_user_table is not named in camelCase. Open
public static function listZombies(
$ceiling,
$active_only = true,
$from = 0,
$count = 10,
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $login_table is not named in camelCase. Open
public static function listZombies(
$ceiling,
$active_only = true,
$from = 0,
$count = 10,
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $login_table is not named in camelCase. Open
public static function listZombies(
$ceiling,
$active_only = true,
$from = 0,
$count = 10,
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $login_table is not named in camelCase. Open
public static function listZombies(
$ceiling,
$active_only = true,
$from = 0,
$count = 10,
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $active_only is not named in camelCase. Open
public static function listZombies(
$ceiling,
$active_only = true,
$from = 0,
$count = 10,
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The method deactivate_zombies is not named in camelCase. Open
public static function deactivate_zombies($ceiling)
{
$zombies = self::listZombies($ceiling);
$ids = [];
foreach ($zombies as $zombie) {
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method last_year is not named in camelCase. Open
public static function last_year()
{
$today = time();
$day = date('j', $today);
$month = date('n', $today);
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}