owncloud/core

View on GitHub
lib/public/Util.php

Summary

Maintainability
D
2 days
Test Coverage

Util has 51 functions (exceeds 20 allowed). Consider refactoring.
Open

class Util {
    // consts for Logging
    public const DEBUG=0;
    public const INFO=1;
    public const WARN=2;
Severity: Major
Found in lib/public/Util.php - About 7 hrs to fix

    File Util.php has 297 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
     * @author Bart Visscher <bartv@thisnet.nl>
     * @author Björn Schießle <bjoern@schiessle.org>
    Severity: Minor
    Found in lib/public/Util.php - About 3 hrs to fix

      Method sendMail has 11 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              $toaddress,
              $toname,
              $subject,
              $mailtext,
              $fromaddress,
      Severity: Major
      Found in lib/public/Util.php - About 1 hr to fix

        Method getStatusInfo has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function getStatusInfo($includeVersion = false, $serverHide = false, $hostnameShort = false) {
                $systemConfig = \OC::$server->getSystemConfig();
        
                $installed = (bool) $systemConfig->getValue('installed', false);
                $maintenance = (bool) $systemConfig->getValue('maintenance', false);
        Severity: Minor
        Found in lib/public/Util.php - About 1 hr to fix

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

              public static function sendMail(
                  $toaddress,
                  $toname,
                  $subject,
                  $mailtext,
          Severity: Minor
          Found in lib/public/Util.php - About 1 hr to fix

            Function sendMail has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function sendMail(
                    $toaddress,
                    $toname,
                    $subject,
                    $mailtext,
            Severity: Minor
            Found in lib/public/Util.php - About 45 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 getStatusInfo has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function getStatusInfo($includeVersion = false, $serverHide = false, $hostnameShort = false) {
                    $systemConfig = \OC::$server->getSystemConfig();
            
                    $installed = (bool) $systemConfig->getValue('installed', false);
                    $maintenance = (bool) $systemConfig->getValue('maintenance', false);
            Severity: Minor
            Found in lib/public/Util.php - About 45 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 getFullDomain has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function getFullDomain($url) {
                    $parts = \parse_url($url);
                    if ($parts === false) {
                        throw new \InvalidArgumentException('Invalid url "' . $url . '"');
                    }
            Severity: Minor
            Found in lib/public/Util.php - About 45 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

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

                public static function mb_substr_replace($string, $replacement, $start, $length = null, $encoding = 'UTF-8') {
            Severity: Minor
            Found in lib/public/Util.php - About 35 mins to fix

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

                  public static function mb_str_replace($search, $replace, $subject, $encoding = 'UTF-8', &$count = null) {
              Severity: Minor
              Found in lib/public/Util.php - About 35 mins to fix

                There are no issues that match your filters.

                Category
                Status