mambax7/cardealer

View on GitHub
class/Form/WorkorderForm.php

Summary

Maintainability
A
1 hr
Test Coverage

Method __construct has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function __construct($target)
    {
        global $helper;
        $this->targetObject = $target;

Severity: Minor
Found in class/Form/WorkorderForm.php - About 1 hr to fix

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

            $hidden = new \XoopsFormHidden('id', $this->targetObject->getVar('id'));
    Severity: Minor
    Found in class/Form/WorkorderForm.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

    Missing class import via use statement (line '64', column '31').
    Open

            $this->addElement(new \XoopsFormLabel(AM_CARDEALER_WORKORDER_ID, $this->targetObject->getVar('id'), 'id'));
    Severity: Minor
    Found in class/Form/WorkorderForm.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

    Missing class import via use statement (line '70', column '35').
    Open

            $customer_id_select = new \XoopsFormSelect(AM_CARDEALER_WORKORDER_CUSTNUM, 'custnum', $this->targetObject->getVar('custnum'));
    Severity: Minor
    Found in class/Form/WorkorderForm.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

    Missing class import via use statement (line '84', column '31').
    Open

            $this->addElement(new \XoopsFormTextDateSelect(AM_CARDEALER_WORKORDER_ORDERDATE, 'orderdate', '', strtotime($this->targetObject->getVar('orderdate'))));
    Severity: Minor
    Found in class/Form/WorkorderForm.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

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

            $vehicle_id_select = new \XoopsFormSelect(AM_CARDEALER_WORKORDER_CARNUM, 'carnum', $this->targetObject->getVar('carnum'));
    Severity: Minor
    Found in class/Form/WorkorderForm.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

    Missing class import via use statement (line '91', column '31').
    Open

            $this->addElement(new \XoopsFormHidden('op', 'save'));
    Severity: Minor
    Found in class/Form/WorkorderForm.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

    Missing class import via use statement (line '82', column '31').
    Open

            $this->addElement(new \XoopsFormText(AM_CARDEALER_WORKORDER_COST, 'cost', 50, 255, $this->targetObject->getVar('cost')), false);
    Severity: Minor
    Found in class/Form/WorkorderForm.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

    Missing class import via use statement (line '87', column '29').
    Open

            $check_status = new \XoopsFormCheckBox(AM_CARDEALER_WORKORDER_STATUS, 'status', $status);
    Severity: Minor
    Found in class/Form/WorkorderForm.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

    Missing class import via use statement (line '92', column '31').
    Open

            $this->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
    Severity: Minor
    Found in class/Form/WorkorderForm.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

    Avoid using static access to class '\XoopsDatabaseFactory' in method '__construct'.
    Open

            $db = \XoopsDatabaseFactory::getDatabaseConnection();
    Severity: Minor
    Found in class/Form/WorkorderForm.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

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

    Avoid using static access to class '\XoopsDatabaseFactory' in method '__construct'.
    Open

            $db = \XoopsDatabaseFactory::getDatabaseConnection();
    Severity: Minor
    Found in class/Form/WorkorderForm.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

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

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

            global $helper;
    Severity: Minor
    Found in class/Form/WorkorderForm.php by phpmd

    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

    A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 39 and the first side effect is on line 28.
    Open

    <?php namespace XoopsModules\Cardealer\Form;
    Severity: Minor
    Found in class/Form/WorkorderForm.php by phpcodesniffer

    Avoid variables with short names like $db. Configured minimum length is 3.
    Open

            $db = \XoopsDatabaseFactory::getDatabaseConnection();
    Severity: Minor
    Found in class/Form/WorkorderForm.php by phpmd

    ShortVariable

    Since: 0.2

    Detects when a field, local, or parameter has a very short name.

    Example

    class Something {
        private $q = 15; // VIOLATION - Field
        public static function main( array $as ) { // VIOLATION - Formal
            $r = 20 + $this->q; // VIOLATION - Local
            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                $r += $this->q;
            }
        }
    }

    Source https://phpmd.org/rules/naming.html#shortvariable

    Line exceeds 120 characters; contains 136 characters
    Open

            $this->addElement(new \XoopsFormText(AM_CARDEALER_WORKORDER_COST, 'cost', 50, 255, $this->targetObject->getVar('cost')), false);
    Severity: Minor
    Found in class/Form/WorkorderForm.php by phpcodesniffer

    Line exceeds 120 characters; contains 134 characters
    Open

            $customer_id_select = new \XoopsFormSelect(AM_CARDEALER_WORKORDER_CUSTNUM, 'custnum', $this->targetObject->getVar('custnum'));
    Severity: Minor
    Found in class/Form/WorkorderForm.php by phpcodesniffer

    Line exceeds 120 characters; contains 130 characters
    Open

            $vehicle_id_select = new \XoopsFormSelect(AM_CARDEALER_WORKORDER_CARNUM, 'carnum', $this->targetObject->getVar('carnum'));
    Severity: Minor
    Found in class/Form/WorkorderForm.php by phpcodesniffer

    Line exceeds 120 characters; contains 160 characters
    Open

            $this->addElement(new \XoopsFormTextDateSelect(AM_CARDEALER_WORKORDER_ORDERDATE, 'orderdate', '', strtotime($this->targetObject->getVar('orderdate'))));
    Severity: Minor
    Found in class/Form/WorkorderForm.php by phpcodesniffer

    Line exceeds 120 characters; contains 123 characters
    Open

            $title = $this->targetObject->isNew() ? sprintf(AM_CARDEALER_WORKORDER_ADD) : sprintf(AM_CARDEALER_WORKORDER_EDIT);
    Severity: Minor
    Found in class/Form/WorkorderForm.php by phpcodesniffer

    The variable $customer_id_select is not named in camelCase.
    Open

        public function __construct($target)
        {
            global $helper;
            $this->targetObject = $target;
    
    
    Severity: Minor
    Found in class/Form/WorkorderForm.php by phpmd

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

        public function __construct($target)
        {
            global $helper;
            $this->targetObject = $target;
    
    
    Severity: Minor
    Found in class/Form/WorkorderForm.php by phpmd

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

        public function __construct($target)
        {
            global $helper;
            $this->targetObject = $target;
    
    
    Severity: Minor
    Found in class/Form/WorkorderForm.php by phpmd

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

        public function __construct($target)
        {
            global $helper;
            $this->targetObject = $target;
    
    
    Severity: Minor
    Found in class/Form/WorkorderForm.php by phpmd

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

        public function __construct($target)
        {
            global $helper;
            $this->targetObject = $target;
    
    
    Severity: Minor
    Found in class/Form/WorkorderForm.php by phpmd

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

        public function __construct($target)
        {
            global $helper;
            $this->targetObject = $target;
    
    
    Severity: Minor
    Found in class/Form/WorkorderForm.php by phpmd

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

        public function __construct($target)
        {
            global $helper;
            $this->targetObject = $target;
    
    
    Severity: Minor
    Found in class/Form/WorkorderForm.php by phpmd

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

        public function __construct($target)
        {
            global $helper;
            $this->targetObject = $target;
    
    
    Severity: Minor
    Found in class/Form/WorkorderForm.php by phpmd

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

        public function __construct($target)
        {
            global $helper;
            $this->targetObject = $target;
    
    
    Severity: Minor
    Found in class/Form/WorkorderForm.php by phpmd

    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