Commit | Line | Data |
---|---|---|
bfb52dd9 | 1 | <?php |
a9229942 | 2 | |
bfb52dd9 | 3 | namespace wcf\system\html; |
a9229942 | 4 | |
bfb52dd9 | 5 | use wcf\data\object\type\ObjectTypeCache; |
79bbb75a | 6 | use wcf\system\exception\InvalidObjectTypeException; |
bfb52dd9 AE |
7 | |
8 | /** | |
9 | * Default implementation for html processors. | |
a9229942 | 10 | * |
bfb52dd9 | 11 | * @author Alexander Ebert |
a9229942 | 12 | * @copyright 2001-2019 WoltLab GmbH |
bfb52dd9 AE |
13 | * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php> |
14 | * @package WoltLabSuite\Core\System\Html | |
15 | * @since 3.0 | |
16 | */ | |
a9229942 TD |
17 | abstract class AbstractHtmlProcessor implements IHtmlProcessor |
18 | { | |
19 | /** | |
20 | * message context data | |
21 | * @var array | |
22 | */ | |
23 | protected $context = [ | |
24 | 'objectType' => '', | |
25 | 'objectTypeID' => 0, | |
26 | 'objectID' => 0, | |
27 | ]; | |
28 | ||
29 | /** | |
30 | * Sets the message context data. | |
31 | * | |
32 | * @param string $objectType object type identifier | |
33 | * @param int $objectID object id | |
34 | * @throws InvalidObjectTypeException | |
35 | */ | |
36 | public function setContext($objectType, $objectID) | |
37 | { | |
38 | $objectTypeID = ObjectTypeCache::getInstance()->getObjectTypeIDByName('com.woltlab.wcf.message', $objectType); | |
39 | if ($objectTypeID === null) { | |
40 | throw new InvalidObjectTypeException($objectType, 'com.woltlab.wcf.message'); | |
41 | } | |
42 | ||
43 | $this->context = [ | |
44 | 'objectType' => $objectType, | |
45 | 'objectTypeID' => $objectTypeID, | |
46 | 'objectID' => $objectID, | |
47 | ]; | |
48 | } | |
49 | ||
50 | /** | |
51 | * Returns the message context data. | |
52 | * | |
53 | * @return array message context data | |
54 | */ | |
55 | public function getContext() | |
56 | { | |
57 | return $this->context; | |
58 | } | |
bfb52dd9 | 59 | } |