samsonos/php_core

View on GitHub
src/Utils2.php

Summary

Maintainability
C
1 day
Test Coverage

File Utils2.php has 307 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Get difference time entities between two dates
 *
Severity: Minor
Found in src/Utils2.php - About 3 hrs to fix

    Function debug_parse_args has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    function & debug_parse_args(array $args)
    {
        // Соберем сюда описание аргументов функции
        $result = array();
    
    
    Severity: Minor
    Found in src/Utils2.php - About 1 hr 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 date_format_ru has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function date_format_ru($date)
    {
        $date = strtotime($date);
        $day = date("d", $date);
        $month_en = date("F", $date);
    Severity: Minor
    Found in src/Utils2.php - About 1 hr to fix

      Function array_power_set has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      function array_power_set(array $array, $size = null)
      {
          // initialize by adding the empty set
          $results = array(array());
      
      
      Severity: Minor
      Found in src/Utils2.php - About 1 hr 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 time_difference has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function time_difference($enddate, $startdate = null)
      {
          // Get current timestamp
          if (!isset($startdate)) $startdate = time();
          else $startdate = strtotime($startdate);
      Severity: Minor
      Found in src/Utils2.php - About 1 hr to fix

        Method debug_parse_args has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function & debug_parse_args(array $args)
        {
            // Соберем сюда описание аргументов функции
            $result = array();
        
        
        Severity: Minor
        Found in src/Utils2.php - About 1 hr to fix

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

          function debug_to_string($errno = NULL, $file = NULL, $line = NULL, $class = NULL, $function = NULL, $args = NULL)
          Severity: Minor
          Found in src/Utils2.php - About 45 mins to fix

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

            function mail_send($to, $from = 'info@samsonos.com', $message = '', $subject = '', $from_user = '')
            Severity: Minor
            Found in src/Utils2.php - About 35 mins to fix

              Function debug_to_string has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              function debug_to_string($errno = NULL, $file = NULL, $line = NULL, $class = NULL, $function = NULL, $args = NULL)
              {
                  // Если первым аргументом передан массив, создадим из него переменные
                  if (is_array($errno)) {
                      extract($errno);
              Severity: Minor
              Found in src/Utils2.php - About 35 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 debug_parse_markers has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              function debug_parse_markers($pattern, array & $args = NULL)
              {
                  // Текущий номер аргумента для подмены
                  $a_ind = 0;
              
              
              Severity: Minor
              Found in src/Utils2.php - About 35 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

              There are no issues that match your filters.

              Category
              Status