<?php declare(strict_types = 1);
namespace Newland\Toubiz\Sync\Neos\Command;

trait UsesLockFile
{
    protected function getLockPath(): string
    {
        // Including path-hash in lock to prevent conflicting locks on same server if FLOW_PATH_TEMPORARY_BASE not set
        return sprintf(
            '%s/Newland.Toubiz.Sync.%s.lock',
            \defined('FLOW_PATH_TEMPORARY_BASE') ? FLOW_PATH_TEMPORARY_BASE : sys_get_temp_dir(),
            md5(__FILE__)
        );
    }
}
