haldayne/boost

View on GitHub

Showing 10 of 10 total issues

Function key_to_hash has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
Open

    private function key_to_hash($key)
    {
        if (null === $key) {
            $hash = 'null';

Severity: Minor
Found in src/Map.php - About 6 hrs 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

Map has 42 functions (exceeds 20 allowed). Consider refactoring.
Open

class Map implements \Countable, Arrayable, Jsonable, \ArrayAccess, \IteratorAggregate
{
    /**
     * Should the comparison be made loosely?
     * @see Map::diff
Severity: Minor
Found in src/Map.php - About 5 hrs to fix

    File Map.php has 383 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    namespace Haldayne\Boost;
    
    use Haldayne\Boost\Contract\Arrayable;
    use Haldayne\Boost\Contract\Jsonable;
    Severity: Minor
    Found in src/Map.php - About 5 hrs to fix

      Function is_collection_like has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function is_collection_like($value)
          {
              if ($value instanceof self) {
                  return true;
      
      
      Severity: Minor
      Found in src/Map.php - About 2 hrs 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 collection_to_array has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function collection_to_array($collection)
          {
              if ($collection instanceof self) {
                  return $collection->toArray();
      
      
      Severity: Minor
      Found in src/Map.php - About 2 hrs 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 ini_size_to_bytes has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      function ini_size_to_bytes($string)
      {
          // eliminate complexity: go all lower
          $string = strtolower($string);
      
      
      Severity: Minor
      Found in src/functions/ini_size_to_bytes.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

      Avoid too many return statements within this method.
      Open

                  return false;
      Severity: Major
      Found in src/Map.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return true;
        Severity: Major
        Found in src/Map.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return (array)$collection;
          Severity: Major
          Found in src/Map.php - About 30 mins to fix

            Function grep has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function grep($expression, $limit = null)
                {
                    // initialize our return map and book-keeping values
                    $map = new static;
                    $bnd = empty($limit) ? null : abs($limit);
            Severity: Minor
            Found in src/Map.php - About 25 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

            Severity
            Category
            Status
            Source
            Language