PluginProbe
Media Cloud Sync / 1.4.2
Media Cloud Sync v1.4.2
1.4.2 1.4.1 1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 All 36 releases
media-cloud-sync / includes / sdk / s3 / Aws / EndpointV2 / Rule / AbstractRule.php

AbstractRule.php in Media Cloud Sync 1.4.2, at includes/sdk/s3/Aws/EndpointV2/Rule/AbstractRule.php

50 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Dudlewebs\WPMCS\s3\Aws\EndpointV2\Rule;
4
5 use Dudlewebs\WPMCS\s3\Aws\EndpointV2\Ruleset\RulesetStandardLibrary;
6 /**
7 * A rule within a rule set. All rules contain a conditions property,
8 * which can be empty, and documentation about the rule.
9 */
10 abstract class AbstractRule
11 {
12 private $conditions;
13 private $documentation;
14 public function __construct(array $definition)
15 {
16 $this->conditions = $definition['conditions'];
17 $this->documentation = isset($definition['documentation']) ? $definition['documentation'] : null;
18 }
19 /**
20 * @return array
21 */
22 public function getConditions()
23 {
24 return $this->conditions;
25 }
26 /**
27 * @return mixed
28 */
29 public function getDocumentation()
30 {
31 return $this->documentation;
32 }
33 /**
34 * Determines if all conditions for a given rule are met.
35 *
36 * @return boolean
37 */
38 protected function evaluateConditions(array &$inputParameters, RulesetStandardLibrary $standardLibrary)
39 {
40 foreach ($this->getConditions() as $condition) {
41 $result = $standardLibrary->callFunction($condition, $inputParameters);
42 if (\is_null($result) || $result === \false) {
43 return \false;
44 }
45 }
46 return \true;
47 }
48 public abstract function evaluate(array $inputParameters, RulesetStandardLibrary $standardLibrary);
49 }
50