Skip to content

Commit

Permalink
[Turbo] Simplify $topics
Browse files Browse the repository at this point in the history
  • Loading branch information
Kocal committed Nov 29, 2024
1 parent 1bd9bfd commit 5552863
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/Turbo/src/Bridge/Mercure/TurboStreamListenRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,9 @@ public function __construct(

public function renderTurboStreamListen(Environment $env, $topic): string
{
if ($topic instanceof TopicSet) {
$topics = array_map(\Closure::fromCallable([$this, 'resolveTopic']), $topic->getTopics());
} else {
$topics = [$this->resolveTopic($topic)];
}
$topics = $topic instanceof TopicSet
? array_map($this->resolveTopic(...), $topic->getTopics())
: [$this->resolveTopic($topic)];

$controllerAttributes = ['hub' => $this->hub->getPublicUrl()];
if (1 < \count($topics)) {
Expand Down

0 comments on commit 5552863

Please sign in to comment.