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 / AbstractRule.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
AbstractRule.php
63 lines
1 <?php
2
3 namespace Aws\EndpointV2\Rule;
4
5 use Aws\EndpointV2\Ruleset\RulesetStandardLibrary;
6
7 /**
8 * A rule within a rule set. All rules contain a conditions property,
9 * which can be empty, and documentation about the rule.
10 */
11 abstract class AbstractRule
12 {
13 private $conditions;
14 private $documentation;
15
16 public function __construct(array $definition)
17 {
18 $this->conditions = $definition['conditions'];
19 $this->documentation = isset($definition['documentation']) ?
20 $definition['documentation'] : null;
21 }
22
23 /**
24 * @return array
25 */
26 public function getConditions()
27 {
28 return $this->conditions;
29 }
30
31 /**
32 * @return mixed
33 */
34 public function getDocumentation()
35 {
36 return $this->documentation;
37 }
38
39 /**
40 * Determines if all conditions for a given rule are met.
41 *
42 * @return boolean
43 */
44 protected function evaluateConditions(
45 array &$inputParameters,
46 RulesetStandardLibrary $standardLibrary
47 )
48 {
49 foreach($this->getConditions() as $condition) {
50 $result = $standardLibrary->callFunction($condition, $inputParameters);
51 if (is_null($result) || $result === false) {
52 return false;
53 }
54 }
55 return true;
56 }
57
58 abstract public function evaluate(
59 array $inputParameters,
60 RulesetStandardLibrary $standardLibrary
61 );
62 }
63