Avoid unused local variables such as '$time'. Open
foreach ($chatHistory as $userId => $time) {
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
The method send uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$messagesan = $message;
}
- 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 property $window_list is not named in camelCase. Open
class Chat extends Model
{
public $columns = [
'id',
'from_user',
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The parameter $to_user_id is not named in camelCase. Open
public function send(
$fromUserId,
$to_user_id,
$message,
$printResult = true,
- 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 "to_user_id" is not in valid camel caps format Open
if (!empty($fromUserId) && !empty($to_user_id)) {
- Exclude checks
Member variable "window_list" is not in valid camel caps format Open
public $window_list = [];
- Exclude checks
Variable "to_user_id" is not in valid camel caps format Open
$_SESSION['openChatBoxes'][$to_user_id] = api_strtotime($now, 'UTC');
- Exclude checks
Variable "to_user_id" is not in valid camel caps format Open
$_SESSION['chatHistory'][$to_user_id]['user_info']['online'] = $user_info['user_is_online'];
- Exclude checks
Variable "user_info" is not in valid camel caps format Open
$_SESSION['chatHistory'][$to_user_id]['user_info']['avatar'] = $user_info['avatar_small'];
- Exclude checks
Variable "to_user_id" is not in valid camel caps format Open
$_SESSION['chatHistory'][$to_user_id]['items'][] = $item;
- Exclude checks
Variable "to_user_id" is not in valid camel caps format Open
$_SESSION['chatHistory'][$to_user_id]['user_info']['avatar'] = $user_info['avatar_small'];
- Exclude checks
Variable "to_user_id" is not in valid camel caps format Open
$to_user_id,
- Exclude checks
Variable "to_user_id" is not in valid camel caps format Open
unset($_SESSION['tsChatBoxes'][$to_user_id]);
- Exclude checks
Variable "user_info" is not in valid camel caps format Open
$user_info = api_get_user_info($to_user_id, true);
- Exclude checks
Variable "user_info" is not in valid camel caps format Open
$_SESSION['chatHistory'][$to_user_id]['user_info']['user_id'] = $user_info['user_id'];
- Exclude checks
Variable "user_info" is not in valid camel caps format Open
$_SESSION['chatHistory'][$to_user_id]['user_info']['online'] = $user_info['user_is_online'];
- Exclude checks
Variable "attempt_status" is not in valid camel caps format Open
foreach ($currentExercises as $attempt_status) {
- Exclude checks
Variable "to_user_id" is not in valid camel caps format Open
$_SESSION['chatHistory'][$to_user_id] = [];
- Exclude checks
Variable "to_user_id" is not in valid camel caps format Open
$_SESSION['chatHistory'][$to_user_id]['user_info']['user_id'] = $user_info['user_id'];
- Exclude checks
Variable "window_list" is not in valid camel caps format Open
Session::write('window_list', $this->window_list);
- Exclude checks
Variable "to_user_id" is not in valid camel caps format Open
$this->saveWindow($to_user_id);
- Exclude checks
Variable "to_user_id" is not in valid camel caps format Open
$params['to_user'] = (int) $to_user_id;
- Exclude checks
Variable "window_list" is not in valid camel caps format Open
$this->window_list[$userId] = true;
- Exclude checks
Variable "to_user_id" is not in valid camel caps format Open
$user_info = api_get_user_info($to_user_id, true);
- Exclude checks
Variable "to_user_id" is not in valid camel caps format Open
$_SESSION['chatHistory'][$to_user_id]['user_info']['user_name'] = $user_info['complete_name'];
- Exclude checks
Variable "attempt_status" is not in valid camel caps format Open
if (true == $attempt_status) {
- Exclude checks
Variable "window_list" is not in valid camel caps format Open
$this->window_list = Session::read('window_list');
- Exclude checks
Variable "window_list" is not in valid camel caps format Open
Session::write('window_list', $this->window_list);
- Exclude checks
Variable "to_user_id" is not in valid camel caps format Open
if (!isset($_SESSION['chatHistory'][$to_user_id])) {
- Exclude checks
Variable "to_user_id" is not in valid camel caps format Open
$relation = SocialManager::get_relation_between_contacts($fromUserId, $to_user_id);
- Exclude checks
Variable "user_info" is not in valid camel caps format Open
$_SESSION['chatHistory'][$to_user_id]['user_info']['user_name'] = $user_info['complete_name'];
- Exclude checks
The variable $to_user_id is not named in camelCase. Open
public function send(
$fromUserId,
$to_user_id,
$message,
$printResult = true,
- 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 $to_user_id is not named in camelCase. Open
public function send(
$fromUserId,
$to_user_id,
$message,
$printResult = true,
- 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 $to_user_id is not named in camelCase. Open
public function send(
$fromUserId,
$to_user_id,
$message,
$printResult = true,
- 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 $to_user_id is not named in camelCase. Open
public function send(
$fromUserId,
$to_user_id,
$message,
$printResult = true,
- 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 $to_user_id is not named in camelCase. Open
public function send(
$fromUserId,
$to_user_id,
$message,
$printResult = true,
- 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 $to_user_id is not named in camelCase. Open
public function send(
$fromUserId,
$to_user_id,
$message,
$printResult = true,
- 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 $attempt_status is not named in camelCase. Open
public function isChatBlockedByExercises()
{
$currentExercises = Session::read('current_exercises');
if (!empty($currentExercises)) {
foreach ($currentExercises as $attempt_status) {
- 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_info is not named in camelCase. Open
public function send(
$fromUserId,
$to_user_id,
$message,
$printResult = true,
- 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 $to_user_id is not named in camelCase. Open
public function send(
$fromUserId,
$to_user_id,
$message,
$printResult = true,
- 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_info is not named in camelCase. Open
public function send(
$fromUserId,
$to_user_id,
$message,
$printResult = true,
- 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 $to_user_id is not named in camelCase. Open
public function send(
$fromUserId,
$to_user_id,
$message,
$printResult = true,
- 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 $to_user_id is not named in camelCase. Open
public function send(
$fromUserId,
$to_user_id,
$message,
$printResult = true,
- 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 $to_user_id is not named in camelCase. Open
public function send(
$fromUserId,
$to_user_id,
$message,
$printResult = true,
- 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 $to_user_id is not named in camelCase. Open
public function send(
$fromUserId,
$to_user_id,
$message,
$printResult = true,
- 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 $to_user_id is not named in camelCase. Open
public function send(
$fromUserId,
$to_user_id,
$message,
$printResult = true,
- 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 $to_user_id is not named in camelCase. Open
public function send(
$fromUserId,
$to_user_id,
$message,
$printResult = true,
- 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_info is not named in camelCase. Open
public function send(
$fromUserId,
$to_user_id,
$message,
$printResult = true,
- 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_info is not named in camelCase. Open
public function send(
$fromUserId,
$to_user_id,
$message,
$printResult = true,
- 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 $attempt_status is not named in camelCase. Open
public function isChatBlockedByExercises()
{
$currentExercises = Session::read('current_exercises');
if (!empty($currentExercises)) {
foreach ($currentExercises as $attempt_status) {
- 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_info is not named in camelCase. Open
public function send(
$fromUserId,
$to_user_id,
$message,
$printResult = true,
- 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 $to_user_id is not named in camelCase. Open
public function send(
$fromUserId,
$to_user_id,
$message,
$printResult = true,
- 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();
}
}