howardjones/network-weathermap

View on GitHub
lib/Weathermap/Core/Font.php

Summary

Maintainability
A
45 mins
Test Coverage

Method drawImageString has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function drawImageString($gdImage, $x, $y, $string, $colour, $angle = 0)
Severity: Minor
Found in lib/Weathermap/Core/Font.php - About 45 mins to fix

    Remove the unused function parameter "$gdImage".
    Open

        public function drawImageString($gdImage, $x, $y, $string, $colour, $angle = 0)
    Severity: Major
    Found in lib/Weathermap/Core/Font.php by sonar-php

    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 "$x".
    Open

        public function drawImageString($gdImage, $x, $y, $string, $colour, $angle = 0)
    Severity: Major
    Found in lib/Weathermap/Core/Font.php by sonar-php

    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 "$string".
    Open

        public function calculateImageStringSize($string)
    Severity: Major
    Found in lib/Weathermap/Core/Font.php by sonar-php

    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 "$fontNumber".
    Open

        public function getConfig($fontNumber)
    Severity: Major
    Found in lib/Weathermap/Core/Font.php by sonar-php

    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 "$angle".
    Open

        public function drawImageString($gdImage, $x, $y, $string, $colour, $angle = 0)
    Severity: Major
    Found in lib/Weathermap/Core/Font.php by sonar-php

    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 "$string".
    Open

        public function drawImageString($gdImage, $x, $y, $string, $colour, $angle = 0)
    Severity: Major
    Found in lib/Weathermap/Core/Font.php by sonar-php

    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 "$colour".
    Open

        public function drawImageString($gdImage, $x, $y, $string, $colour, $angle = 0)
    Severity: Major
    Found in lib/Weathermap/Core/Font.php by sonar-php

    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 "$y".
    Open

        public function drawImageString($gdImage, $x, $y, $string, $colour, $angle = 0)
    Severity: Major
    Found in lib/Weathermap/Core/Font.php by sonar-php

    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

    There are no issues that match your filters.

    Category
    Status