Skip to content

Commit

Permalink
change method name
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Apr 28, 2017
1 parent fed3c68 commit 2665d9b
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions src/Illuminate/Events/Dispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,19 @@ protected function shouldBroadcast(array $payload)
{
return isset($payload[0]) &&
$payload[0] instanceof ShouldBroadcast &&
$this->checkBroadcastCondition($payload[0]);
$this->broadcastWhen($payload[0]);
}

/**
* Check if event should be broadcasted by condition.
*
* @param mixed $event
* @return bool
*/
protected function broadcastWhen($event)
{
return method_exists($event, 'broadcastWhen')
? $event->broadcastWhen() : true;
}

/**
Expand Down Expand Up @@ -548,20 +560,4 @@ public function setQueueResolver(callable $resolver)

return $this;
}

/**
* Check if event should be broadcasted by condition.
*
* @param $event
*
* @return bool
*/
protected function checkBroadcastCondition($event)
{
if (method_exists($event, 'broadcastWhen')) {
return $event->broadcastWhen();
}

return true;
}
}

0 comments on commit 2665d9b

Please sign in to comment.