HEX
Server: Apache
System: Linux 185.122.168.184.host.secureserver.net 5.14.0-570.60.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Nov 5 05:00:59 EST 2025 x86_64
User: barbeatleanalyti (1024)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: /home/barbeatleanalyti/www/public_html/webmail/vendor/phpixie/cache/src/PHPixie/Cache/Item.php
<?php

namespace PHPixie\Cache;

use Psr\Cache\CacheItemInterface;

class Item implements CacheItemInterface
{
    protected $key;
    protected $isHit;
    protected $value;
    protected $expiresAt;

    public function __construct($key, $isHit, $value = null, $expiresAt = null)
    {
        $this->key = $key;
        $this->isHit = $isHit;
        $this->value = $value;
        $this->expiresAt = $expiresAt;
    }

    /**
     * @inheritdoc
     */
    public function getKey()
    {
        return $this->key;
    }

    /**
     * @inheritdoc
     */
    public function get()
    {
        return $this->value;
    }

    /**
     * @inheritdoc
     */
    public function isHit()
    {
        return $this->isHit;
    }

    /**
     * @inheritdoc
     */
    public function set($value)
    {
        $this->value = $value;
    }

    /**
     * @inheritdoc
     */
    public function expiresAt($expiresAt)
    {
        $this->expiresAt = $expiresAt;
    }

    /**
     * @inheritdoc
     */
    public function expiresAfter($interval)
    {
        if($interval === null) {
            $this->expiresAt = null;
            return;
        }

        $expires = new \DateTime();
        if(is_int($interval)) {
            $interval = new \DateInterval('PT'.$interval.'S');
        }

        $this->expiresAt = $expires->add($interval);
    }

    /**
     * Get exiration datetime
     *
     * @return null|\DateTimeInterface
     */
    public function getExpiresAt()
    {
        return $this->expiresAt;
    }
}