403Webshell
Server IP : 172.67.158.161  /  Your IP : 13.58.230.203
Web Server : LiteSpeed
System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : giankuin ( 1871)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/giankuin/www/wp-content/plugins/duplicator-pro/aws/Aws/Common/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/giankuin/www/wp-content/plugins/duplicator-pro/aws/Aws/Common/RulesEndpointProvider.php
<?php
namespace DuplicatorPro\Aws\Common;

/**
 * Provides endpoints based on a rules configuration file.
 */
class RulesEndpointProvider
{
    /** @var array */
    private $patterns;

    /**
     * @param array $patterns Hash of endpoint patterns mapping to endpoint
     *                        configurations.
     */
    public function __construct(array $patterns)
    {
        $this->patterns = $patterns;
    }

    /**
     * Creates and returns the default RulesEndpointProvider based on the
     * public rule sets.
     *
     * @return self
     */
    public static function fromDefaults()
    {
        return new self(require __DIR__ . '/Resources/public-endpoints.php');
    }

    public function __invoke(array $args = array())
    {
        if (!isset($args['service'])) {
            throw new \InvalidArgumentException('Requires a "service" value');
        }

        if (!isset($args['region'])) {
            throw new \InvalidArgumentException('Requires a "region" value');
        }

        foreach ($this->getKeys($args['region'], $args['service']) as $key) {
            if (isset($this->patterns['endpoints'][$key])) {
                return $this->expand($this->patterns['endpoints'][$key], $args);
            }
        }

        throw new \RuntimeException('Could not resolve endpoint');
    }

    private function expand(array $config, array $args)
    {
        $scheme = isset($args['scheme']) ? $args['scheme'] : 'https';
        $config['endpoint'] = $scheme . '://' . str_replace(
            array('{service}', '{region}'),
            array($args['service'], $args['region']),
            $config['endpoint']
        );

        return $config;
    }

    private function getKeys($region, $service)
    {
        return array("$region/$service", "$region/*", "*/$service", "*/*");
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit