CasperSecurity

Current Path : /var/www/hrms.uiet.co.in/vendor/spatie/laravel-activitylog/src/
Upload File :
Current File : /var/www/hrms.uiet.co.in/vendor/spatie/laravel-activitylog/src/LogBatch.php

<?php

namespace Spatie\Activitylog;

use Closure;
use Ramsey\Uuid\Uuid;

class LogBatch
{
    public ?string $uuid = null;

    public int $transactions = 0;

    protected function generateUuid(): string
    {
        return Uuid::uuid4()->toString();
    }

    public function getUuid(): ?string
    {
        return $this->uuid;
    }

    public function setBatch(string $uuid): void
    {
        $this->uuid = $uuid;
        $this->transactions = 1;
    }

    public function withinBatch(Closure $callback): mixed
    {
        $this->startBatch();
        $result = $callback($this->getUuid());
        $this->endBatch();

        return $result;
    }

    public function startBatch(): void
    {
        if (! $this->isOpen()) {
            $this->uuid = $this->generateUuid();
        }

        $this->transactions++;
    }

    public function isOpen(): bool
    {
        return $this->transactions > 0;
    }

    public function endBatch(): void
    {
        $this->transactions = max(0, $this->transactions - 1);

        if ($this->transactions === 0) {
            $this->uuid = null;
        }
    }
}
Hacker Blog, Shell İndir, Sql İnjection, XSS Attacks, LFI Attacks, Social Hacking, Exploit Bot, Proxy Tools, Web Shell, PHP Shell, Alfa Shell İndir, Hacking Training Set, DDoS Script, Denial Of Service, Botnet, RFI Attacks, Encryption
Telegram @BIBIL_0DAY