public getMethodName ( ) : string | ||
Результат | string |
public function getMethodName()
{
if (empty($this->methodName)) {
$methodName = $this->getCleanName();
if (!$this->getIsUnique()) {
if (is_string($this->getParameterType())) {
$methodName .= ucfirst($this->getParameterType());
} else {
$methodName .= '_' . md5(var_export($this->getParameterType(), true));
}
}
$context = $this->getOwner()->getPackagedName();
$methodName = $this->replaceReservedMethod($methodName, $context);
$methodName = self::replacePhpReservedKeyword($methodName, $context);
$this->methodName = self::uniqueName($methodName, $this->getOwner()->getPackagedName());
}
return $this->methodName;
}
/** * @param string $serviceVariableName * @param MethodModel $method * @return Tutorial */ protected function addContentFromMethod($serviceVariableName, MethodModel $method) { $this->getFile()->getMainElement()->addChild(sprintf('if ($%s->%s(%s) !== false) {', $serviceVariableName, $method->getMethodName(), $this->getMethodParameters($method)))->addChild($this->getFile()->getMainElement()->getIndentedString(sprintf('print_r($%s->getResult());', $serviceVariableName), 1))->addChild('} else {')->addChild($this->getFile()->getMainElement()->getIndentedString(sprintf('print_r($%s->getLastError());', $serviceVariableName), 1))->addChild('}'); return $this; }