WsdlToPhp\PackageGenerator\Model\Method::getMethodName PHP Method

getMethodName() public method

Returns the name of the method that is used to call the operation It takes care of the fact that the method might not be the only one named as it is.
public getMethodName ( ) : string
return 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;
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * @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;
 }