The function save_ticket() has an NPath complexity of 256. The configured NPath complexity threshold is 200. Open
function save_ticket()
{
$content = $_POST['content'];
if (!empty($_POST['phone'])) {
$content .= '<p style="color:red"> '.get_lang('Phone').': '.Security::remove_XSS($_POST['phone']).'</p>';
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method save_ticket uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
Display::addFlash(Display::return_message(get_lang('There was an error registering your ticket')));
}
- 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
Variable "other_area" is not in valid camel caps format Open
$other_area,
- Exclude checks
Missing parameter name Open
* @param $name
- Exclude checks
Variable "file_attachments" is not in valid camel caps format Open
$file_attachments = $_FILES;
- Exclude checks
Missing parameter name Open
* @param $array
- Exclude checks
Variable "category_id" is not in valid camel caps format Open
$category_id,
- Exclude checks
Consider putting global function "js_array" in a static class Open
function js_array($array, $name, $key)
- Exclude checks
Variable "file_attachments" is not in valid camel caps format Open
$file_attachments,
- Exclude checks
Consider putting global function "save_ticket" in a static class Open
function save_ticket()
- Exclude checks
Missing parameter name Open
* @param $key
- Exclude checks
Variable "course_id" is not in valid camel caps format Open
$course_id = isset($_POST['course_id']) ? (int) $_POST['course_id'] : '';
- Exclude checks
Variable "project_id" is not in valid camel caps format Open
$project_id = (int) $_POST['project_id'];
- Exclude checks
Variable "course_id" is not in valid camel caps format Open
$course_id,
- Exclude checks
Variable "project_id" is not in valid camel caps format Open
$project_id,
- Exclude checks
Variable "user_id" is not in valid camel caps format Open
$user_id = isset($_POST['user_id']) ? (int) $_POST['user_id'] : null;
- Exclude checks
Variable "personal_email" is not in valid camel caps format Open
$personal_email,
- Exclude checks
Missing function doc comment Open
function save_ticket()
- Exclude checks
Variable "category_id" is not in valid camel caps format Open
$category_id = isset($_POST['category_id']) ? (int) $_POST['category_id'] : '';
- Exclude checks
Variable "other_area" is not in valid camel caps format Open
$other_area = (int) $_POST['other_area'];
- Exclude checks
Variable "user_id" is not in valid camel caps format Open
$user_id
- Exclude checks
Variable "personal_email" is not in valid camel caps format Open
$personal_email = $_POST['personal_email'];
- Exclude checks
The variable $personal_email is not named in camelCase. Open
function save_ticket()
{
$content = $_POST['content'];
if (!empty($_POST['phone'])) {
$content .= '<p style="color:red"> '.get_lang('Phone').': '.Security::remove_XSS($_POST['phone']).'</p>';
- 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 $project_id is not named in camelCase. Open
function save_ticket()
{
$content = $_POST['content'];
if (!empty($_POST['phone'])) {
$content .= '<p style="color:red"> '.get_lang('Phone').': '.Security::remove_XSS($_POST['phone']).'</p>';
- 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 $other_area is not named in camelCase. Open
function save_ticket()
{
$content = $_POST['content'];
if (!empty($_POST['phone'])) {
$content .= '<p style="color:red"> '.get_lang('Phone').': '.Security::remove_XSS($_POST['phone']).'</p>';
- 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 $other_area is not named in camelCase. Open
function save_ticket()
{
$content = $_POST['content'];
if (!empty($_POST['phone'])) {
$content .= '<p style="color:red"> '.get_lang('Phone').': '.Security::remove_XSS($_POST['phone']).'</p>';
- 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 $file_attachments is not named in camelCase. Open
function save_ticket()
{
$content = $_POST['content'];
if (!empty($_POST['phone'])) {
$content .= '<p style="color:red"> '.get_lang('Phone').': '.Security::remove_XSS($_POST['phone']).'</p>';
- 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 $course_id is not named in camelCase. Open
function save_ticket()
{
$content = $_POST['content'];
if (!empty($_POST['phone'])) {
$content .= '<p style="color:red"> '.get_lang('Phone').': '.Security::remove_XSS($_POST['phone']).'</p>';
- 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 $course_id is not named in camelCase. Open
function save_ticket()
{
$content = $_POST['content'];
if (!empty($_POST['phone'])) {
$content .= '<p style="color:red"> '.get_lang('Phone').': '.Security::remove_XSS($_POST['phone']).'</p>';
- 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 $category_id is not named in camelCase. Open
function save_ticket()
{
$content = $_POST['content'];
if (!empty($_POST['phone'])) {
$content .= '<p style="color:red"> '.get_lang('Phone').': '.Security::remove_XSS($_POST['phone']).'</p>';
- 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_id is not named in camelCase. Open
function save_ticket()
{
$content = $_POST['content'];
if (!empty($_POST['phone'])) {
$content .= '<p style="color:red"> '.get_lang('Phone').': '.Security::remove_XSS($_POST['phone']).'</p>';
- 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_id is not named in camelCase. Open
function save_ticket()
{
$content = $_POST['content'];
if (!empty($_POST['phone'])) {
$content .= '<p style="color:red"> '.get_lang('Phone').': '.Security::remove_XSS($_POST['phone']).'</p>';
- 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 $category_id is not named in camelCase. Open
function save_ticket()
{
$content = $_POST['content'];
if (!empty($_POST['phone'])) {
$content .= '<p style="color:red"> '.get_lang('Phone').': '.Security::remove_XSS($_POST['phone']).'</p>';
- 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 $project_id is not named in camelCase. Open
function save_ticket()
{
$content = $_POST['content'];
if (!empty($_POST['phone'])) {
$content .= '<p style="color:red"> '.get_lang('Phone').': '.Security::remove_XSS($_POST['phone']).'</p>';
- 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 $personal_email is not named in camelCase. Open
function save_ticket()
{
$content = $_POST['content'];
if (!empty($_POST['phone'])) {
$content .= '<p style="color:red"> '.get_lang('Phone').': '.Security::remove_XSS($_POST['phone']).'</p>';
- 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 $file_attachments is not named in camelCase. Open
function save_ticket()
{
$content = $_POST['content'];
if (!empty($_POST['phone'])) {
$content .= '<p style="color:red"> '.get_lang('Phone').': '.Security::remove_XSS($_POST['phone']).'</p>';
- 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();
}
}