netgescon-master/netgescon/vendor/illuminate/support/Defer/DeferredCallback.php
Pikappa2 480e7eafbd 🎯 NETGESCON - Setup iniziale repository completo
📋 Commit iniziale con:
-  Documentazione unificata in docs/
-  Codice Laravel in netgescon-laravel/
-  Script automazione in scripts/
-  Configurazione sync rsync
-  Struttura organizzata e pulita

🔄 Versione: 2025.07.19-1644
🎯 Sistema pronto per Git distribuito
2025-07-19 16:44:47 +02:00

55 lines
1.1 KiB
PHP

<?php
namespace Illuminate\Support\Defer;
use Illuminate\Support\Str;
class DeferredCallback
{
/**
* Create a new deferred callback instance.
*
* @param callable $callback
*/
public function __construct(public $callback, public ?string $name = null, public bool $always = false)
{
$this->name = $name ?? (string) Str::uuid();
}
/**
* Specify the name of the deferred callback so it can be cancelled later.
*
* @param string $name
* @return $this
*/
public function name(string $name): self
{
$this->name = $name;
return $this;
}
/**
* Indicate that the deferred callback should run even on unsuccessful requests and jobs.
*
* @param bool $always
* @return $this
*/
public function always(bool $always = true): self
{
$this->always = $always;
return $this;
}
/**
* Invoke the deferred callback.
*
* @return void
*/
public function __invoke(): void
{
call_user_func($this->callback);
}
}