/* Decoded by unphp.net */ name = $name; $this->code = $code; $this->returnTypeNode = new ReturnTypeNode(); } public function getVisibility() { return $this->visibility; } public function setVisibility($visibility) { $visibility = strtolower($visibility); if (!\in_array($visibility, array("public", "private", "protected"), true)) { throw new InvalidArgumentException(sprintf("`%s` method visibility is not supported.", $visibility)); } $this->visibility = $visibility; } public function isStatic() { return $this->static; } public function setStatic($static = true) { $this->static = (bool) $static; } public function returnsReference() { return $this->returnsReference; } public function setReturnsReference() { $this->returnsReference = true; } public function getName() { return $this->name; } public function addArgument(ArgumentNode $argument) { $this->arguments[] = $argument; } public function getArguments() { return $this->arguments; } public function hasReturnType() { return (bool) $this->returnTypeNode->getNonNullTypes(); } public function setReturnTypeNode(ReturnTypeNode $returnTypeNode) : void { $this->returnTypeNode = $returnTypeNode; } public function setReturnType($type = null) { $this->returnTypeNode = $type === '' || $type === null ? new ReturnTypeNode() : new ReturnTypeNode($type); } public function setNullableReturnType($bool = true) { if ($bool) { $this->returnTypeNode = new ReturnTypeNode("null", ...$this->returnTypeNode->getTypes()); } else { $this->returnTypeNode = new ReturnTypeNode(...$this->returnTypeNode->getNonNullTypes()); } } public function getReturnType() { if ($types = $this->returnTypeNode->getNonNullTypes()) { return $types[0]; } return null; } public function getReturnTypeNode() : ReturnTypeNode { return $this->returnTypeNode; } public function hasNullableReturnType() { return $this->returnTypeNode->canUseNullShorthand(); } public function setCode($code) { $this->code = $code; } public function getCode() { if ($this->returnsReference) { return "throw new \Prophecy\Exception\Doubler\ReturnByReferenceException('Returning by reference not supported', get_class($this), '{$this->name}');"; } return (string) $this->code; } public function useParentCode() { $this->code = sprintf("return parent::%s(%s);", $this->getName(), implode(", ", array_map(array($this, "generateArgument"), $this->arguments))); } private function generateArgument(ArgumentNode $arg) { $argument = "$" . $arg->getName(); if ($arg->isVariadic()) { $argument = "..." . $argument; } return $argument; } } ?>