Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions src/Downloader/Downloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,6 @@ public function isDownLoadLimitExceeded(): bool
return $this->getDownloadLimit() !== 0 && $this->getPersistenceHandler()->count() >= $this->getDownloadLimit();
}

/**
* A shortcut for EventDispatcher::dispatch()
*
* @param GenericEvent $event
* @param string $eventName
*/
private function dispatch(GenericEvent $event, string $eventName): void
{
$this->getDispatcher()->dispatch($event, $eventName);
}

/**
* @param DiscoveredUri $uri
* @return Resource|false
Expand Down
11 changes: 11 additions & 0 deletions src/Event/DispatcherTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,15 @@ public function getDispatcher(): EventDispatcherInterface

return $this->dispatcher;
}

/**
* A shortcut for EventDispatcher::dispatch()
*
* @param object $event
* @param string $eventName
*/
protected function dispatch(object $event, string $eventName): void
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dispatch() used to be a private helper on classes like Spider and Downloader. Moving it into DispatcherTrait as protected changes override semantics: subclasses can now override dispatch(), and internal calls like Spider::crawl() will dispatch through the override (previously they always used the class’s private method). To preserve the previous encapsulation/behavior and reduce BC risk for consumers extending these classes, make the trait method private (traits can declare private methods) unless there’s a concrete need for subclasses to override it.

Suggested change
protected function dispatch(object $event, string $eventName): void
private function dispatch(object $event, string $eventName): void

Copilot uses AI. Check for mistakes.
{
$this->getDispatcher()->dispatch($event, $eventName);
}
}
11 changes: 0 additions & 11 deletions src/Spider.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,17 +142,6 @@ public function setDownloader(DownloaderInterface $downloader): Spider
return $this;
}

/**
* A shortcut for EventDispatcher::dispatch()
*
* @param GenericEvent $event
* @param string $eventName
*/
private function dispatch(GenericEvent $event, string $eventName): void
{
$this->getDispatcher()->dispatch($event, $eventName);
}

/**
* Function that crawls each provided URI
* It applies all processors and listeners set on the Spider
Expand Down