This commit is contained in:
2026-09-15 10:35:56 +08:00
commit 782f8ea7aa
4086 changed files with 631288 additions and 0 deletions
@@ -0,0 +1,25 @@
<?php
declare(strict_types=1);
namespace Esun\FreeGift\Model;
class InternalAddGuard
{
private int $depth = 0;
public function isAllowed(): bool
{
return $this->depth > 0;
}
public function execute(callable $callback): mixed
{
$this->depth++;
try {
return $callback();
} finally {
$this->depth--;
}
}
}