The method HookAdvancedSubscription::WSListSessionsDetailsByCategory() calls the typical debug function print_r() which is mostly only used during development. Open
error_log('Params '.print_r($params, 1));
- Read upRead up
- Exclude checks
DevelopmentCodeFragment
Since: 2.3.0
Functions like vardump(), printr() etc. are normally only used during development and therefore such calls in production code are a good indicator that they were just forgotten.
Example
class SuspectCode {
public function doSomething(array $items)
{
foreach ($items as $i => $item) {
// …
if ('qafoo' == $item) var_dump($i);
// …
}
}
}
Source https://phpmd.org/rules/design.html#developmentcodefragment
The method HookAdvancedSubscription::WSSessionGetDetailsByUser() calls the typical debug function print_r() which is mostly only used during development. Open
error_log('Params '.print_r($params, 1));
- Read upRead up
- Exclude checks
DevelopmentCodeFragment
Since: 2.3.0
Functions like vardump(), printr() etc. are normally only used during development and therefore such calls in production code are a good indicator that they were just forgotten.
Example
class SuspectCode {
public function doSomething(array $items)
{
foreach ($items as $i => $item) {
// …
if ('qafoo' == $item) var_dump($i);
// …
}
}
}
Source https://phpmd.org/rules/design.html#developmentcodefragment
The method HookAdvancedSubscription::WSSessionListInCategory() calls the typical debug function print_r() which is mostly only used during development. Open
error_log('Params '.print_r($params, 1));
- Read upRead up
- Exclude checks
DevelopmentCodeFragment
Since: 2.3.0
Functions like vardump(), printr() etc. are normally only used during development and therefore such calls in production code are a good indicator that they were just forgotten.
Example
class SuspectCode {
public function doSomething(array $items)
{
foreach ($items as $i => $item) {
// …
if ('qafoo' == $item) var_dump($i);
// …
}
}
}
Source https://phpmd.org/rules/design.html#developmentcodefragment
Missing class import via use statement (line '450', column '24'). Open
$datePub = new DateTime();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
The method WSSessionGetDetailsByUser uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
try {
$isAllowed = self::$plugin->isAllowedToDoRequest($userId, $params);
$data['message'] = self::$plugin->getStatusMessage($status, $isAllowed);
} catch (\Exception $e) {
- 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 method WSSessionGetDetailsByUser uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
// Return soap fault No result was found
$result = return_error(WS_ERROR_NOT_FOUND_RESULT);
}
- 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 method WSSessionListInCategory uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
// Return soap fault Not valid input params
return return_error(WS_ERROR_INVALID_INPUT);
}
- 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 method WSSessionGetDetailsByUser uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
if (!$isUserInTargetGroup) {
$data['status'] = -2;
} else {
try {
- 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 method WSSessionGetDetailsByUser uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
// Return soap fault No result was found
$result = return_error(WS_ERROR_NOT_FOUND_RESULT);
}
- 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 method WSSessionGetDetailsByUser uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
if (ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_APPROVED == $status) {
$data['action_url'] = self::$plugin->getSessionUrl($sessionId);
} elseif (ADVANCED_SUBSCRIPTION_QUEUE_STATUS_NO_QUEUE == $status) {
// in Queue or not, cannot be subscribed to session
- 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 method WSListSessionsDetailsByCategory uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
// Return soap fault Not valid input params
return return_error(WS_ERROR_INVALID_INPUT);
}
- 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 method WSSessionGetDetailsByUser uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
// Return soap fault Not valid input params
$result = return_error(WS_ERROR_INVALID_INPUT);
}
- 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
Missing parameter name Open
* @param $params
- Exclude checks
Missing parameter name Open
* @param $params
- Exclude checks
The method WSSessionListInCategory is not named in camelCase. Open
public static function WSSessionListInCategory($params)
{
global $debug;
if ($debug) {
- 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 WSListSessionsDetailsByCategory is not named in camelCase. Open
public static function WSListSessionsDetailsByCategory($params)
{
global $debug;
if ($debug) {
- 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 WSSessionGetDetailsByUser is not named in camelCase. Open
public static function WSSessionGetDetailsByUser($params)
{
global $debug;
if ($debug) {
- 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() {
}
}