You are here

private function ClassCodeGenerator::generateMethod in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ClassCodeGenerator.php \Prophecy\Doubler\Generator\ClassCodeGenerator::generateMethod()
1 call to ClassCodeGenerator::generateMethod()
ClassCodeGenerator::generate in vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ClassCodeGenerator.php
Generates PHP code for class node.

File

vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ClassCodeGenerator.php, line 55

Class

ClassCodeGenerator
Class code creator. Generates PHP code for specific class node tree.

Namespace

Prophecy\Doubler\Generator

Code

private function generateMethod(Node\MethodNode $method) {
  $php = sprintf("%s %s function %s%s(%s)%s {\n", $method
    ->getVisibility(), $method
    ->isStatic() ? 'static' : '', $method
    ->returnsReference() ? '&' : '', $method
    ->getName(), implode(', ', $this
    ->generateArguments($method
    ->getArguments())), $method
    ->hasReturnType() ? sprintf(': %s', $method
    ->getReturnType()) : '');
  $php .= $method
    ->getCode() . "\n";
  return $php . '}';
}