c82b67327cb278c0356f9f61b190bf561267e087
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Classes / Configuration / TypoScript / ConditionMatching / AbstractCondition.php
1 <?php
2 namespace TYPO3\CMS\Core\Configuration\TypoScript\ConditionMatching;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 /**
18 * Abstract class to define own custom TypoScript conditions.
19 *
20 * Used with the TypoScript parser.
21 */
22 abstract class AbstractCondition {
23
24 /**
25 * @var \TYPO3\CMS\Frontend\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcher
26 */
27 protected $conditionMatcherInstance;
28
29 /**
30 * @return \TYPO3\CMS\Frontend\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcher
31 */
32 protected function getConditionMatcherInstance() {
33 return $this->conditionMatcherInstance;
34 }
35
36 /**
37 * @param \TYPO3\CMS\Frontend\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcher $conditionMatcherInstance
38 */
39 public function setConditionMatcherInstance($conditionMatcherInstance) {
40 $this->conditionMatcherInstance = $conditionMatcherInstance;
41 }
42
43 /**
44 * Main method handling the evaluation.
45 * Any given parameters given within the condition in form of
46 * [ACME\MyPackageName\MyCondition = value1, = value2]
47 * will be given as parameter in form of a numeric array, each entry
48 * containing the strings that are split by the commas
49 * e.g. array('= value1', '= value2')
50 *
51 * @param array $conditionParameters
52 * @return bool
53 */
54 abstract public function matchCondition(array $conditionParameters);
55
56 }