Skip to content
This repository was archived by the owner on Sep 12, 2019. It is now read-only.

Commit 72ef38b

Browse files
authored
Merge pull request #16 from PackageFactory/feature/split-component-evaluate
TASK: Split ComponentImplementation->evaluate into two separate methods
2 parents ef501f1 + b8ebf48 commit 72ef38b

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

Classes/PackageFactory/AtomicFusion/FusionObjects/ComponentImplementation.php

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,11 @@ class ComponentImplementation extends ArrayImplementation
3636
protected $ignoreProperties = ['__meta', 'renderer'];
3737

3838
/**
39-
* Evaluate the fusion-keys and transfer the result into the context as ``props``
40-
* afterwards evaluate the ``renderer`` with this context
39+
* Get the component props as an associative array
4140
*
42-
* @return void|string
41+
* @return array
4342
*/
44-
public function evaluate()
43+
public function getProps()
4544
{
4645
$sortedChildFusionKeys = $this->sortNestedFusionKeys();
4746

@@ -54,6 +53,17 @@ public function evaluate()
5453
}
5554
}
5655

56+
return $props;
57+
}
58+
59+
/**
60+
* Render the component with the given props
61+
*
62+
* @param array $props
63+
* @return void|string
64+
*/
65+
public function renderComponent(array $props)
66+
{
5767
$context = $this->runtime->getCurrentContext();
5868
$context['props'] = $props;
5969
$this->runtime->pushContextArray($context);
@@ -62,4 +72,16 @@ public function evaluate()
6272

6373
return $result;
6474
}
75+
76+
/**
77+
* Evaluate the fusion-keys and transfer the result into the context as ``props``
78+
* afterwards evaluate the ``renderer`` with this context
79+
*
80+
* @return void|string
81+
*/
82+
public function evaluate()
83+
{
84+
$props = $this->getProps();
85+
return $this->renderComponent($props);
86+
}
6587
}

0 commit comments

Comments
 (0)