1: <?php
2:
3: namespace Himedia\Padocc\Task\Base;
4:
5: use Himedia\Padocc\AttributeProperties;
6: use Himedia\Padocc\Task;
7:
8: 9: 10: 11: 12: 13: 14: 15: 16:
17: class ExternalProperty extends Task
18: {
19: 20: 21: 22: 23:
24: const EXTERNAL_PROPERTY_PREFIX = 'external_property_';
25:
26: 27: 28:
29: protected function init()
30: {
31: parent::init();
32:
33: $this->aAttrProperties = array(
34: 'name' => AttributeProperties::REQUIRED,
35: 'description' => AttributeProperties::REQUIRED
36: );
37: }
38:
39: 40: 41: 42:
43: public static function getTagName ()
44: {
45: return 'externalproperty';
46: }
47:
48: 49: 50: 51: 52: 53:
54: protected function centralExecute ()
55: {
56: parent::centralExecute();
57: $this->getLogger()->info('+++');
58: try {
59: $sValue = $this->oProperties->getProperty(self::EXTERNAL_PROPERTY_PREFIX . $this->aAttValues['name']);
60: } catch (\UnexpectedValueException $oException) {
61: $sMsg = "Property '" . $this->aAttValues['name'] . "' undefined!";
62: throw new \UnexpectedValueException($sMsg, 1, $oException);
63: }
64: $sMsg = "Set external property '" . $this->aAttValues['name'] . "' (description: '"
65: . $this->aAttValues['description'] . "') to '$sValue'.";
66: $this->getLogger()->info($sMsg);
67: $this->oProperties->setProperty($this->aAttValues['name'], $sValue);
68: $this->getLogger()->info('---');
69: }
70: }
71: