Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 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
}