The method return_form() has an NPath complexity of 3264. The configured NPath complexity threshold is 200. Open
public function return_form($url, $action)
{
$form = new FormValidator('grades', 'post', $url);
// Setting the form elements
- 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
Missing class import via use statement (line '242', column '28'). Open
$obj = new GradeModelComponents();
- 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 '74', column '21'). Open
$form = new FormValidator('grades', 'post', $url);
- 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 '222', column '32'). Open
$obj = new GradeModelComponents();
- 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 '202', column '20'). Open
$obj = new GradeModelComponents();
- 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 update uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$obj->update($component);
}
- 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 return_form uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$form->addButtonCreate(get_lang('Add'));
}
- 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 fill_grade_model_select_in_form uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$default = $default_platform_setting;
}
- 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 $default_value is not named in camelCase. Open
public function fill_grade_model_select_in_form(&$form, $name = 'gradebook_model_id', ?int $default_value = null)
{
if ('false' === api_get_setting('gradebook_enable_grade_model')) {
return false;
}
- 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
Each class must be in a file by itself Open
class GradeModelComponents extends Model
- Exclude checks
Method name "GradeModel::get_count" is not in camel caps format Open
public function get_count()
- Exclude checks
Variable "nr_items" is not in valid camel caps format Open
$nr_items = 2;
- Exclude checks
Method name "GradeModel::return_form" is not in camel caps format Open
public function return_form($url, $action)
- Exclude checks
Method name "GradeModel::get_all" is not in camel caps format Open
public function get_all(array $options = []): array
- Exclude checks
Missing function doc comment Open
public function get_all(array $options = []): array
- Exclude checks
Variable "nr_items" is not in valid camel caps format Open
$nr_items = count($components);
- Exclude checks
Method name "GradeModel::get_components" is not in camel caps format Open
public function get_components($id)
- Exclude checks
Variable "default_value" is not in valid camel caps format Open
if (!empty($default_value)) {
- Exclude checks
Expected 1 spaces after parameter type; 3 found Open
* @param int|null $default_value
- Exclude checks
Variable "grade_model_options" is not in valid camel caps format Open
$grade_model_options = ['-1' => get_lang('none')];
- Exclude checks
Variable "component_array" is not in valid camel caps format Open
$component_array = [];
- Exclude checks
Variable "template_acronym" is not in valid camel caps format Open
$template_acronym = '
- Exclude checks
Variable "template_acronym" is not in valid camel caps format Open
$renderer->setElementTemplate($template_acronym, 'components['.$i.'][acronym]');
- Exclude checks
Variable "grade_models" is not in valid camel caps format Open
foreach ($grade_models as $item) {
- Exclude checks
Variable "component_array" is not in valid camel caps format Open
$form->addRule($component_array, get_lang('The sum of all values must be 100'), 'compare_fields', '==@100');
- Exclude checks
Variable "default_value" is not in valid camel caps format Open
public function fill_grade_model_select_in_form(&$form, $name = 'gradebook_model_id', ?int $default_value = null)
- Exclude checks
Variable "grade_models" is not in valid camel caps format Open
if (!empty($grade_models)) {
- Exclude checks
Variable "default_value" is not in valid camel caps format Open
$default = $default_value;
- Exclude checks
Variable "grade_model_options" is not in valid camel caps format Open
$grade_model_options[$item['id']] = $item['title'];
- Exclude checks
Variable "default_platform_setting" is not in valid camel caps format Open
$default = $default_platform_setting;
- Exclude checks
Variable "template_title" is not in valid camel caps format Open
$template_title =
- Exclude checks
Variable "nr_items" is not in valid camel caps format Open
'.Display::return_icon('delete.png', get_lang('Delete'), ['id' => 'min-'.($counter), 'style' => 'display: '.(($counter >= $nr_items) ? 'inline' : 'none')]).'
- Exclude checks
Missing parameter name Open
* @param $form
- Exclude checks
Variable "nr_items" is not in valid camel caps format Open
'.Display::return_icon('add.png', get_lang('Add'), ['id' => 'plus-'.($counter + 1), 'style' => 'display: '.(($counter >= $nr_items) ? 'inline' : 'none')]).'
- Exclude checks
Expected 3 spaces after parameter type; 1 found Open
* @param string $name
- Exclude checks
Variable "grade_models" is not in valid camel caps format Open
$grade_models = $this->get_all();
- Exclude checks
Variable "template_percentage" is not in valid camel caps format Open
$template_percentage =
- Exclude checks
Method name "GradeModel::fill_grade_model_select_in_form" is not in camel caps format Open
public function fill_grade_model_select_in_form(&$form, $name = 'gradebook_model_id', ?int $default_value = null)
- Exclude checks
Variable "template_percentage" is not in valid camel caps format Open
$renderer->setElementTemplate($template_percentage, 'components['.$i.'][percentage]');
- Exclude checks
Missing parameter name Open
* @param $id
- Exclude checks
Variable "default_platform_setting" is not in valid camel caps format Open
$default_platform_setting = api_get_setting('gradebook_default_grade_model_id');
- Exclude checks
Variable "nr_items" is not in valid camel caps format Open
'<div id='.$i.' style="display: '.(($i <= $nr_items) ? 'inline' : 'none').';" class="form-group">
- Exclude checks
Variable "template_title" is not in valid camel caps format Open
$renderer->setElementTemplate($template_title, 'components['.$i.'][title]');
- Exclude checks
Multiple classes defined in a single file Open
class GradeModelComponents extends Model
- Exclude checks
Variable "component_array" is not in valid camel caps format Open
$component_array[] = 'components['.$i.'][percentage]';
- Exclude checks
Variable "grade_model_options" is not in valid camel caps format Open
$form->addSelect($name, get_lang('Grading model'), $grade_model_options);
- Exclude checks
Variable "default_platform_setting" is not in valid camel caps format Open
if (-1 == $default_platform_setting) {
- Exclude checks
The variable $component_array is not named in camelCase. Open
public function return_form($url, $action)
{
$form = new FormValidator('grades', 'post', $url);
// Setting the form elements
- 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 $template_percentage is not named in camelCase. Open
public function return_form($url, $action)
{
$form = new FormValidator('grades', 'post', $url);
// Setting the form elements
- 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 $component_array is not named in camelCase. Open
public function return_form($url, $action)
{
$form = new FormValidator('grades', 'post', $url);
// Setting the form elements
- 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 $default_platform_setting is not named in camelCase. Open
public function fill_grade_model_select_in_form(&$form, $name = 'gradebook_model_id', ?int $default_value = null)
{
if ('false' === api_get_setting('gradebook_enable_grade_model')) {
return false;
}
- 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 $grade_models is not named in camelCase. Open
public function fill_grade_model_select_in_form(&$form, $name = 'gradebook_model_id', ?int $default_value = null)
{
if ('false' === api_get_setting('gradebook_enable_grade_model')) {
return false;
}
- 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 $default_value is not named in camelCase. Open
public function fill_grade_model_select_in_form(&$form, $name = 'gradebook_model_id', ?int $default_value = null)
{
if ('false' === api_get_setting('gradebook_enable_grade_model')) {
return false;
}
- 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 $component_array is not named in camelCase. Open
public function return_form($url, $action)
{
$form = new FormValidator('grades', 'post', $url);
// Setting the form elements
- 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 $grade_models is not named in camelCase. Open
public function fill_grade_model_select_in_form(&$form, $name = 'gradebook_model_id', ?int $default_value = null)
{
if ('false' === api_get_setting('gradebook_enable_grade_model')) {
return false;
}
- 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 $grade_model_options is not named in camelCase. Open
public function fill_grade_model_select_in_form(&$form, $name = 'gradebook_model_id', ?int $default_value = null)
{
if ('false' === api_get_setting('gradebook_enable_grade_model')) {
return false;
}
- 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 $default_platform_setting is not named in camelCase. Open
public function fill_grade_model_select_in_form(&$form, $name = 'gradebook_model_id', ?int $default_value = null)
{
if ('false' === api_get_setting('gradebook_enable_grade_model')) {
return false;
}
- 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 $nr_items is not named in camelCase. Open
public function return_form($url, $action)
{
$form = new FormValidator('grades', 'post', $url);
// Setting the form elements
- 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 $default_value is not named in camelCase. Open
public function fill_grade_model_select_in_form(&$form, $name = 'gradebook_model_id', ?int $default_value = null)
{
if ('false' === api_get_setting('gradebook_enable_grade_model')) {
return false;
}
- 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 $default_platform_setting is not named in camelCase. Open
public function fill_grade_model_select_in_form(&$form, $name = 'gradebook_model_id', ?int $default_value = null)
{
if ('false' === api_get_setting('gradebook_enable_grade_model')) {
return false;
}
- 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 $grade_model_options is not named in camelCase. Open
public function fill_grade_model_select_in_form(&$form, $name = 'gradebook_model_id', ?int $default_value = null)
{
if ('false' === api_get_setting('gradebook_enable_grade_model')) {
return false;
}
- 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 $nr_items is not named in camelCase. Open
public function return_form($url, $action)
{
$form = new FormValidator('grades', 'post', $url);
// Setting the form elements
- 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 $nr_items is not named in camelCase. Open
public function return_form($url, $action)
{
$form = new FormValidator('grades', 'post', $url);
// Setting the form elements
- 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 $template_acronym is not named in camelCase. Open
public function return_form($url, $action)
{
$form = new FormValidator('grades', 'post', $url);
// Setting the form elements
- 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 $template_acronym is not named in camelCase. Open
public function return_form($url, $action)
{
$form = new FormValidator('grades', 'post', $url);
// Setting the form elements
- 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 $grade_models is not named in camelCase. Open
public function fill_grade_model_select_in_form(&$form, $name = 'gradebook_model_id', ?int $default_value = null)
{
if ('false' === api_get_setting('gradebook_enable_grade_model')) {
return false;
}
- 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 $nr_items is not named in camelCase. Open
public function return_form($url, $action)
{
$form = new FormValidator('grades', 'post', $url);
// Setting the form elements
- 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 $nr_items is not named in camelCase. Open
public function return_form($url, $action)
{
$form = new FormValidator('grades', 'post', $url);
// Setting the form elements
- 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 $template_percentage is not named in camelCase. Open
public function return_form($url, $action)
{
$form = new FormValidator('grades', 'post', $url);
// Setting the form elements
- 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 $template_title is not named in camelCase. Open
public function return_form($url, $action)
{
$form = new FormValidator('grades', 'post', $url);
// Setting the form elements
- 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 $template_title is not named in camelCase. Open
public function return_form($url, $action)
{
$form = new FormValidator('grades', 'post', $url);
// Setting the form elements
- 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 $grade_model_options is not named in camelCase. Open
public function fill_grade_model_select_in_form(&$form, $name = 'gradebook_model_id', ?int $default_value = null)
{
if ('false' === api_get_setting('gradebook_enable_grade_model')) {
return false;
}
- 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 get_all is not named in camelCase. Open
public function get_all(array $options = []): array
{
return Database::select(
'*',
$this->table,
- 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 fill_grade_model_select_in_form is not named in camelCase. Open
public function fill_grade_model_select_in_form(&$form, $name = 'gradebook_model_id', ?int $default_value = null)
{
if ('false' === api_get_setting('gradebook_enable_grade_model')) {
return false;
}
- 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 get_components is not named in camelCase. Open
public function get_components($id)
{
$obj = new GradeModelComponents();
if (!empty($id)) {
return $obj->get_all(['where' => ['grade_model_id = ?' => $id]]);
- 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 get_count is not named in camelCase. Open
public function get_count()
{
$row = Database::select(
'count(*) as count',
$this->table,
- 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 return_form is not named in camelCase. Open
public function return_form($url, $action)
{
$form = new FormValidator('grades', 'post', $url);
// Setting the form elements
- 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() {
}
}