Missing class import via use statement (line '435', column '16'). Open
$ims = new ImsSection($exercise);
- 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
Missing class import via use statement (line '469', column '16'). Open
$ims = new ImsAssessmentItem($question);
- 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
Missing class import via use statement (line '53', column '29'). Open
$category = new TestCategory();
- 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
Missing class import via use statement (line '450', column '21'). Open
$question = new Ims2Question();
- 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
Missing class import via use statement (line '431', column '21'). Open
$exercise = new Exercise();
- 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 export_duration uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
return '';
}
- 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
Avoid assigning values to variables in if clauses and the like (line '181', column '13'). Open
public function export_duration()
{
if ($max_time = $this->exercise->selectTimeLimit()) {
// return exercise duration in ISO8601 format.
$minutes = floor($max_time / 60);
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid assigning values to variables in if clauses and the like (line '213', column '13'). Open
public function export_ordering()
{
$out = '';
if ($n = $this->exercise->getShuffle()) {
$out .= '<selection_ordering>'
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
The method export_ordering uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$out .= '<selection_ordering sequence_type="Normal">'."\n"
." <selection />\n"
."</selection_ordering>\n";
}
- 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
Each class must be in a file by itself Open
class ImsItem
- Exclude checks
Each class must be in a file by itself Open
class ImsSection
- Exclude checks
Method name "ImsSection::export_duration" is not in camel caps format Open
public function export_duration()
- Exclude checks
Variable "max_time" is not in valid camel caps format Open
$seconds = $max_time % 60;
- Exclude checks
Consider putting global function "export_question_qti" in a static class Open
function export_question_qti($questionId, $standalone = true)
- Exclude checks
Method name "ImsSection::end_section" is not in camel caps format Open
public function end_section()
- Exclude checks
Method name "ImsAssessmentItem::end_item" is not in camel caps format Open
public function end_item()
- Exclude checks
Missing function doc comment Open
public function start_section()
- Exclude checks
Method name "ImsSection::export_ordering" is not in camel caps format Open
public function export_ordering()
- Exclude checks
Method name "ImsItem::start_presentation" is not in camel caps format Open
public function start_presentation()
- Exclude checks
Method name "ImsItem::end_processing" is not in camel caps format Open
public function end_processing()
- Exclude checks
Method name "ImsAssessmentItem::end_item_body" is not in camel caps format Open
public function end_item_body()
- Exclude checks
Method name "ImsSection::export_presentation" is not in camel caps format Open
public function export_presentation()
- Exclude checks
Multiple classes defined in a single file Open
class ImsItem
- Exclude checks
Method name "ImsAssessmentItem::start_item" is not in camel caps format Open
public function start_item()
- Exclude checks
Missing parameter name Open
* @param $text
- Exclude checks
Method name "ImsSection::start_section" is not in camel caps format Open
public function start_section()
- Exclude checks
Consider putting global function "formatExerciseQtiText" in a static class Open
function formatExerciseQtiText($text)
- Exclude checks
Consider putting global function "cleanAttribute" in a static class Open
function cleanAttribute($text)
- Exclude checks
Method name "ImsAssessmentItem::start_item_body" is not in camel caps format Open
public function start_item_body()
- Exclude checks
Method name "ImsAssessmentItem::add_response_processing" is not in camel caps format Open
public function add_response_processing()
- Exclude checks
Method name "ImsItem::end_presentation" is not in camel caps format Open
public function end_presentation()
- Exclude checks
Consider putting global function "formatExerciseQtiDescription" in a static class Open
function formatExerciseQtiDescription($text)
- Exclude checks
Method name "ImsItem::start_item" is not in camel caps format Open
public function start_item()
- Exclude checks
Missing function doc comment Open
public function end_section()
- Exclude checks
Method name "ImsItem::start_processing" is not in camel caps format Open
public function start_processing()
- Exclude checks
Multiple classes defined in a single file Open
class ImsSection
- Exclude checks
Missing function doc comment Open
public function export_duration()
- Exclude checks
Variable "max_time" is not in valid camel caps format Open
$minutes = floor($max_time / 60);
- Exclude checks
Method name "ImsItem::end_item" is not in camel caps format Open
public function end_item()
- Exclude checks
Variable "max_time" is not in valid camel caps format Open
if ($max_time = $this->exercise->selectTimeLimit()) {
- Exclude checks
Consider putting global function "export_exercise_to_qti" in a static class Open
function export_exercise_to_qti($exerciseId, $standalone = true)
- Exclude checks
The variable $max_time is not named in camelCase. Open
public function export_duration()
{
if ($max_time = $this->exercise->selectTimeLimit()) {
// return exercise duration in ISO8601 format.
$minutes = floor($max_time / 60);
- 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 $max_time is not named in camelCase. Open
public function export_duration()
{
if ($max_time = $this->exercise->selectTimeLimit()) {
// return exercise duration in ISO8601 format.
$minutes = floor($max_time / 60);
- 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 $max_time is not named in camelCase. Open
public function export_duration()
{
if ($max_time = $this->exercise->selectTimeLimit()) {
// return exercise duration in ISO8601 format.
$minutes = floor($max_time / 60);
- 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 add_response_processing is not named in camelCase. Open
public function add_response_processing()
{
return ' <responseProcessing template="http://www.imsglobal.org/question/qti_v2p1/rptemplates/map_correct"/>'."\n";
}
- 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 end_item is not named in camelCase. Open
public function end_item()
{
return "</item>\n";
}
- 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 start_item_body is not named in camelCase. Open
public function start_item_body()
{
return ' <itemBody>'."\n";
}
- 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 end_item_body is not named in camelCase. Open
public function end_item_body()
{
return " </itemBody>\n";
}
- 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 start_section is not named in camelCase. Open
public function start_section()
{
return '<section
ident = "EXO_'.$this->exercise->getId().'"
title = "'.cleanAttribute(formatExerciseQtiDescription($this->exercise->selectTitle())).'"
- 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 end_section is not named in camelCase. Open
public function end_section()
{
return "</section>\n";
}
- 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 end_presentation is not named in camelCase. Open
public function end_presentation()
{
return "</flow></presentation>\n";
}
- 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 export_ordering is not named in camelCase. Open
public function export_ordering()
{
$out = '';
if ($n = $this->exercise->getShuffle()) {
$out .= '<selection_ordering>'
- 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 start_item is not named in camelCase. Open
public function start_item()
{
return '<item title="'.cleanAttribute(formatExerciseQtiDescription($this->question->selectTitle())).'" ident="'.$this->questionIdent.'">'."\n";
}
- 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 start_presentation is not named in camelCase. Open
public function start_presentation()
{
return '<presentation label="'.$this->questionIdent.'"><flow>'."\n"
.'<material><mattext>'.formatExerciseQtiDescription($this->question->selectDescription())."</mattext></material>\n";
}
- 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 export_duration is not named in camelCase. Open
public function export_duration()
{
if ($max_time = $this->exercise->selectTimeLimit()) {
// return exercise duration in ISO8601 format.
$minutes = floor($max_time / 60);
- 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 end_processing is not named in camelCase. Open
public function end_processing()
{
return "</resprocessing>\n";
}
- 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 start_item is not named in camelCase. Open
public function start_item()
{
$categoryTitle = '';
if (!empty($this->question->category)) {
$category = new TestCategory();
- 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 export_presentation is not named in camelCase. Open
public function export_presentation()
{
return "<presentation_material><flow_mat><material>\n"
.' <mattext><![CDATA['.formatExerciseQtiDescription($this->exercise->selectDescription())."]]></mattext>\n"
."</material></flow_mat></presentation_material>\n";
- 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 start_processing is not named in camelCase. Open
public function start_processing()
{
return '<resprocessing><outcomes><decvar vartype="Integer" defaultval="0" /></outcomes>'."\n";
}
- 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 end_item is not named in camelCase. Open
public function end_item()
{
return "</assessmentItem>\n";
}
- 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() {
}
}