src/Infotech/DocumentGenerator/DataStructure/StructureProcessor.php
public function process($structureName, $origin)
    {
        $def = $this->structures[$structureName];

        $data = array_merge(
            $def->getEmptyValues(),
            $this->source->fetchData($structureName, $origin)
        );

        $accessor = new PropertyAccess();

        foreach ($def->getChildren() as $childDef) {
            $data = array_merge(
                $data,
                $this->modifyPlaceholders(
                    $this->process($childDef['name'], $accessor->get($data, $childDef['name'])),
                    $childDef['prefix'],
                    $childDef['suffix']
                )
            );
            unset($data[$childDef['name']]);
        }

        return $data;
    }
public function process($structureName, $origin)
    {
        $def = $this->structures[$structureName];

        $data = array_merge(
            $def->getEmptyValues(),
            $this->source->fetchData($structureName, $origin)
        );

        $accessor = new PropertyAccess();

        foreach ($def->getChildren() as $childDef) {
            $data = array_merge(
                $data,
                $this->modifyPlaceholders(
                    $this->process($childDef['name'], $accessor->get($data, $childDef['name'])),
                    $childDef['prefix'],
                    $childDef['suffix']
                )
            );
            unset($data[$childDef['name']]);
        }

        return $data;
    }
Traverse structure tree and generate plain array of placeholder data.

@param string $structureName
@param mixed  $origin

@return array