lovata/oc-toolbox-plugin

View on GitHub
classes/event/AbstractModelRelationHandler.php

Summary

Maintainability
A
1 hr
Test Coverage

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

    public function subscribe()
    {
        $sModelClass = $this->getModelClass();

        $sModelClass::extend(function ($obModel) {
Severity: Minor
Found in classes/event/AbstractModelRelationHandler.php - About 1 hr to fix

    Avoid unused parameters such as '$arInsertData'.
    Open

        protected function afterAttach($obModel, $arAttachedIDList, $arInsertData)

    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

    Avoid unused parameters such as '$obModel'.
    Open

        protected function afterAttach($obModel, $arAttachedIDList, $arInsertData)

    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

    Avoid unused parameters such as '$obModel'.
    Open

        protected function afterDetach($obModel, $arAttachedIDList)

    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

    Avoid unused parameters such as '$arAttachedIDList'.
    Open

        protected function afterDetach($obModel, $arAttachedIDList)

    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

    Avoid unused parameters such as '$arAttachedIDList'.
    Open

        protected function afterAttach($obModel, $arAttachedIDList, $arInsertData)

    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

    Remove the unused function parameter "$arAttachedIDList".
    Open

        protected function afterAttach($obModel, $arAttachedIDList, $arInsertData)

    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

    Remove the unused function parameter "$arAttachedIDList".
    Open

        protected function afterDetach($obModel, $arAttachedIDList)

    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

    Remove the unused function parameter "$obModel".
    Open

        protected function afterDetach($obModel, $arAttachedIDList)

    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

    Remove the unused function parameter "$obModel".
    Open

        protected function afterAttach($obModel, $arAttachedIDList, $arInsertData)

    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

    Remove the unused function parameter "$arInsertData".
    Open

        protected function afterAttach($obModel, $arAttachedIDList, $arInsertData)

    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

    Expected 1 space after closing brace; 0 found
    Open

                }else {

    There are no issues that match your filters.

    Category
    Status