public function createDenormalizationStatement(Context $context, Expr $input)
{
$valuesVar = new Expr\Variable($context->getUniqueVariableName('values'));
$statements = [new Expr\Assign($valuesVar, $this->createArrayValueStatement())];
$loopValueVar = new Expr\Variable($context->getUniqueVariableName('value'));
$loopKeyVar = $this->createLoopKeyStatement($context);
$loopStatements = [];
foreach ($this->types as $pattern => $type) {
list($typeStatements, $typeOutput) = $type->createDenormalizationStatement($context, $loopValueVar);
$loopStatements = array_merge($loopStatements, [new Stmt\If_(new Expr\BinaryOp\BooleanAnd(new Expr\FuncCall(new Name('preg_match'), [new Arg(new Expr\ConstFetch(new Name("'/" . str_replace('/', '\\/', $pattern) . "/'"))), new Arg($loopKeyVar)]), $type->createConditionStatement($loopValueVar)), ['stmts' => array_merge($typeStatements, [new Expr\Assign(new Expr\ArrayDimFetch($valuesVar, $loopKeyVar), $typeOutput), new Stmt\Continue_()])])]);
}
$statements[] = new Stmt\Foreach_($input, $loopValueVar, ['keyVar' => $loopKeyVar, 'stmts' => $loopStatements]);
return [$statements, $valuesVar];
}