src/Infotech/DocumentGenerator/DataStructure/Definition/CommonStructureDefinition.php
public function addChildren(array $structures)
    {
        foreach ($structures as $structureName => $structureDef) {
            if (is_int($structureName) && is_string($structureDef)) {
                $structureName = $structureDef;
                $structureDef = array();
            }

            if (!is_array($structureDef)) {
                throw new InvalidDefinitionException(
                    sprintf('Invalid definition of child structure "%s". Definition should be an array', $structureName)
                );
            }

            try {
                $prefix = $this->getArrayValue($structureDef, 'prefix', '');
                $suffix = $this->getArrayValue($structureDef, 'suffix', '');
                $structureName = is_string($structureName)
                    ? $structureName
                    : $this->getArrayValue($structureDef, 'name');
            } catch (InvalidDefinitionException $e) {
                throw new InvalidDefinitionException(
                    sprintf('Invalid definition of child structure "%s". %s', $structureName, $e->getMessage())
                );
            }

            $this->addChild($structureName, $prefix, $suffix);
        }
    }
public function addChildren(array $structures)
    {
        foreach ($structures as $structureName => $structureDef) {
            if (is_int($structureName) && is_string($structureDef)) {
                $structureName = $structureDef;
                $structureDef = array();
            }

            if (!is_array($structureDef)) {
                throw new InvalidDefinitionException(
                    sprintf('Invalid definition of child structure "%s". Definition should be an array', $structureName)
                );
            }

            try {
                $prefix = $this->getArrayValue($structureDef, 'prefix', '');
                $suffix = $this->getArrayValue($structureDef, 'suffix', '');
                $structureName = is_string($structureName)
                    ? $structureName
                    : $this->getArrayValue($structureDef, 'name');
            } catch (InvalidDefinitionException $e) {
                throw new InvalidDefinitionException(
                    sprintf('Invalid definition of child structure "%s". %s', $structureName, $e->getMessage())
                );
            }

            $this->addChild($structureName, $prefix, $suffix);
        }
    }
@param array $structures Child structures.
<code>
[
[
'name' => string,
'prefix' => string opt,
'suffix' => string opt
],
...
]
</code>

@throws DefinitionDuplicateException if definition with same structure's name already exists
@throws InvalidDefinitionException if definition malformed