Server IP : 104.21.14.103 / Your IP : 3.137.200.7 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/sieuthiweb.com.vn/wp-content/plugins/duplicator-pro/aws/Aws/Common/ |
Upload File : |
<?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", "*/*"); } }