private function createHydrateMethod(array $visiblePropertyMap, array $hiddenPropertyMap) : string
    {
        $content = [];

        foreach ($visiblePropertyMap as $propertyName) {
            $content[] = "if (isset(\$data['" . $propertyName . "']) || \$object->" . $propertyName . " !== null && \\array_key_exists('" . $propertyName . "', \$data)) {";
            $content[] = "    \$object->" . $propertyName . " = \$data['" . $propertyName . "'];";
            $content[] = "}";
        }
        $index = 0;
        foreach ($hiddenPropertyMap as $className => $propertyNames) {
            $content[] = "\$this->hydrateCallbacks[" . ($index++) . "]->__invoke(\$object, \$data);";
        }

        $content[] = "return \$object;";

        return \implode("\n", \array_map(
            function ($line) {
                return "        " . $line;
            }, $content
        ));
    }
private function createHydrateMethod(array $visiblePropertyMap, array $hiddenPropertyMap) : string
    {
        $content = [];

        foreach ($visiblePropertyMap as $propertyName) {
            $content[] = "if (isset(\$data['" . $propertyName . "']) || \$object->" . $propertyName . " !== null && \\array_key_exists('" . $propertyName . "', \$data)) {";
            $content[] = "    \$object->" . $propertyName . " = \$data['" . $propertyName . "'];";
            $content[] = "}";
        }
        $index = 0;
        foreach ($hiddenPropertyMap as $className => $propertyNames) {
            $content[] = "\$this->hydrateCallbacks[" . ($index++) . "]->__invoke(\$object, \$data);";
        }

        $content[] = "return \$object;";

        return \implode("\n", \array_map(
            function ($line) {
                return "        " . $line;
            }, $content
        ));
    }
private function createHydrateMethod ( array $ visiblePropertyMap , array $ hiddenPropertyMap ) : string { $ content = [ ] ; foreach ( $ visiblePropertyMap as $ propertyName ) { $ content [ ] = "if (isset(\$data['" . $ propertyName . "']) || \$object->" . $ propertyName . " !== null && \\array_key_exists('" . $ propertyName . "', \$data)) {" ; $ content [ ] = "    \$object->" . $ propertyName . " = \$data['" . $ propertyName . "'];" ; $ content [ ] = "}" ; } $ index = 0 ; foreach ( $ hiddenPropertyMap as $ className => $ propertyNames ) { $ content [ ] = "\$this->hydrateCallbacks[" . ( $ index ++ ) . "]->__invoke(\$object, \$data);" ; } $ content [ ] = "return \$object;" ; return \ implode ( "\n" , \ array_map ( function ( $ line ) { return "        " . $ line ; } , $ content ) ) ; }
Generate code for the hydrate method

@param string[][] $visiblePropertyMap
@param string[] $hiddenPropertyMap

@return string
Generate code for the hydrate method