Count the number of pending changes in each tree.

@return string[]
773482
private function totalChanges(): array
    {
        return DB::table('gedcom')
            ->leftJoin('change', static function (JoinClause $join): void {
                $join
                    ->on('change.gedcom_id', '=', 'gedcom.gedcom_id')
                    ->where('change.status', '=', 'pending');
            })
            ->groupBy('gedcom.gedcom_id')
            ->pluck(DB::raw('COUNT(change_id)'), 'gedcom.gedcom_id')
            ->all();
    }
851612
public function detectChanges()
    {
        clearstatcache(true, $this->path);

        if (! $this->exists && $this->files->exists($this->path)) {
            $this->lastModified = $this->files->lastModified($this->path);
            $this->exists = true;

            return [new Event($this, Event::RESOURCE_CREATED)];
        } elseif ($this->exists && ! $this->files->exists($this->path)) {
            $this->exists = false;

            return [new Event($this, Event::RESOURCE_DELETED)];
        } elseif ($this->exists && $this->isModified()) {
            $this->lastModified = $this->files->lastModified($this->path);

            return [new Event($this, Event::RESOURCE_MODIFIED)];
        }

        return [];
    }
1173854
public function nodeCount(): int
    {
        $c = 1;
        foreach ($this->_children as $child) {
            $c += $child->nodeCount();
        }
        return $c;
    }
173567
public function hasChanges()
    {
        if ($this->hasChanges) {
            return $this->hasChanges;
        }

        $this->hasChanges = count($this->newResources) > 0 || count($this->deletedResources) > 0 || count($this->updatedResources) > 0;

        return $this->hasChanges;
    }
799517
protected function commitChanges(): array
    {
        $updated = [];
        foreach ($this->sortedTables() as $table) {
            if ($table->getStatus() == AbstractTable::STATUS_DECLARED_DROPPED) {
                $table->save(HandlerInterface::DO_DROP);
                continue;
            }

            $updated[] = $table;
            $table->save(
                HandlerInterface::DO_ALL
                ^ HandlerInterface::DROP_FOREIGN_KEYS
                ^ HandlerInterface::DROP_INDEXES
                ^ HandlerInterface::CREATE_FOREIGN_KEYS
            );
        }

        return $updated;
    }
1281269
public function getDiffs() {
    $diffs = array();
    foreach ($this->diffs as $diff) {
      if ($diff[1] !== self::OLD) {
        $diffs[] = $diff;
      } 
    }
    return $diffs;
  }
834134
public function changes()
    {
        $changes = [];
        foreach ($this->changedAttributes as $attrName => $originalValue) {
            $changes[$attrName] = [$originalValue, $this->attributes->get($attrName)];
        }
        return $changes;
    }
1027318
public function getModifiedFiles() {
		try {
			return $this->extractFromCommand ( 'git diff --name-status HEAD', function ($array) {
				$array = trim ( preg_replace ( '!\s+!', ' ', $array ) );
				return explode ( ' ', $array );
			} );
		} catch ( \Cz\Git\GitException $e ) {
			return [ ];
		}
	}
71440
public function getPreviousExceptions()
    {
        if ($this->previousExceptions === null) {
            $this->previousExceptions = [];

            $prev = $this->exception->getPrevious();
            while ($prev !== null) {
                $this->previousExceptions[] = $prev;
                $prev = $prev->getPrevious();
            }
        }

        return $this->previousExceptions;
    }
938150
public function countOnline()
    {
        $sum = 0;
        foreach ($this->map as $node_name => $set) {

            $sum += $set->count();
        }
        return $sum;
    }
1245444
private function getNewOffset(): int {
		while ( $this->offsetExists( $this->indexOffset ) ) {
			$this->indexOffset++;
		}

		return $this->indexOffset;
	}
1038012
public function getStepIndexes()
    {
        $dates = [];

        // TODO : Think about doing this a cleaner way with carbon instead with timestamps ...
        $current = $this->start->timestamp;
        $last = $this->end->timestamp;

        while ($current <= $last) {
            $dates[] = date($this->getStepFormat(), $current);
            $current = strtotime($this->getStepIncrement(), $current);
        }

        return $dates;
    }
639798
public function detectChanges()
    {
        $events = parent::detectChanges();

        // When a descendant file is created or deleted a modified event is fired on the
        // directory. This is the only way a directory will receive a modified event and
        // will thus result in two events being fired for a single descendant modification
        // within the directory. This will clear the events if we got a modified event.
        if (! empty($events) && $events[0]->getCode() == Event::RESOURCE_MODIFIED) {
            $events = [];
        }

        foreach ($this->descendants as $key => $descendant) {
            $descendantEvents = $descendant->detectChanges();

            foreach ($descendantEvents as $event) {
                if ($event instanceof Event && $event->getCode() == Event::RESOURCE_DELETED) {
                    unset($this->descendants[$key]);
                }
            }

            $events = array_merge($events, $descendantEvents);
        }

        // If this directory still exists we'll check the directories descendants again for any
        // new descendants.
        if ($this->exists) {
            foreach ($this->detectDirectoryDescendants() as $key => $descendant) {
                if (! isset($this->descendants[$key])) {
                    $this->descendants[$key] = $descendant;

                    $events[] = new Event($descendant, Event::RESOURCE_CREATED);
                }
            }
        }

        return $events;
    }
886992
public function getSumChildCount(): int
    {
        $count = count($this->children);

        foreach ($this->children as $node) {
            $count += $node->getChildCount();
        }

        return $count;
    }
1136347
public function getCommitOrder()
    {
        // Check whether we need to do anything. 0 or 1 node is easy.
        $nodeCount = count($this->classes);
        if ($nodeCount === 0) {
            return array();
        }

        if ($nodeCount === 1) {
            return array_values($this->classes);
        }
        
        // Init
        foreach ($this->classes as $node) {
            $this->nodeStates[$node->name] = self::NOT_VISITED;
        }
        
        // Go
        foreach ($this->classes as $node) {
            if ($this->nodeStates[$node->name] == self::NOT_VISITED) {
                $this->visitNode($node);
            }
        }

        $sorted = array_reverse($this->sorted);

        $this->sorted = $this->nodeStates = array();

        return $sorted;
    }
175736
public function findChanges()
    {
        $this->reset();

        if ($this->cache->isInitialized() == false) {
            $this->warmUpCache();
        } else {
            $this->findChangesAgainstCache();
        }

        $this->cache->save();

        return new ResourceWatcherResult($this->newFiles, $this->deletedFiles, $this->updatedFiles);
    }
229673
public function countChangeLog()
    {
        Deprecated::method(3.3, 'Use count() instead.');

        $query = $this->countChangeLogQuery();

        return $this->getCount($query->execute()->fetch());
    }