PHP Classes

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.47
Date: 3 years ago
Size: 4,498 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_
     note VarDto below
* Return _static_


  • 
    
  • convenient constants found in PcGenInterface
  • 
    
  • 
    
  • 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_

---

  • if true then ```isConst``` is set to false (below)
    
    
  • Return _static_


* ```varDto``` _VarDto_  
    noteVarDto* below
* Return _static_
* Throws _InvalidArgumentException_

---

  • 
    
  • 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
  • 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

---

  • * 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])

  • 
    
  • convenient constants found in PcGenInterface
  • 
    
  • ---
    
    

<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