ascvh@#%(^-^)V ?host,ip,port,protocol,title,domain,country,city,link,org ???à JFIF  x x ?? C         ?? C   ?à   " ??     ?? μ  } !1AQa "q2?‘?#B±áR?e$3br? %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz??…???‰?’“”?–—???¢£¤¥|§¨?a23′μ?·?1o??????èéêòó???×?ùúáa?????èéê?òó???÷?ùú??     ?? μ   w !1AQ aq"2?B‘?±á #3Rebr?{ gilour

File "Environment.php"

Full Path: /home/zcziejy/ryadselyen/plugins/wp-optimize/vendor/intervention/httpauth/src/Environment.php
File size: 1.19 KB
MIME-type: text/x-php
Charset: utf-8

<?php

namespace Intervention\HttpAuth;

use Exception;

class Environment
{
    /**
     * Available auth tokens
     *
     * @var array
     */
    protected $tokenClassnames = [
        Token\PhpAuthUser::class,
        Token\HttpAuthentification::class,
        Token\RedirectHttpAuthorization::class,
        Token\PhpAuthDigest::class,
        Token\HttpAuthorization::class,
    ];

    /**
     * Get first active auth token from all available tokens
     *
     * @return TokenInterface
     */
    public function getToken(): TokenInterface
    {
        foreach ($this->tokenClassnames as $classname) {
            if ($auth = $this->getActiveTokenOrNull($classname)) {
                return $auth;
            }
        }

        return new Token\NullToken();
    }

    /**
     * Try to parse auth token from given classname. Returns token object
     * if token is active and could be parsed or null.
     *
     * @param  string $classname
     * @return TokenInterface|null
     */
    private function getActiveTokenOrNull($classname)
    {
        try {
            $auth = new $classname();
        } catch (Exception $e) {
            $auth = null;
        }

        return $auth;
    }
}