1: <?php
2:
3: namespace Himedia\Padocc\Task\Base;
4:
5: use Himedia\Padocc\AttributeProperties;
6: use Himedia\Padocc\Task;
7:
8: /**
9: * Définit une propriété interne, réutilisable dans les attributs possédant le flag ALLOW_PARAMETER.
10: * À inclure dans une tâche env ou target.
11: *
12: * Exemple : <property name="servers" value="${SERVER_ADMIN} ${SERVER_SCHED_DEPLOY}" />
13: *
14: * @author Geoffroy AUBRY <gaubry@hi-media.com>
15: */
16: class Property extends Task
17: {
18: /**
19: * {@inheritdoc}
20: */
21: protected function init()
22: {
23: parent::init();
24:
25: $this->aAttrProperties = array(
26: 'name' => AttributeProperties::REQUIRED,
27: 'value' => AttributeProperties::REQUIRED | AttributeProperties::ALLOW_PARAMETER
28: );
29: }
30:
31: /**
32: * {@inheritdoc}
33: * @codeCoverageIgnore
34: */
35: public static function getTagName()
36: {
37: return 'property';
38: }
39:
40: /**
41: * Phase de traitements centraux de l'exécution de la tâche.
42: * Elle devrait systématiquement commencer par "parent::centralExecute();".
43: * Appelé par execute().
44: * @see execute()
45: */
46: protected function centralExecute ()
47: {
48: parent::centralExecute();
49: $sMsg = "+++Set internal property '" . $this->aAttValues['name'] . "' to '"
50: . $this->aAttValues['value'] . "'.---";
51: $this->getLogger()->info($sMsg);
52: $this->oProperties->setProperty($this->aAttValues['name'], $this->aAttValues['value']);
53: }
54: }
55: