File "ErrorCollection.php"

Full Path: /home/u886502366/domains/almoasronppbags.com/public_html/newtest/wp-content/plugins/depicter/vendor/typerocket/core/src/Http/ErrorCollection.php
File size: 922 bytes
MIME-type: text/x-php
Charset: utf-8

<?php
namespace TypeRocket\Http;

use TypeRocket\Utility\RuntimeCache;

class ErrorCollection
{
    public const KEY = Redirect::KEY_ERROR;

    /**
     * @var array|null
     */
    protected $errors = null;

    /**
     * @var RuntimeCache
     */
    protected $cache;

    public function __construct()
    {
        $errors = Cookie::new()->getTransient(static::KEY, false);
        $this->errors = $errors;
    }

    /**
     * @return array|null
     */
    public function errors()
    {
        Cookie::new()->deleteTransient(static::KEY);

        return $this->errors;
    }

    /**
     * @param mixed ...$args
     *
     * @return static
     */
    public static function new(...$args)
    {
        return new static(...$args);
    }

    /**
     * @return static
     */
    public static function getFromRuntimeCache()
    {
        return RuntimeCache::getFromContainer()->get(static::KEY);
    }
}