# media-cloud-sync/1.4.2/includes/sdk/s3/Aws/EndpointV2/EndpointProviderV2.php

Media Cloud Sync, version 1.4.2. 58 lines.

- Page: https://pluginprobe.com/plugins/media-cloud-sync/1.4.2/code/includes/sdk/s3/Aws/EndpointV2/EndpointProviderV2.php
- Raw: https://pluginprobe.com/plugins/media-cloud-sync/1.4.2/raw/includes/sdk/s3/Aws/EndpointV2/EndpointProviderV2.php
- Modified: 2026-05-10T10:14:36+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/media-cloud-sync/1.4.2/code/includes/sdk/s3/Aws/EndpointV2/EndpointProviderV2.php#L10-L20`.

```php
<?php

namespace Dudlewebs\WPMCS\s3\Aws\EndpointV2;

use Dudlewebs\WPMCS\s3\Aws\EndpointV2\Ruleset\Ruleset;
use Dudlewebs\WPMCS\s3\Aws\EndpointV2\Ruleset\RulesetEndpoint;
use Dudlewebs\WPMCS\s3\Aws\Exception\UnresolvedEndpointException;
use Dudlewebs\WPMCS\s3\Aws\LruArrayCache;
/**
 * Given a service's Ruleset and client-provided input parameters, provides
 * either an object reflecting the properties of a resolved endpoint,
 * or throws an error.
 */
class EndpointProviderV2
{
    /** @var Ruleset */
    private $ruleset;
    /** @var LruArrayCache */
    private $cache;
    public function __construct(array $ruleset, array $partitions)
    {
        $this->ruleset = new Ruleset($ruleset, $partitions);
        $this->cache = new LruArrayCache(100);
    }
    /**
     * @return Ruleset
     */
    public function getRuleset()
    {
        return $this->ruleset;
    }
    /**
     * Given a Ruleset and input parameters, determines the correct endpoint
     * or an error to be thrown for a given request.
     *
     * @return RulesetEndpoint
     * @throws UnresolvedEndpointException
     */
    public function resolveEndpoint(array $inputParameters)
    {
        $hashedParams = $this->hashInputParameters($inputParameters);
        $match = $this->cache->get($hashedParams);
        if (!\is_null($match)) {
            return $match;
        }
        $endpoint = $this->ruleset->evaluate($inputParameters);
        if ($endpoint === \false) {
            throw new UnresolvedEndpointException('Unable to resolve an endpoint using the provider arguments: ' . \json_encode($inputParameters));
        }
        $this->cache->set($hashedParams, $endpoint);
        return $endpoint;
    }
    private function hashInputParameters($inputParameters)
    {
        return \md5(\serialize($inputParameters));
    }
}

```
