chamilo/chamilo-lms

View on GitHub
public/main/inc/lib/search/ChamiloQuery.php

Summary

Maintainability
A
0 mins
Test Coverage

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

    list($count, $results) = xapian_query($query_string, null, $offset, $length, $extra);

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

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

        foreach ($results as $key => $row) {

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

function chamilo_query_query($query_string, $offset = 0, $length = 10, $extra = null)
{
    list($count, $results) = xapian_query($query_string, null, $offset, $length, $extra);

    return chamilo_preprocess_results($results);

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

function chamilo_query_simple_query($query_string, $offset = 0, $length = 10, $extra = null)
{
    return xapian_query($query_string, null, $offset, $length, $extra);
}

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 "tool_processor_path" is not in valid camel caps format
Open

            if (file_exists($tool_processor_path)) {

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

        return [count($processed_results), $processed_results];

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

            $results_by_tool[$row['toolid']][] = $row;

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

                require_once $tool_processor_path;

Expected 51 spaces after parameter type; 4 found
Open

 * @param int    $offset       Offset to the first item to retrieve. Optional

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

function chamilo_preprocess_results($results)

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

                $tool_processor = new $tool_processor_class($rows);

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

                $processed_results = array_merge($tool_processor->process(), $processed_results);

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

                $processed_results = array_merge($tool_processor->process(), $processed_results);

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

    list($count, $results) = xapian_query($query_string, null, $offset, $length, $extra);

Expected 48 spaces after parameter type; 1 found
Open

 * @param string $query_string The search string

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

function chamilo_query_query($query_string, $offset = 0, $length = 10, $extra = null)

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

function chamilo_query_simple_query($query_string, $offset = 0, $length = 10, $extra = null)

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

    $results_by_tool = [];

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

            $tool_processor_path = api_get_path(LIBRARY_PATH).'search/tool_processors/'.$tool_processor_class.'.class.php';

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

                $processed_results = array_merge($tool_processor->process(), $processed_results);

Missing parameter name
Open

 * @param   array     extra           Extra queries to join with. Optional

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

function chamilo_query_simple_query($query_string, $offset = 0, $length = 10, $extra = null)

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

        foreach ($results_by_tool as $toolid => $rows) {

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

        $processed_results = [];

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

        return [count($processed_results), $processed_results];

Missing function doc comment
Open

function chamilo_query_simple_query($query_string, $offset = 0, $length = 10, $extra = null)

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

    return xapian_query($query_string, null, $offset, $length, $extra);

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

            $tool_processor_class = $toolid.'_processor';

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

            $tool_processor_path = api_get_path(LIBRARY_PATH).'search/tool_processors/'.$tool_processor_class.'.class.php';

Missing parameter name
Open

 * @param   int       length          Number of items to retrieve. Optional

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

function chamilo_get_boolean_query($term)

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

                $tool_processor = new $tool_processor_class($rows);

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

function chamilo_query_query($query_string, $offset = 0, $length = 10, $extra = null)

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

function chamilo_join_queries($query1, $query2 = null, $op = 'or')

The variable $processed_results is not named in camelCase.
Open

function chamilo_preprocess_results($results)
{
    // group by toolid
    $results_by_tool = [];
    if (count($results) > 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 $results_by_tool is not named in camelCase.
Open

function chamilo_preprocess_results($results)
{
    // group by toolid
    $results_by_tool = [];
    if (count($results) > 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 $query_string is not named in camelCase.
Open

function chamilo_query_query($query_string, $offset = 0, $length = 10, $extra = null)
{
    list($count, $results) = xapian_query($query_string, null, $offset, $length, $extra);

    return chamilo_preprocess_results($results);

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

function chamilo_preprocess_results($results)
{
    // group by toolid
    $results_by_tool = [];
    if (count($results) > 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 $tool_processor_path is not named in camelCase.
Open

function chamilo_preprocess_results($results)
{
    // group by toolid
    $results_by_tool = [];
    if (count($results) > 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 $tool_processor is not named in camelCase.
Open

function chamilo_preprocess_results($results)
{
    // group by toolid
    $results_by_tool = [];
    if (count($results) > 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 $processed_results is not named in camelCase.
Open

function chamilo_preprocess_results($results)
{
    // group by toolid
    $results_by_tool = [];
    if (count($results) > 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 $processed_results is not named in camelCase.
Open

function chamilo_preprocess_results($results)
{
    // group by toolid
    $results_by_tool = [];
    if (count($results) > 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 $tool_processor_path is not named in camelCase.
Open

function chamilo_preprocess_results($results)
{
    // group by toolid
    $results_by_tool = [];
    if (count($results) > 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 $processed_results is not named in camelCase.
Open

function chamilo_preprocess_results($results)
{
    // group by toolid
    $results_by_tool = [];
    if (count($results) > 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 $processed_results is not named in camelCase.
Open

function chamilo_preprocess_results($results)
{
    // group by toolid
    $results_by_tool = [];
    if (count($results) > 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 $results_by_tool is not named in camelCase.
Open

function chamilo_preprocess_results($results)
{
    // group by toolid
    $results_by_tool = [];
    if (count($results) > 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 $tool_processor_class is not named in camelCase.
Open

function chamilo_preprocess_results($results)
{
    // group by toolid
    $results_by_tool = [];
    if (count($results) > 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 $tool_processor_path is not named in camelCase.
Open

function chamilo_preprocess_results($results)
{
    // group by toolid
    $results_by_tool = [];
    if (count($results) > 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 $tool_processor is not named in camelCase.
Open

function chamilo_preprocess_results($results)
{
    // group by toolid
    $results_by_tool = [];
    if (count($results) > 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 $results_by_tool is not named in camelCase.
Open

function chamilo_preprocess_results($results)
{
    // group by toolid
    $results_by_tool = [];
    if (count($results) > 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 $tool_processor_class is not named in camelCase.
Open

function chamilo_preprocess_results($results)
{
    // group by toolid
    $results_by_tool = [];
    if (count($results) > 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 $query_string is not named in camelCase.
Open

function chamilo_query_simple_query($query_string, $offset = 0, $length = 10, $extra = null)
{
    return xapian_query($query_string, null, $offset, $length, $extra);
}

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