gielfeldt/iterators

View on GitHub

Showing 9 of 69 total issues

CachingIterator has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

class CachingIterator extends \ArrayIterator
{
    const CLONE_KEY = 1;
    const CLONE_CURRENT = 2;

Severity: Minor
Found in src/CachingIterator.php - About 2 hrs to fix

    Method __construct has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function __construct(string $globPattern, int $flags = self::GLOB_NOSORT | \FilesystemIterator::KEY_AS_PATHNAME | \FilesystemIterator::CURRENT_AS_FILEINFO)
        {
            $this->flags = $flags;
            list($path, $maxDepth) = self::extractPathAndMaxDepth($globPattern);
            $regexPattern = self::globToRegex($globPattern);
    Severity: Minor
    Found in src/GlobIterator.php - About 1 hr to fix

      Function map has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          private function map()
          {
              if ($this->valid()) {
                  $result = ($this->callback)($this->getInnerIterator());
                  if (is_array($result)) {
      Severity: Minor
      Found in src/MapIterator.php - About 55 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 __destruct has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function __destruct()
          {
              $this->fflush();
              if ($this->persist == self::PERSIST || $this->persist == self::PERSIST_UNCHANGED) {
                  if ($this->persist == self::PERSIST_UNCHANGED || !$this->doCompare()) {
      Severity: Minor
      Found in src/AtomicTempFileObject.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 count has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function count()
          {
              if (!($this->flags & self::CACHE_COUNT) || !isset($this->count)) {
                  if ($this->getInnerIterator() instanceof \Countable) {
                      $this->count = intval($this->getInnerIterator()->count());
      Severity: Minor
      Found in src/CountableIterator.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 accept has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function accept()
          {
              $found = 0;
              foreach ($this->iterators as $iterator) {
                  foreach ($iterator as $key => $value) {
      Severity: Minor
      Found in src/IntersectIterator.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 accept has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function accept()
          {
              foreach ($this->iterators as $iterator) {
                  foreach ($iterator as $key => $value) {
                      if (($this->callback)($this->getInnerIterator(), $key, $value)) {
      Severity: Minor
      Found in src/DiffIterator.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

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

          private static function compare(AtomicTempFileObject $tempFile): bool
          {
              $filename = $tempFile->getDestinationRealPath();
              if (!file_exists($filename)) {
                  return false;
      Severity: Minor
      Found in src/AtomicTempFileObject.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

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

          public function __construct(string $globPattern, int $flags = self::GLOB_NOSORT | \FilesystemIterator::KEY_AS_PATHNAME | \FilesystemIterator::CURRENT_AS_FILEINFO)
          {
              $this->flags = $flags;
              list($path, $maxDepth) = self::extractPathAndMaxDepth($globPattern);
              $regexPattern = self::globToRegex($globPattern);
      Severity: Minor
      Found in src/GlobIterator.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