|
7 | 7 | use PE\Nodes\EncoderNodeVariable; |
8 | 8 | use PE\Samples\General\Thing; |
9 | 9 | use PE\Samples\Specials\EncoderNodeVariableApplyToSetter; |
| 10 | +use PE\Variables\Types\NodeAccessor; |
| 11 | +use PE\Variables\Types\ObjectSetter; |
| 12 | +use PE\Variables\Types\PostNodeSetter; |
10 | 13 |
|
11 | 14 | class EncoderNodeVariableApplyToSetterNode extends EncoderNode { |
12 | 15 |
|
13 | 16 | function __construct() { |
14 | 17 | parent::__construct('encoder-node-variable-apply-to-setters-node', 'encoder-node-variable-apply-to-setters-node', '\\PE\\Samples\\Specials'); |
15 | 18 |
|
16 | | - $this->addVariable(new EncoderNodeVariable('node-simple', array( |
17 | | - 'setterAction' => array( |
18 | | - 'type' => EncoderNodeVariable::ACTION_TYPE_NODE, |
19 | | - 'method' => 'nodeSimple', |
20 | | - 'variables' => array(ActionVariable::SETTER_NAME) |
21 | | - ) |
22 | | - ))); |
| 19 | + $nodeSimple = $this->addVariable(new EncoderNodeVariable('node-simple')); |
| 20 | + $nodeSimple->postNodeSetter(new PostNodeSetter('nodeSimple', NodeAccessor::VARIABLE_NAME)); |
23 | 21 |
|
24 | | - $this->addVariable(new EncoderNodeVariable('node-full', array( |
25 | | - 'setterAction' => array( |
26 | | - 'type' => EncoderNodeVariable::ACTION_TYPE_NODE, |
27 | | - 'method' => 'nodeFull', |
28 | | - 'variables' => array(ActionVariable::SETTER_NAME, ActionVariable::SETTER_VALUE, ActionVariable::SETTER_OBJECT, ActionVariable::SETTER_PARENT) |
29 | | - ) |
| 22 | + $nodeFull = $this->addVariable(new EncoderNodeVariable('node-full')); |
| 23 | + $nodeFull->postNodeSetter(new PostNodeSetter('nodeFull', array( |
| 24 | + NodeAccessor::VARIABLE_NAME, |
| 25 | + NodeAccessor::VARIABLE_VALUE, |
| 26 | + NodeAccessor::VARIABLE_OBJECT, |
| 27 | + NodeAccessor::VARIABLE_PARENT |
30 | 28 | ))); |
31 | 29 |
|
32 | | - $this->addVariable(new EncoderNodeVariable('node-without-variables', array( |
33 | | - 'setterAction' => array( |
34 | | - 'type' => EncoderNodeVariable::ACTION_TYPE_NODE, |
35 | | - 'method' => 'nodeWithoutVariables' |
36 | | - ) |
37 | | - ))); |
38 | | - $this->addVariable(new EncoderNodeVariable('node-without-variables-empty', array( |
39 | | - 'setterAction' => array( |
40 | | - 'type' => EncoderNodeVariable::ACTION_TYPE_NODE, |
41 | | - 'method' => 'nodeWithoutVariables', |
42 | | - 'variables' => array() |
43 | | - ) |
44 | | - ))); |
45 | | - $this->addVariable(new EncoderNodeVariable('node-without-variables-null', array( |
46 | | - 'setterAction' => array( |
47 | | - 'type' => EncoderNodeVariable::ACTION_TYPE_NODE, |
48 | | - 'method' => 'nodeWithoutVariables', |
49 | | - 'variables' => array() |
50 | | - ) |
51 | | - ))); |
| 30 | + $nodeWithoutVariables = $this->addVariable(new EncoderNodeVariable('node-without-variables')); |
| 31 | + $nodeWithoutVariables->postNodeSetter(new PostNodeSetter('nodeWithoutVariables')); |
52 | 32 |
|
53 | | - $this->addVariable(new EncoderNodeVariable('node-unknown-variable', array( |
54 | | - 'setterAction' => array( |
55 | | - 'type' => EncoderNodeVariable::ACTION_TYPE_NODE, |
56 | | - 'method' => 'nodeSimple', |
57 | | - 'variables' => array('unknown_variable') |
58 | | - ) |
59 | | - ))); |
| 33 | + $nodeWithoutVariablesEmpty = $this->addVariable(new EncoderNodeVariable('node-without-variables-empty')); |
| 34 | + $nodeWithoutVariablesEmpty->postNodeSetter(new PostNodeSetter('nodeWithoutVariables', array())); |
60 | 35 |
|
| 36 | + $nodeWithoutVariablesNull = $this->addVariable(new EncoderNodeVariable('node-without-variables-null')); |
| 37 | + $nodeWithoutVariablesNull->postNodeSetter(new PostNodeSetter('nodeWithoutVariables', array())); |
| 38 | + |
| 39 | + $nodeUnknownVariable = $this->addVariable(new EncoderNodeVariable('node-unknown-variable')); |
| 40 | + $nodeUnknownVariable->postNodeSetter(new PostNodeSetter('nodeSimple', array('unknown_variable'))); |
61 | 41 |
|
62 | 42 | $this->addVariable(new EncoderNodeVariable('var')); |
63 | 43 |
|
64 | | - $this->addVariable(new EncoderNodeVariable('object-using-setter-action', array( |
65 | | - 'setterAction' => array( |
66 | | - 'method' => 'setVar' |
67 | | - ) |
68 | | - ))); |
| 44 | + $objectUsingSetterMethod = $this->addVariable(new EncoderNodeVariable('object-using-setter-method')); |
| 45 | + $objectUsingSetterMethod->objectSetter(new ObjectSetter('setVar')); |
69 | 46 |
|
70 | | - $this->addVariable(new EncoderNodeVariable('object-using-setter-method', array( |
71 | | - 'setter' => 'setVar' |
72 | | - ))); |
73 | | - |
74 | | - $this->addVariable(new EncoderNodeVariable('object-using-unknown-setter-method', array( |
75 | | - 'setterMethod' => 'unknownMethod' |
76 | | - ))); |
| 47 | + $objectUsingUnknownSetterMethod = $this->addVariable(new EncoderNodeVariable('object-using-unknown-setter-method')); |
| 48 | + $objectUsingUnknownSetterMethod->objectSetter(new ObjectSetter('unknownMethod')); |
77 | 49 | } |
78 | 50 |
|
79 | 51 | public function nodeSimple($nodeData, $setterName) { |
|
0 commit comments