- /**
- * Get default constructor definition for generated class
- *
- * @return array
- */
- protected function _getDefaultConstructorDefinition()
- {
- $reflectionClass = new \ReflectionClass($this->getSourceClassName());
- $constructor = $reflectionClass->getConstructor();
- $parameters = [];
- $body = "\$this->___init();\n";
- if ($constructor) {
- foreach ($constructor->getParameters() as $parameter) {
- $parameters[] = $this->_getMethodParameterInfo($parameter);
- }
- $body .= count($parameters)
- ? "parent::__construct({$this->_getParameterList($parameters)});"
- : "parent::__construct();";
- }
- return [
- 'name' => '__construct',
- 'parameters' => $parameters,
- 'body' => $body
- ];
- }