HEX
Server: Apache
System: Linux p3plzcpnl506847.prod.phx3.secureserver.net 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: slfopp7cb1df (5698090)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: /home/slfopp7cb1df/www/home/wp-content/plugins/mailoptin/src/authifly/OAuthCredentialStorage.php
<?php

namespace Authifly\Storage;

class OAuthCredentialStorage implements StorageInterface
{
    /**
     * stores the OAuth1 credentials for subsequent lookups.
     */
    protected $credentials = [];

    /**
     * Initiate a new storage
     *
     * @param null|array $credentials
     */
    public function __construct($credentials = null)
    {
        if (isset($credentials)) {
            $this->credentials = $credentials;
        }
    }

    /**
     * {@inheritdoc}
     */
    public function get($key)
    {
        $key = strtolower($key);

        if (!empty($this->credentials[$key])) {
            return $this->credentials[$key];
        }

        return null;
    }

    /**
     * {@inheritdoc}
     */
    public function set($key, $value)
    {
        $key = strtolower($key);

        $this->credentials[$key] = $value;
    }

    /**
     * {@inheritdoc}
     */
    public function clear()
    {
        $this->credentials = [];
    }

    /**
     * {@inheritdoc}
     */
    public function delete($key)
    {
        $key = strtolower($key);

        if (isset($this->credentials[$key])) {
            unset($this->credentials[$key]);
        }
    }

    /**
     * {@inheritdoc}
     */
    public function deleteMatch($key)
    {
        $key = strtolower($key);

        if (count($this->credentials)) {
            foreach ($this->credentials as $k => $v) {
                if (strstr($k, $key)) {
                    unset($this->credentials[$k]);
                }
            }
        }
    }
}