mathieupetrini/doctrinedatatable

View on GitHub

Showing 50 of 50 total issues

The property $final_query is not named in camelCase.
Open

class Datatable
{
    /**
     * @var string
     */
Severity: Minor
Found in src/DoctrineDatatable/Datatable.php by phpmd

CamelCasePropertyName

Since: 0.2

It is considered best practice to use the camelCase notation to name attributes.

Example

class ClassName {
    protected $property_name;
}

Source

Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function __construct(string $alias, string $name, $where = '', $resolve = '', string $aliasOrderby = null)
Severity: Minor
Found in src/DoctrineDatatable/Column.php - About 35 mins to fix

    Function calculTotaux has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        private function calculTotaux(): array
        {
            $query = clone $this->final_query;
    
            $query->resetDQLPart('orderBy');
    Severity: Minor
    Found in src/DoctrineDatatable/DatatableWithTotal.php - About 35 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function processRowEditing has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        private function processRowEditing(object $entity, array $data): array
        {
            $entities = array();
            foreach ($data as $field => $value) {
                $property = $this->processValue($entity, $field, $value);
    Severity: Minor
    Found in src/DoctrineDatatable/Editortable.php - About 35 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    The method processColumnIdentifier has a boolean flag argument $withAlias, which is a certain sign of a Single Responsibility Principle violation.
    Open

        private function processColumnIdentifier(bool $withAlias = true): string
    Severity: Minor
    Found in src/DoctrineDatatable/Datatable.php by phpmd

    BooleanArgumentFlag

    Since: 1.4.0

    A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

    Example

    class Foo {
        public function bar($flag = true) {
        }
    }

    Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

    Missing class import via use statement (line '23', column '24').
    Open

            $method = (new \ReflectionClass($obj))->getMethod($name);
    Severity: Minor
    Found in src/DoctrineDatatable/Tools.php by phpmd

    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

    Function setGlobalSearch has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function setGlobalSearch(bool $globalSearch): self
        {
            $this->globalSearch = $globalSearch;
            if ($this->globalSearch) {
                foreach ($this->columns as $column) {
    Severity: Minor
    Found in src/DoctrineDatatable/Datatable.php - About 25 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Whitespace found at end of line
    Open

                );   

    Call to method setFirstResult from undeclared class \Doctrine\ORM\QueryBuilder
    Open

            $this->final_query->setFirstResult($filters['start'] ?? 0)
    Severity: Critical
    Found in src/DoctrineDatatable/Datatable.php by phan

    Call to method resetDQLPart from undeclared class \Doctrine\ORM\QueryBuilder
    Open

            $query->resetDQLPart('orderBy');

    Parameter $query has undeclared type \Doctrine\ORM\QueryBuilder
    Open

        private function setParameter(QueryBuilder &$query, string $data): void
    Severity: Minor
    Found in src/DoctrineDatatable/Column.php by phan

    Call to method getRootAliases from undeclared class \Doctrine\ORM\QueryBuilder
    Open

            return $this->final_query->getRootAliases()[0].'.'.$this->identifier.($withAlias ? ' AS '.$this->nameIdentifier : '');
    Severity: Critical
    Found in src/DoctrineDatatable/Datatable.php by phan

    Call to method select from undeclared class \Doctrine\ORM\QueryBuilder
    Open

            $result = $query->select('COUNT(DISTINCT '.$this->processColumnIdentifier(false).') as count')
    Severity: Critical
    Found in src/DoctrineDatatable/Datatable.php by phan

    Call to method select from undeclared class \Doctrine\ORM\QueryBuilder
    Open

            $this->final_query->select($this->processColumnIdentifier());
    Severity: Critical
    Found in src/DoctrineDatatable/Datatable.php by phan

    @throws type of edit has undeclared type \Doctrine\ORM\ORMException
    Open

        public function edit(array $params): array
    Severity: Minor
    Found in src/DoctrineDatatable/Editortable.php by phan

    @throws type of edit has undeclared type \Doctrine\ORM\OptimisticLockException
    Open

        public function edit(array $params): array
    Severity: Minor
    Found in src/DoctrineDatatable/Editortable.php by phan

    Call to method getQuery from undeclared class \Doctrine\ORM\QueryBuilder
    Open

            foreach ($this->datatable->createFinalQuery(array(
    Severity: Critical
    Found in src/DoctrineDatatable/Export.php by phan

    Parameter $query has undeclared type \Doctrine\ORM\QueryBuilder
    Open

        public function where(QueryBuilder &$query, $data): string
    Severity: Minor
    Found in src/DoctrineDatatable/Column.php by phan

    Property \DoctrineDatatable\Datatable->query has undeclared type \Doctrine\ORM\QueryBuilder
    Open

        protected $query;
    Severity: Minor
    Found in src/DoctrineDatatable/Datatable.php by phan

    Property \DoctrineDatatable\Column->where has undeclared type \Doctrine\ORM\Query\Expr
    Open

        private $where;
    Severity: Minor
    Found in src/DoctrineDatatable/Column.php by phan
    Severity
    Category
    Status
    Source
    Language