PluginProbe ʕ •ᴥ•ʔ
Transferito: WP Migration / trunk
Transferito: WP Migration vtrunk
trunk 11.4.0 12.0.0 13.1.0 14.0.0 14.0.11 14.0.7 14.1.0 14.1.1 14.1.2 14.1.3 14.1.4
transferito / vendor / aws / aws-sdk-php / src / EndpointV2 / Rule / ErrorRule.php
transferito / vendor / aws / aws-sdk-php / src / EndpointV2 / Rule Last commit date
AbstractRule.php 11 months ago EndpointRule.php 11 months ago ErrorRule.php 11 months ago RuleCreator.php 11 months ago TreeRule.php 11 months ago
ErrorRule.php
46 lines
1 <?php
2
3 namespace Aws\EndpointV2\Rule;
4
5 use Aws\EndpointV2\Ruleset\RulesetStandardLibrary;
6 use Aws\Exception\UnresolvedEndpointException;
7
8 class ErrorRule extends AbstractRule
9 {
10 /** @var array */
11 private $error;
12
13 public function __construct($definition)
14 {
15 parent::__construct($definition);
16 $this->error = $definition['error'];
17 }
18
19 /**
20 * @return array
21 */
22 public function getError()
23 {
24 return $this->error;
25 }
26
27 /**
28 * If an error rule's conditions are met, raise an
29 * UnresolvedEndpointError containing the fully resolved error string.
30 *
31 * @return null
32 * @throws UnresolvedEndpointException
33 */
34 public function evaluate(
35 array $inputParameters,
36 RulesetStandardLibrary $standardLibrary
37 )
38 {
39 if ($this->evaluateConditions($inputParameters, $standardLibrary)) {
40 $message = $standardLibrary->resolveValue($this->error, $inputParameters);
41 throw new UnresolvedEndpointException($message);
42 }
43 return false;
44 }
45 }
46