lib/API/Values/ParameterStructTrait.php
private function fillFromHash(
        ParameterDefinitionCollectionInterface $definitionCollection,
        array $values,
        bool $doImport = false
    ): void {
        foreach ($definitionCollection->getParameterDefinitions() as $name => $definition) {
            $value = $definition->getDefaultValue();
            $parameterType = $definition->getType();

            if (array_key_exists($name, $values)) {
                $value = $doImport ?
                    $parameterType->import($definition, $values[$name]) :
                    $parameterType->fromHash($definition, $values[$name]);
            }

            $this->setParameterValue($name, $value);

            if ($definition instanceof CompoundParameterDefinition) {
                $this->fillFromHash($definition, $values, $doImport);
            }
        }
    }
private function fillFromHash(
        ParameterDefinitionCollectionInterface $definitionCollection,
        array $values,
        bool $doImport = false
    ): void {
        foreach ($definitionCollection->getParameterDefinitions() as $name => $definition) {
            $value = $definition->getDefaultValue();
            $parameterType = $definition->getType();

            if (array_key_exists($name, $values)) {
                $value = $doImport ?
                    $parameterType->import($definition, $values[$name]) :
                    $parameterType->fromHash($definition, $values[$name]);
            }

            $this->setParameterValue($name, $value);

            if ($definition instanceof CompoundParameterDefinition) {
                $this->fillFromHash($definition, $values, $doImport);
            }
        }
    }
private function fillFromHash ( ParameterDefinitionCollectionInterface $ definitionCollection , array $ values , bool $ doImport = false ) : void { foreach ( $ definitionCollection -> getParameterDefinitions ( ) as $ name => $ definition ) { $ value = $ definition -> getDefaultValue ( ) ; $ parameterType = $ definition -> getType ( ) ; if ( array_key_exists ( $ name , $ values ) ) { $ value = $ doImport ? $ parameterType -> import ( $ definition , $ values [ $ name ] ) : $ parameterType -> fromHash ( $ definition , $ values [ $ name ] ) ; } $ this -> setParameterValue ( $ name , $ value ) ; if ( $ definition instanceof CompoundParameterDefinition ) { $ this -> fillFromHash ( $ definition , $ values , $ doImport ) ; } } }
Fills the struct values based on provided array of values.

If any of the parameters is missing from the input array, the default value
based on parameter definition from the definition collection will be used.

The values in the array need to be in hash format of the value
i.e. the format acceptable by the ParameterTypeInterface::fromHash method.

If $doImport is set to true, the values will be considered as coming from an import,
meaning it will be processed using ParameterTypeInterface::import method instead of
ParameterTypeInterface::fromHash method.
Fills the struct values based on provided array of values .