chamilo/chamilo-lms

View on GitHub
public/main/inc/lib/search/xapian/XapianIndexer.class.php

Summary

Maintainability
A
0 mins
Test Coverage

Missing class import via use statement (line '95', column '34').
Open

            $this->stemmer = new XapianStem($lang);

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 '136', column '32').
Open

                    $doc = new XapianDocument();

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 '89', column '29').
Open

            $this->db = new XapianWritableDatabase($path, $dbMode);

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 '90', column '34').
Open

            $this->indexer = new XapianTermGenerator();

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

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

                        foreach ($chunk->data as $key => $value) {

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

FIXME found
Open

                            /* FIXME: think of getting weight */

Method name "XapianIndexer::xapian_languages" is not in camel caps format
Open

    final public function xapian_languages()

Method name "XapianIndexer::replace_document" is not in camel caps format
Open

    public function replace_document($doc, $did)

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

            return $doc_data;

Missing parameter name
Open

     * @param  string  Chunk of text

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

            $doc_data = $doc->get_data();

Method name "XapianIndexer::add_term_to_doc" is not in camel caps format
Open

    public function add_term_to_doc($term, $doc)

Method name "XapianIndexer::get_document_data" is not in camel caps format
Open

    public function get_document_data($doc)

Method name "XapianIndexer::remove_term_from_doc" is not in camel caps format
Open

    public function remove_term_from_doc($term, $doc)

Method name "XapianIndexer::remove_document" is not in camel caps format
Open

    public function remove_document($did)

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

                    $doc->set_data($chunk->xapian_data, 1);

Method name "XapianIndexer::update_terms" is not in camel caps format
Open

    public function update_terms($did, $terms, $prefix)

Abstract class name is not prefixed with "Abstract"
Open

abstract class XapianIndexer

Missing parameter name
Open

     * @param int   did     Xapian::docid

Missing parameter name
Open

     * @param   int     did     Xapian::docid

Method name "XapianIndexer::get_document" is not in camel caps format
Open

    public function get_document($did)

The variable $doc_data is not named in camelCase.
Open

    public function get_document_data($doc)
    {
        if (null == $this->db) {
            $this->connectDb();
        }

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

    public function get_document_data($doc)
    {
        if (null == $this->db) {
            $this->connectDb();
        }

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

    final public function xapian_languages()
    {
        /* http://xapian.org/docs/apidoc/html/classXapian_1_1Stem.html */
        return [
            'none' => 'none', //don't stem terms

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

    public function remove_document($did)
    {
        if (null == $this->db) {
            $this->connectDb();
        }

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

    public function get_document($did)
    {
        if (null == $this->db) {
            $this->connectDb();
        }

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

    public function get_document_data($doc)
    {
        if (null == $this->db) {
            $this->connectDb();
        }

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

    public function add_term_to_doc($term, $doc)
    {
        if (!is_a($doc, 'XapianDocument')) {
            return false;
        }

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

    public function update_terms($did, $terms, $prefix)
    {
        $doc = $this->get_document($did);
        if (false === $doc) {
            return false;

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

    public function remove_term_from_doc($term, $doc)
    {
        if (!is_a($doc, 'XapianDocument')) {
            return false;
        }

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

    public function replace_document($doc, $did)
    {
        if (!is_a($doc, 'XapianDocument')) {
            return false;
        }

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

There are no issues that match your filters.

Category
Status