Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php namespace App\Traits; use Exception; use Illuminate\Contracts\Bus\Dispatcher; use ..
Decoded Output download
<?php
namespace App\Traits;
use Exception;
use Illuminate\Contracts\Bus\Dispatcher;
use Throwable;
trait Jobs
{
/**
* Dispatch a job to its appropriate handler.
*
* @param mixed $job
* @return mixed
*/
public function dispatch($job)
{
$function = $this->getDispatchFunction();
return $this->$function($job);
}
/**
* Dispatch a job to its appropriate handler.
*
* @param mixed $command
* @return mixed
*/
public function dispatchQueue($job)
{
return app(Dispatcher::class)->dispatch($job);
}
/**
* Dispatch a command to its appropriate handler in the current process.
*
* Queuable jobs will be dispatched to the "sync" queue.
*
* @param mixed $command
* @param mixed $handler
* @return mixed
*/
public function dispatchSync($job, $handler = null)
{
return app(Dispatcher::class)->dispatchSync($job, $handler);
}
/**
* Dispatch a job to its appropriate handler and return a response array for ajax calls.
*
* @param mixed $job
* @return mixed
*/
public function ajaxDispatch($job)
{
try {
$data = $this->dispatch($job);
$response = [
'success' => true,
'error' => false,
'data' => $data,
'message' => '',
];
} catch (Exception | Throwable $e) {
$response = [
'success' => false,
'error' => true,
'data' => null,
'message' => $e->getMessage(),
];
}
return $response;
}
public function getDispatchFunction()
{
return should_queue() ? 'dispatchQueue' : 'dispatchSync';
}
}
?>
Did this file decode correctly?
Original Code
<?php
namespace App\Traits;
use Exception;
use Illuminate\Contracts\Bus\Dispatcher;
use Throwable;
trait Jobs
{
/**
* Dispatch a job to its appropriate handler.
*
* @param mixed $job
* @return mixed
*/
public function dispatch($job)
{
$function = $this->getDispatchFunction();
return $this->$function($job);
}
/**
* Dispatch a job to its appropriate handler.
*
* @param mixed $command
* @return mixed
*/
public function dispatchQueue($job)
{
return app(Dispatcher::class)->dispatch($job);
}
/**
* Dispatch a command to its appropriate handler in the current process.
*
* Queuable jobs will be dispatched to the "sync" queue.
*
* @param mixed $command
* @param mixed $handler
* @return mixed
*/
public function dispatchSync($job, $handler = null)
{
return app(Dispatcher::class)->dispatchSync($job, $handler);
}
/**
* Dispatch a job to its appropriate handler and return a response array for ajax calls.
*
* @param mixed $job
* @return mixed
*/
public function ajaxDispatch($job)
{
try {
$data = $this->dispatch($job);
$response = [
'success' => true,
'error' => false,
'data' => $data,
'message' => '',
];
} catch (Exception | Throwable $e) {
$response = [
'success' => false,
'error' => true,
'data' => null,
'message' => $e->getMessage(),
];
}
return $response;
}
public function getDispatchFunction()
{
return should_queue() ? 'dispatchQueue' : 'dispatchSync';
}
}
Function Calls
None |
Stats
MD5 | 648481861fb4de806dc2e47533a9d16b |
Eval Count | 0 |
Decode Time | 99 ms |