File: docs/VariableMgr.md

Recommend this page to a friend!
  Classes of Kjell-Inge Gustafsson  >  PcGen  >  docs/VariableMgr.md  >  Download  
File: docs/VariableMgr.md
Role: Auxiliary data
Content type: text/markdown
Description: Auxiliary data
Class: PcGen
Generate PHP code from parameters
Author: By
Last change: 1.1.14
1.1.11
1.1
Date: 1 month ago
Size: 4,458 bytes
 

Contents

Class file image Download

[comment]: # (This file is part of PcGen, PHP Code Generation support package. Copyright 2020 Kjell-Inge Gustafsson, kigkonsult, All rights reserved, licence GPL 3.0)

VariableMgr Methods

The `VariableMgr` class manages PHP variable code * supports property/variable/constant define with PHP primitive value, array, closure or callback * default visibility is `PUBLIC` * default assign operator is `=`

Note, assign of (result from) function/method invoke may be set using VariableMgr::setBody() and [FcnInvokeMgr]

VariableMgr Methods

Inherited [Common methods]

* ```varDto``` _VarDto_
    noteVarDto* below
* Return static

  • `name` _string_, argument name ( with or without leading '$')
  • `varType` _string_, argument varType (hint), default null * convenient constants found in PcGenInterface
  • `default`, _mixed_, the argument value if null
  • `summary` _string_
  • `description` _string_|_array
  • For eol and indents, defaults are used
  • Return static
  • Throws InvalidArgumentException ---
* Return _array_, result code rows (null-bytes removed) no trailing eol
* Throws RuntimeException

  • Return _string_ with code rows (extends toArray), each code row with trailing eol
  • Throws RuntimeException ---
* Convenient constants found in PcGenInterface
* ```visibility``` _string_, null(empty): no visibility, default 'public'  
* Return _static_
---

  • `static` _bool_, true: static, false not static (default) * if true then `isConst` is set to false (below)
  • Return _static_ ---
* ```varDto``` _VarDto_  
    noteVarDto* below
* Return _static_
* Throws InvalidArgumentException
---

  • `name` _string_ variable/property name
  • Return _static_
  • Throws InvalidArgumentException ---
* ```value``` _mixed_, variable/property init (or default) PHP primitive or array value
  * assoc array are produced with keys and values, non assoc not
* Return _static_
---

  • Results in uppercase constant
  • `const` _bool_, true : constant, false : NOT, default * if true then `isStatic` is set to false (above)
  • Return _static_ ---
* ```class``` _string_
* ```method``` _string_, default null
* usage :
  * simple function (set using 'setBody', below)
  * anonymous function (set using 'setBody', below, and, opt, [FcnFrameMgr]/[FcnInvokeMgr])
  * instantiated sourceObject+method, output passed as an array, result : ```[ $sourceObject, 'methodName' ]```
  * class name (fqcn) and static (factory?) method, output passed as an array, result : ```[ FQCN, 'methodName' ]```
  * instantiated sourceObject, class has an (magic) __call method, result : ```$sourceObject```
  * class name (fqcn), class has an (magic) __callStatic method, result : ```FQCN```
  * instantiated sourceObject, class has an (magic) __invoke method, result : ```$sourceObject```
* Return _static_
* Throws InvalidException
---

  • `body` _string_|_array_, (multiple) (closure?) logic code (chunks) row(s), * note, code without 'baseIndent'
  • Return _static_ ---
* Default assign operator is ```=```  
* ```operator``` _string_, one of ```=```, ```+=```, ..., see [operators]
* Return _static_
* Throws InvalidException
---

#### Misc
_VarDto_ instance creation (go to [VarDto])<br><br>
  • `varName` _string_
  • `varType` _string_, variable type (type hint), default null * convenient constants found in PcGenInterface
  • `default`, _mixed_, the argument value if null
  • `summary` _string_
  • `description` _string_|_array_ ---

<small>Return to PcGen [README], [Summary]</small>

[Common methods]:CommonMethods.md [FcnFrameMgr]:FcnFrameMgr.md [FcnInvokeMgr]:FcnInvokeMgr.md [operators]:https://www.php.net/manual/en/language.operators.assignment.php [README]:../README.md [Summary]:Summary.md [VarDto]:VarDto.md


For more information send a message to info at phpclasses dot org.