HEX
Server: Apache
System: Linux efa57bbe-abb1-400d-2985-3b056fbc2701.secureserver.net 6.1.147-1.el9.elrepo.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jul 24 12:33:32 EDT 2025 x86_64
User: root (0)
PHP: 8.0.30.4
Disabled: NONE
Upload Files
File: /var/www/wp-content/mu-plugins/vendor/godaddy/mwc-core/src/Auth/Providers/Platform/AuthProvider.php
<?php

namespace GoDaddy\WordPress\MWC\Core\Auth\Providers\Platform;

use Exception;
use GoDaddy\WordPress\MWC\Common\Auth\Providers\AbstractTokenAuthProvider;
use GoDaddy\WordPress\MWC\Common\Cache\Contracts\CacheableContract;
use GoDaddy\WordPress\MWC\Common\Configuration\Configuration;
use GoDaddy\WordPress\MWC\Common\Http\Request;
use GoDaddy\WordPress\MWC\Common\Platforms\PlatformRepositoryFactory;
use GoDaddy\WordPress\MWC\Core\Auth\Providers\Platform\Cache\Types\ErrorResponseCache;
use GoDaddy\WordPress\MWC\Core\Auth\Providers\Platform\Cache\Types\TokenCache;

class AuthProvider extends AbstractTokenAuthProvider
{
    /**
     * {@inheritDoc}
     */
    protected function getCredentialsCache() : CacheableContract
    {
        return TokenCache::for($this->getCurrentUserId());
    }

    /**
     * {@inheritDoc}
     */
    protected function getCredentialsErrorCache() : CacheableContract
    {
        return ErrorResponseCache::getInstance();
    }

    /**
     * {@inheritDoc}
     * @throws Exception
     */
    protected function getCredentialsRequestInstance() : Request
    {
        $request = new Request();

        try {
            $platformRepositoryInstance = PlatformRepositoryFactory::getNewInstance()->getPlatformRepository();

            $request
                ->setTimeout(6)
                ->addHeaders([
                    'X-Account-UID' => Configuration::get('godaddy.account.uid', ''),
                    'X-Site-Token'  => Configuration::get('godaddy.site.token', ''),
                    'X-Customer-ID' => $platformRepositoryInstance->getGoDaddyCustomerId(),
                    'X-Source'      => $platformRepositoryInstance->getPlatformName(),
                ]);
        } catch (Exception $exception) {
            // ignore exception from ArrayHelper::combine() that is not possible when both parameters are arrays.
            // The two parameters in this case are the headers property of the request and the array of new headers.
        }

        return $request;
    }
}