<commit_before><?php
namespace Icecave\Chastity;

use Icecave\Chastity\Driver\BlockingDriverInterface;
use Icecave\Chastity\Exception\LockAcquisitionException;
use Icecave\Chastity\Exception\LockAlreadyAcquiredException;
use Icecave\Chastity\Exception\LockNotAcquiredException;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;

class Lock implements LockInterface, LoggerAwareInterface
{
    use LoggerAwareTrait;

    public function __construct(
        BlockingDriverInterface $driver,
        $resource,
        $token
    ) {
        $this->driver = $driver;
        $this->resource = $resource;
        $this->token = $token;
    }

    /**
     * Release this lock.
     */
    public function __destruct()
    {
        if (!$this->isAcquired) {
            return;
        }

        try {
            $this->release();
        } catch (LockNotAcquiredException $e) {
            // ignore ...
        }<commit_msg>Marked Lock class as internal and added some docs.<commit_after><?php
namespace Icecave\Chastity;

use Icecave\Chastity\Driver\BlockingDriverInterface;
use Icecave\Chastity\Exception\LockAcquisitionException;
use Icecave\Chastity\Exception\LockAlreadyAcquiredException;
use Icecave\Chastity\Exception\LockNotAcquiredException;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;

/**
 * @internal
 *
 * Default lock implementation.
 *
 * Note that locks should not be constructed directly, rather they should
 * created via using a {@see LockFactoryInterface}.
 */
class Lock implements LockInterface, LoggerAwareInterface
{
    use LoggerAwareTrait;

    /**
     * @param BlockingDriverInterface $driver   The lock driver.
     * @param string                  $resource The resource to which this lock applies.
     * @param string                  $token    A unique token representing this lock instance.
     */
    public function __construct(
        BlockingDriverInterface $driver,
        $resource,
        $token
    ) {
        $this->driver = $driver;
        $this->resource = $resource;
        $this->token = $token;
    }

    /**
     * Release this lock.
     */
    public function __destruct()
    {
        if (!$this->isAcquired) {
            return;
        }

        try {
            $this->release();
        } catch (LockNotAcquiredException $e) {
            // ignore ...
        }
{'fraction_non_alphanumeric': 0.09636517328825021, 'fraction_numerical': 0.0, 'mean_word_length': 2.4860088365243005, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7076996', 'n_tokens_mistral': 682, 'n_tokens_neox': 661, 'n_words': 155}