/** * Adds a setter method to generator * * @param TraitGenerator $generator * @param string $property */ protected function addSetterMethod(TraitGenerator $generator, string $property) { $setterMethodName = 'set' . Helper::studly($property); $variableName = strval($property); $method = new MethodGenerator($setterMethodName); $method->addBodyLine(new CodeLineGenerator('$this->' . $variableName . ' = $' . $variableName . ';')); $method->addParameter(new ParameterGenerator($variableName)); $method->setVisibility(Modifiers::VISIBILITY_PUBLIC); $generator->addMethod($method); }
/** * Returns a function name used in DataGrid events and actions * * @param $name * * @return string */ protected function getFunction($name) { $functionName = sprintf('%s%s', $name, ucfirst($this->identifier)); return lcfirst(Helper::studly($functionName)); }