YetiForceCompany/YetiForceCRM

View on GitHub
modules/Import/readers/ICSReader.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

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

    public function getFirstRowData($hasHeader = true)
Severity: Minor
Found in modules/Import/readers/ICSReader.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

Remove the unused function parameter "$hasHeader".
Open

    public function getFirstRowData($hasHeader = true)

Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.

Noncompliant Code Example

function doSomething($a, $b) { // "$a" is unused
  return compute($b);
}

Compliant Solution

function doSomething($b) {
  return compute($b);
}

Exceptions

Functions in classes that override a class or implement interfaces are ignored.

class C extends B {

  function doSomething($a, $b) {     // no issue reported on $b
    compute($a);
  }

}

See

  • MISRA C++:2008, 0-1-11 - There shall be no unused parameters (named or unnamed) in nonvirtual functions.
  • MISRA C:2012, 2.7 - There should be no unused parameters in functions
  • CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
  • CERT, MSC12-CPP. - Detect and remove code that has no effect

Avoid unused parameters such as '$hasHeader'.
Open

    public function getFirstRowData($hasHeader = true)
Severity: Minor
Found in modules/Import/readers/ICSReader.php by phpmd

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
    private function bar($howdy)
    {
        // $howdy is not used
    }
}

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

Saw unextractable annotation for comment '* @return <boolean>'</boolean>
Open

     * @return <boolean>
Severity: Info
Found in modules/Import/readers/ICSReader.php by phan

Saw unextractable annotation for comment '* @param <boolean> $hasHeader'</boolean>
Open

     * @param <boolean> $hasHeader
Severity: Info
Found in modules/Import/readers/ICSReader.php by phan

Saw unextractable annotation for comment '* @return <boolean>'</boolean>
Open

     * @return <boolean>
Severity: Info
Found in modules/Import/readers/ICSReader.php by phan

Each class must be in a namespace of at least one level (a top-level vendor name)
Open

class Import_ICSReader_Reader

The class Import_ICSReader_Reader is not named in CamelCase.
Open

class Import_ICSReader_Reader
{
    /**
     * Function to get info about imported file contains header or not.
     *
Severity: Minor
Found in modules/Import/readers/ICSReader.php by phpmd

CamelCaseClassName

Since: 0.2

It is considered best practice to use the CamelCase notation to name classes.

Example

class class_name {
}

Source

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

     * Function to get info about imported file contains First Row or not.

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return <boolean>

Spaces must be used to indent lines; tabs are not allowed
Open

        return true;

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

    public function getFirstRowData($hasHeader = true)

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param <boolean> $hasHeader

Spaces must be used to indent lines; tabs are not allowed
Open

     * Function to get info about imported file contains header or not.

Spaces must be used to indent lines; tabs are not allowed
Open

    {

Spaces must be used to indent lines; tabs are not allowed
Open

        return true;

Spaces must be used to indent lines; tabs are not allowed
Open

    public function hasHeader()

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return <boolean>

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Class name "Import_ICSReader_Reader" is not in camel caps format
Open

class Import_ICSReader_Reader

There are no issues that match your filters.

Category
Status