chamilo/chamilo-lms

View on GitHub
public/main/lp/lp_ajax_save_objectives.php

Summary

Maintainability
A
0 mins
Test Coverage

Avoid unused local variables such as '$objective'.
Open

        foreach ($objectives as $index => $objective) {

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

The parameter $lp_id is not named in camelCase.
Open

function save_objectives($lp_id, $user_id, $view_id, $item_id, $objectives = [])
{
    $debug = 0;
    $return = '';
    if ($debug > 0) {

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

The parameter $item_id is not named in camelCase.
Open

function save_objectives($lp_id, $user_id, $view_id, $item_id, $objectives = [])
{
    $debug = 0;
    $return = '';
    if ($debug > 0) {

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

The parameter $view_id is not named in camelCase.
Open

function save_objectives($lp_id, $user_id, $view_id, $item_id, $objectives = [])
{
    $debug = 0;
    $return = '';
    if ($debug > 0) {

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

The parameter $user_id is not named in camelCase.
Open

function save_objectives($lp_id, $user_id, $view_id, $item_id, $objectives = [])
{
    $debug = 0;
    $return = '';
    if ($debug > 0) {

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

Missing parameter name
Open

 * @param   int Learnpath ID

Missing parameter name
Open

 * @param   array   Objectives array

Variable "item_id" is not in valid camel caps format
Open

function save_objectives($lp_id, $user_id, $view_id, $item_id, $objectives = [])

Variable "user_id" is not in valid camel caps format
Open

        error_log('In xajax_save_objectives('.$lp_id.','.$user_id.','.$view_id.','.$item_id.',"'.(count($objectives) > 0 ? count($objectives) : '').'")', 0);

Missing parameter name
Open

 * @param   int View ID

Variable "lp_id" is not in valid camel caps format
Open

function save_objectives($lp_id, $user_id, $view_id, $item_id, $objectives = [])

Variable "item_id" is not in valid camel caps format
Open

        error_log('In xajax_save_objectives('.$lp_id.','.$user_id.','.$view_id.','.$item_id.',"'.(count($objectives) > 0 ? count($objectives) : '').'")', 0);

Variable "view_id" is not in valid camel caps format
Open

function save_objectives($lp_id, $user_id, $view_id, $item_id, $objectives = [])

Variable "user_id" is not in valid camel caps format
Open

function save_objectives($lp_id, $user_id, $view_id, $item_id, $objectives = [])

Variable "lp_id" is not in valid camel caps format
Open

    $mylp = learnpath::getLpFromSession(api_get_course_int_id(), $lp_id, $user_id);

Consider putting global function "save_objectives" in a static class
Open

function save_objectives($lp_id, $user_id, $view_id, $item_id, $objectives = [])

Variable "lp_id" is not in valid camel caps format
Open

        error_log('In xajax_save_objectives('.$lp_id.','.$user_id.','.$view_id.','.$item_id.',"'.(count($objectives) > 0 ? count($objectives) : '').'")', 0);

Missing parameter name
Open

 * @param   int Item ID

Variable "use_anonymous" is not in valid camel caps format
Open

$use_anonymous = true;

Missing parameter name
Open

 * @param   int User ID

Variable "view_id" is not in valid camel caps format
Open

        error_log('In xajax_save_objectives('.$lp_id.','.$user_id.','.$view_id.','.$item_id.',"'.(count($objectives) > 0 ? count($objectives) : '').'")', 0);

Variable "user_id" is not in valid camel caps format
Open

    $mylp = learnpath::getLpFromSession(api_get_course_int_id(), $lp_id, $user_id);

Variable "item_id" is not in valid camel caps format
Open

    $mylpi = &$mylp->items[$item_id];

The variable $item_id is not named in camelCase.
Open

function save_objectives($lp_id, $user_id, $view_id, $item_id, $objectives = [])
{
    $debug = 0;
    $return = '';
    if ($debug > 0) {

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 $item_id is not named in camelCase.
Open

function save_objectives($lp_id, $user_id, $view_id, $item_id, $objectives = [])
{
    $debug = 0;
    $return = '';
    if ($debug > 0) {

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 $lp_id is not named in camelCase.
Open

function save_objectives($lp_id, $user_id, $view_id, $item_id, $objectives = [])
{
    $debug = 0;
    $return = '';
    if ($debug > 0) {

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_objectives($lp_id, $user_id, $view_id, $item_id, $objectives = [])
{
    $debug = 0;
    $return = '';
    if ($debug > 0) {

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 $lp_id is not named in camelCase.
Open

function save_objectives($lp_id, $user_id, $view_id, $item_id, $objectives = [])
{
    $debug = 0;
    $return = '';
    if ($debug > 0) {

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_objectives($lp_id, $user_id, $view_id, $item_id, $objectives = [])
{
    $debug = 0;
    $return = '';
    if ($debug > 0) {

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 $view_id is not named in camelCase.
Open

function save_objectives($lp_id, $user_id, $view_id, $item_id, $objectives = [])
{
    $debug = 0;
    $return = '';
    if ($debug > 0) {

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

There are no issues that match your filters.

Category
Status