The method check_download_survey uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$row = Database::fetch_assoc($result);
$survey_invitation['survey_id'] = $row['survey_id'];
}
- 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 check_download_survey uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
echo '<form
id="language"
name="language"
method="POST"
- 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 $doc_url is not named in camelCase. Open
function check_download_survey($course, $invitation, $doc_url)
{
// Getting all the course information
$_course = api_get_course_info($course);
$course_id = $_course['real_id'];
- 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 "_course" is not in valid camel caps format Open
$_course = api_get_course_info($course);
- Exclude checks
Variable "doc_url" is not in valid camel caps format Open
function check_download_survey($course, $invitation, $doc_url)
- Exclude checks
Consider putting global function "check_download_survey" in a static class Open
function check_download_survey($course, $invitation, $doc_url)
- Exclude checks
Variable "survey_invitation" is not in valid camel caps format Open
survey_id = ".$survey_invitation['survey_id']." AND (
- Exclude checks
Variable "table_survey_question_option" is not in valid camel caps format Open
FROM $table_survey_question_option
- Exclude checks
Variable "table_survey_invitation" is not in valid camel caps format Open
$sql = "SELECT * FROM $table_survey_invitation
- Exclude checks
Variable "course_id" is not in valid camel caps format Open
c_id = $course_id AND
- Exclude checks
Variable "doc_url" is not in valid camel caps format Open
survey_question_comment LIKE '%$doc_url%'
- Exclude checks
Variable "course_id" is not in valid camel caps format Open
c_id = $course_id AND
- Exclude checks
Variable "table_survey_question" is not in valid camel caps format Open
$table_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION);
- Exclude checks
Variable "survey_invitation" is not in valid camel caps format Open
$survey_invitation['survey_id'] = Database::escape_string($survey_invitation['survey_id']);
- Exclude checks
Variable "table_survey_question" is not in valid camel caps format Open
FROM $table_survey_question
- Exclude checks
Variable "survey_invitation" is not in valid camel caps format Open
$survey_invitation['survey_id'] = $_POST['language'];
- Exclude checks
Variable "survey_invitation" is not in valid camel caps format Open
survey_id = ".$survey_invitation['survey_id']." AND (
- Exclude checks
Variable "doc_url" is not in valid camel caps format Open
or subtitle LIKE '%$doc_url%'
- Exclude checks
Variable "_course" is not in valid camel caps format Open
return $_course;
- Exclude checks
Variable "_course" is not in valid camel caps format Open
$course_id = $_course['real_id'];
- Exclude checks
Variable "table_survey_question_option" is not in valid camel caps format Open
$table_survey_question_option = Database::get_course_table(TABLE_SURVEY_QUESTION_OPTION);
- Exclude checks
Variable "survey_invitation" is not in valid camel caps format Open
$survey_invitation['survey_id'] = Database::escape_string($survey_invitation['survey_id']);
- Exclude checks
Variable "table_survey" is not in valid camel caps format Open
FROM $table_survey
- Exclude checks
Variable "doc_url" is not in valid camel caps format Open
title LIKE '%$doc_url%'
- Exclude checks
Variable "doc_url" is not in valid camel caps format Open
or surveythanks LIKE '%$doc_url%'
- Exclude checks
Variable "survey_invitation" is not in valid camel caps format Open
survey_id = ".$survey_invitation['survey_id']." AND
- Exclude checks
Variable "survey_invitation" is not in valid camel caps format Open
$survey_invitation['survey_id'] = $row['survey_id'];
- Exclude checks
Variable "doc_url" is not in valid camel caps format Open
$doc_url = Database::escape_string($doc_url);
- Exclude checks
Variable "course_id" is not in valid camel caps format Open
c_id = $course_id AND
- Exclude checks
Variable "table_survey" is not in valid camel caps format Open
$sql = "SELECT * FROM $table_survey
- Exclude checks
Variable "table_survey" is not in valid camel caps format Open
$table_survey = Database::get_course_table(TABLE_SURVEY);
- Exclude checks
Variable "doc_url" is not in valid camel caps format Open
$doc_url = Database::escape_string($doc_url);
- Exclude checks
Variable "table_survey_invitation" is not in valid camel caps format Open
$table_survey_invitation = Database::get_course_table(TABLE_SURVEY_INVITATION);
- Exclude checks
Variable "course_id" is not in valid camel caps format Open
c_id = $course_id AND
- Exclude checks
Variable "doc_url" is not in valid camel caps format Open
or intro LIKE '%$doc_url%'
- Exclude checks
Variable "doc_url" is not in valid camel caps format Open
option_text LIKE '%$doc_url%'
- Exclude checks
Variable "survey_invitation" is not in valid camel caps format Open
code='".Database::escape_string($survey_invitation['survey_code'])."'";
- Exclude checks
Variable "doc_url" is not in valid camel caps format Open
survey_question LIKE '%$doc_url%' OR
- Exclude checks
Variable "survey_invitation" is not in valid camel caps format Open
$survey_invitation = Database::fetch_assoc($result);
- Exclude checks
Variable "survey_invitation" is not in valid camel caps format Open
if (1 == $survey_invitation['answered']) {
- Exclude checks
Variable "course_id" is not in valid camel caps format Open
$course_id = $_course['real_id'];
- Exclude checks
Variable "course_id" is not in valid camel caps format Open
c_id = $course_id AND
- Exclude checks
The variable $survey_invitation is not named in camelCase. Open
function check_download_survey($course, $invitation, $doc_url)
{
// Getting all the course information
$_course = api_get_course_info($course);
$course_id = $_course['real_id'];
- 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 check_download_survey($course, $invitation, $doc_url)
{
// Getting all the course information
$_course = api_get_course_info($course);
$course_id = $_course['real_id'];
- 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 $doc_url is not named in camelCase. Open
function check_download_survey($course, $invitation, $doc_url)
{
// Getting all the course information
$_course = api_get_course_info($course);
$course_id = $_course['real_id'];
- 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 $table_survey_question_option is not named in camelCase. Open
function check_download_survey($course, $invitation, $doc_url)
{
// Getting all the course information
$_course = api_get_course_info($course);
$course_id = $_course['real_id'];
- 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 $doc_url is not named in camelCase. Open
function check_download_survey($course, $invitation, $doc_url)
{
// Getting all the course information
$_course = api_get_course_info($course);
$course_id = $_course['real_id'];
- 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 $doc_url is not named in camelCase. Open
function check_download_survey($course, $invitation, $doc_url)
{
// Getting all the course information
$_course = api_get_course_info($course);
$course_id = $_course['real_id'];
- 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 $table_survey_question is not named in camelCase. Open
function check_download_survey($course, $invitation, $doc_url)
{
// Getting all the course information
$_course = api_get_course_info($course);
$course_id = $_course['real_id'];
- 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 $survey_invitation is not named in camelCase. Open
function check_download_survey($course, $invitation, $doc_url)
{
// Getting all the course information
$_course = api_get_course_info($course);
$course_id = $_course['real_id'];
- 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 $survey_invitation is not named in camelCase. Open
function check_download_survey($course, $invitation, $doc_url)
{
// Getting all the course information
$_course = api_get_course_info($course);
$course_id = $_course['real_id'];
- 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 $table_survey_question is not named in camelCase. Open
function check_download_survey($course, $invitation, $doc_url)
{
// Getting all the course information
$_course = api_get_course_info($course);
$course_id = $_course['real_id'];
- 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 $doc_url is not named in camelCase. Open
function check_download_survey($course, $invitation, $doc_url)
{
// Getting all the course information
$_course = api_get_course_info($course);
$course_id = $_course['real_id'];
- 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 $doc_url is not named in camelCase. Open
function check_download_survey($course, $invitation, $doc_url)
{
// Getting all the course information
$_course = api_get_course_info($course);
$course_id = $_course['real_id'];
- 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 check_download_survey($course, $invitation, $doc_url)
{
// Getting all the course information
$_course = api_get_course_info($course);
$course_id = $_course['real_id'];
- 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 $table_survey_invitation is not named in camelCase. Open
function check_download_survey($course, $invitation, $doc_url)
{
// Getting all the course information
$_course = api_get_course_info($course);
$course_id = $_course['real_id'];
- 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 $survey_invitation is not named in camelCase. Open
function check_download_survey($course, $invitation, $doc_url)
{
// Getting all the course information
$_course = api_get_course_info($course);
$course_id = $_course['real_id'];
- 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 $survey_invitation is not named in camelCase. Open
function check_download_survey($course, $invitation, $doc_url)
{
// Getting all the course information
$_course = api_get_course_info($course);
$course_id = $_course['real_id'];
- 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 check_download_survey($course, $invitation, $doc_url)
{
// Getting all the course information
$_course = api_get_course_info($course);
$course_id = $_course['real_id'];
- 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 check_download_survey($course, $invitation, $doc_url)
{
// Getting all the course information
$_course = api_get_course_info($course);
$course_id = $_course['real_id'];
- 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 $table_survey is not named in camelCase. Open
function check_download_survey($course, $invitation, $doc_url)
{
// Getting all the course information
$_course = api_get_course_info($course);
$course_id = $_course['real_id'];
- 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 $doc_url is not named in camelCase. Open
function check_download_survey($course, $invitation, $doc_url)
{
// Getting all the course information
$_course = api_get_course_info($course);
$course_id = $_course['real_id'];
- 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 is not named in camelCase. Open
function check_download_survey($course, $invitation, $doc_url)
{
// Getting all the course information
$_course = api_get_course_info($course);
$course_id = $_course['real_id'];
- 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 is not named in camelCase. Open
function check_download_survey($course, $invitation, $doc_url)
{
// Getting all the course information
$_course = api_get_course_info($course);
$course_id = $_course['real_id'];
- 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 $survey_invitation is not named in camelCase. Open
function check_download_survey($course, $invitation, $doc_url)
{
// Getting all the course information
$_course = api_get_course_info($course);
$course_id = $_course['real_id'];
- 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 $table_survey is not named in camelCase. Open
function check_download_survey($course, $invitation, $doc_url)
{
// Getting all the course information
$_course = api_get_course_info($course);
$course_id = $_course['real_id'];
- 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 $survey_invitation is not named in camelCase. Open
function check_download_survey($course, $invitation, $doc_url)
{
// Getting all the course information
$_course = api_get_course_info($course);
$course_id = $_course['real_id'];
- 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 $doc_url is not named in camelCase. Open
function check_download_survey($course, $invitation, $doc_url)
{
// Getting all the course information
$_course = api_get_course_info($course);
$course_id = $_course['real_id'];
- 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 $survey_invitation is not named in camelCase. Open
function check_download_survey($course, $invitation, $doc_url)
{
// Getting all the course information
$_course = api_get_course_info($course);
$course_id = $_course['real_id'];
- 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 check_download_survey($course, $invitation, $doc_url)
{
// Getting all the course information
$_course = api_get_course_info($course);
$course_id = $_course['real_id'];
- 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 $doc_url is not named in camelCase. Open
function check_download_survey($course, $invitation, $doc_url)
{
// Getting all the course information
$_course = api_get_course_info($course);
$course_id = $_course['real_id'];
- 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 is not named in camelCase. Open
function check_download_survey($course, $invitation, $doc_url)
{
// Getting all the course information
$_course = api_get_course_info($course);
$course_id = $_course['real_id'];
- 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 check_download_survey($course, $invitation, $doc_url)
{
// Getting all the course information
$_course = api_get_course_info($course);
$course_id = $_course['real_id'];
- 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 $table_survey_question_option is not named in camelCase. Open
function check_download_survey($course, $invitation, $doc_url)
{
// Getting all the course information
$_course = api_get_course_info($course);
$course_id = $_course['real_id'];
- 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 $table_survey is not named in camelCase. Open
function check_download_survey($course, $invitation, $doc_url)
{
// Getting all the course information
$_course = api_get_course_info($course);
$course_id = $_course['real_id'];
- 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 $doc_url is not named in camelCase. Open
function check_download_survey($course, $invitation, $doc_url)
{
// Getting all the course information
$_course = api_get_course_info($course);
$course_id = $_course['real_id'];
- 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 $survey_invitation is not named in camelCase. Open
function check_download_survey($course, $invitation, $doc_url)
{
// Getting all the course information
$_course = api_get_course_info($course);
$course_id = $_course['real_id'];
- 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 $table_survey_invitation is not named in camelCase. Open
function check_download_survey($course, $invitation, $doc_url)
{
// Getting all the course information
$_course = api_get_course_info($course);
$course_id = $_course['real_id'];
- 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 $survey_invitation is not named in camelCase. Open
function check_download_survey($course, $invitation, $doc_url)
{
// Getting all the course information
$_course = api_get_course_info($course);
$course_id = $_course['real_id'];
- 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();
}
}