private function getConstructorBody(ReflectionMethod $constructor = null, $isCallParent = false) { $assocProperties = []; $listProperties = []; foreach ($this->interceptedProperties as $propertyName) { $assocProperties[] = "'{$propertyName}' => &\$this->{$propertyName}"; $listProperties[] = "\$this->{$propertyName}"; } $assocProperties = $this->indent(join(',' . PHP_EOL, $assocProperties)); $listProperties = $this->indent(join(',' . PHP_EOL, $listProperties)); if (isset($this->methodsCode['__construct'])) { $parentCall = $this->getJoinpointInvocationBody($constructor); } elseif ($isCallParent) { $parentCall = '\\call_user_func_array(["parent", __FUNCTION__], \\func_get_args());'; } else { $parentCall = ''; } return <<<CTOR \$this->__properties = array( {$assocProperties} ); unset( {$listProperties} ); {$parentCall} CTOR; }