Bristol SU Support Package
SettingListener.php
Go to the documentation of this file.
1 <?php
2 
4 
9 
13 abstract class SettingListener implements ShouldQueue
14 {
16 
22  protected $key;
23 
31  public function handle($event, $payload) {
32  $setting = $payload[0];
33  $eventName = substr(substr($event, 9), 0, -65);
34  if ($setting->key === $this->key) {
35  return $this->callEventFunction($eventName, $setting);
36  }
37  return false;
38  }
39 
48  private function callEventFunction($eventName, $setting)
49  {
50  $method = 'on'.ucfirst($eventName);
51  return (method_exists($this, $method) ? $this->{$method}($setting) : null);
52  }
53 
54 
55 }