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:  * Method parameter description.
 15:  */
 16: class Parameter
 17: {
 18:     use Nette\SmartObject;
 19:     use Traits\NameAware;
 20: 
 21:     /** @var mixed */
 22:     public $defaultValue;
 23: 
 24:     /** @var bool */
 25:     private $reference = false;
 26: 
 27:     /** @var string|null */
 28:     private $typeHint;
 29: 
 30:     /** @var bool */
 31:     private $nullable = false;
 32: 
 33:     /** @var bool */
 34:     private $hasDefaultValue = false;
 35: 
 36: 
 37:     /**
 38:      * @deprecated
 39:      * @return static
 40:      */
 41:     public static function from(\ReflectionParameter $from)
 42:     {
 43:         trigger_error(__METHOD__ . '() is deprecated, use Nette\PhpGenerator\Factory.', E_USER_DEPRECATED);
 44:         return (new Factory)->fromParameterReflection($from);
 45:     }
 46: 
 47: 
 48:     /**
 49:      * @param  bool
 50:      * @return static
 51:      */
 52:     public function setReference($state = true)
 53:     {
 54:         $this->reference = (bool) $state;
 55:         return $this;
 56:     }
 57: 
 58: 
 59:     /**
 60:      * @return bool
 61:      */
 62:     public function isReference()
 63:     {
 64:         return $this->reference;
 65:     }
 66: 
 67: 
 68:     /**
 69:      * @param  string|null
 70:      * @return static
 71:      */
 72:     public function setTypeHint($hint)
 73:     {
 74:         $this->typeHint = $hint ? (string) $hint : null;
 75:         return $this;
 76:     }
 77: 
 78: 
 79:     /**
 80:      * @return string|null
 81:      */
 82:     public function getTypeHint()
 83:     {
 84:         return $this->typeHint;
 85:     }
 86: 
 87: 
 88:     /**
 89:      * @param  bool
 90:      * @return static
 91:      */
 92:     public function setOptional($state = true)
 93:     {
 94:         $this->hasDefaultValue = (bool) $state;
 95:         return $this;
 96:     }
 97: 
 98: 
 99:     /**
100:      * @deprecated  use hasDefaultValue()
101:      * @return bool
102:      */
103:     public function isOptional()
104:     {
105:         return $this->hasDefaultValue;
106:     }
107: 
108: 
109:     /**
110:      * @param  bool
111:      * @return static
112:      */
113:     public function setNullable($state = true)
114:     {
115:         $this->nullable = (bool) $state;
116:         return $this;
117:     }
118: 
119: 
120:     /**
121:      * @return bool
122:      */
123:     public function isNullable()
124:     {
125:         return $this->nullable;
126:     }
127: 
128: 
129:     /**
130:      * @return static
131:      */
132:     public function setDefaultValue($val)
133:     {
134:         $this->defaultValue = $val;
135:         return $this;
136:     }
137: 
138: 
139:     /**
140:      * @return mixed
141:      */
142:     public function getDefaultValue()
143:     {
144:         return $this->defaultValue;
145:     }
146: 
147: 
148:     /**
149:      * @return bool
150:      */
151:     public function hasDefaultValue()
152:     {
153:         return $this->hasDefaultValue;
154:     }
155: }
156: 
Nette 2.4-20180918 API API documentation generated by ApiGen 2.8.0