Namespaces

  • Latte
    • Loaders
    • Macros
    • Runtime
  • Nette
    • Application
      • Responses
      • Routers
      • UI
    • Bridges
      • ApplicationDI
      • ApplicationLatte
      • ApplicationTracy
      • CacheDI
      • CacheLatte
      • DatabaseDI
      • DatabaseTracy
      • DITracy
      • FormsDI
      • FormsLatte
      • Framework
      • HttpDI
      • HttpTracy
      • MailDI
      • ReflectionDI
      • SecurityDI
      • SecurityTracy
    • Caching
      • Storages
    • ComponentModel
    • Database
      • Conventions
      • Drivers
      • Table
    • DI
      • Config
        • Adapters
      • Extensions
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Loaders
    • Localization
    • Mail
    • Neon
    • PhpGenerator
      • Traits
    • Reflection
    • Security
    • Tokenizer
    • Utils
  • Tracy
    • Bridges
      • Nette
  • none

Classes

  • ClassType
  • Closure
  • Constant
  • Factory
  • GlobalFunction
  • Helpers
  • Method
  • Parameter
  • PhpFile
  • PhpLiteral
  • PhpNamespace
  • Property
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Other releases
 1: <?php
 2: 
 3: /**
 4:  * This file is part of the Nette Framework (https://nette.org)
 5:  * Copyright (c) 2004 David Grudl (https://davidgrudl.com)
 6:  */
 7: 
 8: namespace Nette\PhpGenerator;
 9: 
10: use Nette;
11: 
12: 
13: /**
14:  * Global function.
15:  *
16:  * @property string $body
17:  */
18: class GlobalFunction
19: {
20:     use Nette\SmartObject;
21:     use Traits\FunctionLike;
22:     use Traits\NameAware;
23:     use Traits\CommentAware;
24: 
25:     /**
26:      * @param  string
27:      * @return static
28:      */
29:     public static function from($function)
30:     {
31:         return (new Factory)->fromFunctionReflection(new \ReflectionFunction($function));
32:     }
33: 
34: 
35:     /**
36:      * @return string  PHP code
37:      */
38:     public function __toString()
39:     {
40:         return Helpers::formatDocComment($this->comment . "\n")
41:             . 'function '
42:             . ($this->returnReference ? '&' : '')
43:             . $this->name
44:             . $this->parametersToString()
45:             . $this->returnTypeToString()
46:             . "\n{\n" . Nette\Utils\Strings::indent(ltrim(rtrim($this->body) . "\n"), 1) . '}';
47:     }
48: }
49: 
Nette 2.4-20180918 API API documentation generated by ApiGen 2.8.0