Пример #1
0
 /**
  * Renders the PHP code for this Proxy Method
  *
  * @return string PHP code
  */
 public function render()
 {
     $methodDocumentation = $this->buildMethodDocumentation($this->fullOriginalClassName, $this->methodName);
     $methodParametersCode = $this->methodParametersCode !== '' ? $this->methodParametersCode : $this->buildMethodParametersCode($this->fullOriginalClassName, $this->methodName);
     $callParentMethodCode = $this->buildCallParentMethodCode($this->fullOriginalClassName, $this->methodName);
     $staticKeyword = $this->reflectionService->isMethodStatic($this->fullOriginalClassName, $this->methodName) ? 'static ' : '';
     $visibility = $this->visibility === NULL ? $this->getMethodVisibilityString() : $this->visibility;
     $code = '';
     if (strlen($this->addedPreParentCallCode) + strlen($this->addedPostParentCallCode) > 0) {
         $code = "\n" . $methodDocumentation . "\t" . $staticKeyword . " " . $visibility . " function " . $this->methodName . "(" . $methodParametersCode . ") {\n" . $this->addedPreParentCallCode;
         if ($this->addedPostParentCallCode !== '') {
             $code .= "\t\t\$result = " . ($callParentMethodCode === '' ? "NULL;\n" : $callParentMethodCode);
             $code .= $this->addedPostParentCallCode;
             $code .= "\t\treturn \$result;\n";
         } else {
             $code .= $callParentMethodCode === '' ? '' : "\t\treturn " . $callParentMethodCode . ";\n";
         }
         $code .= "\t}\n";
     }
     return $code;
 }