/** @return PhpMethod */ public function addBody($statement, array $args = NULL) { $this->body .= (func_num_args() > 1 ? PhpHelpers::formatArgs($statement, $args) : $statement) . "\n"; return $this; }
/** * Formats PHP statement. * @return string */ public function formatPhp($statement, $args, $self = NULL) { $that = $this; array_walk_recursive($args, create_function('&$val', 'extract(NCFix::$vars[' . NCFix::uses(array('self' => $self, 'that' => $that)) . '], EXTR_REFS); list($val) = $that->normalizeEntity(array($val)); if ($val instanceof DIStatement) { $val = new PhpLiteral($that->formatStatement($val, $self)); } elseif ($val === \'@\' . DIContainerBuilder::THIS_CONTAINER) { $val = new PhpLiteral(\'$this\'); } elseif ($service = $that->getServiceName($val, $self)) { $val = $service === $self ? \'$service\' : $that->formatStatement(new DIStatement($val)); $val = new PhpLiteral($val); } ')); return PhpHelpers::formatArgs($statement, $args); }