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)
FcnFrameMgr
The ` FcnFrameMgr` class manages PHP function/method/closure frame (shell) code
-
arguments, closures use variables
-
method property(/variable) set code
-
input of body (logic)
-
method return (this, parent, self, constant, property, variable, scalar) code
-
default visibility is ```PUBLIC```
Note, invoke of functions/methods is managed by [FcnInvokeMgr]/[ChainInvokeMgr]
FcnFrameMgr Methods
Inherited [Common methods]
* ```name``` _string_, function/method name
* ```arguments``` _array_, note ```FcnFrameMgr::setArguments()``` below
* For eol and indents, defaults are used
* Static
* Return _static_
---
-
Return _array_, result code rows (null-bytes removed) no trailing eol
-
Throws _RuntimeException_
* Return _array_, result code rows (null-bytes removed) no trailing eol
* Throws _RuntimeException_
---
-
Convenient constants found in PcGenInterface
-
-
Return _static_
* Set method as static
* ```static``` _bool_, true: static, false not static (default)
* Return _static_
---
-
Function/method name, note, not for closures
-
-
Return _static_
-
Throws _InvalidArgumentException_
* ```argument``` _ArgumentDto_
note ```ArgumentDto``` below
opt with set directives for _by-reference_, _updClassProp_, _nextVarPropIndex_, below
* Return _static_
-
note ```VarDto``` below
-
if true argument is going to be passed as reference
default false
-
default no update
-
only if argument type/value array (and ! ```ArgumentDto::NONE```, above)
If not set, default, false.
if true, the argument (value) will append the class property array
-
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
* ```by-reference``` _bool_, above
* ```updClassProp``` _bool_, above
* ```nextVarPropIndex``` _bool_ above
* Return _static_
* Throws _InvalidArgumentException_
-
_name_, _string_, argument name
_ArgumentDto_, note ```ArgumentDto``` below
_array( varDto [, by-reference [, updClassProp [, nextVarPropIndex ]]]_ (above), note ```VarDto``` below
_array( name [, varType [, default [, by-reference [, updClassProp [, nextVarPropIndex ]]]]] )_ (above)
-
Return _static_
-
Throws _InvalidArgumentException_
---
* Add closure use, single variable
* ```argumentDto``` _ArgumentDto_
note ```ArgumentDto``` below
* Return _static_
-
Add closure use, single variable
-
note ```VarDto``` below
-
-
Return _static_
* Add closure use, single variable
* ```name``` _string_, variable name, with or without leading '$'
* ```by-reference``` _bool_, passing variable by reference or not, default false
* Return _static_
* Throws _InvalidArgumentException_
-
Set sets of closure use variables
-
array( VarDto [, by-reference ] ), above
array( name [, by-reference ] ), above
-
Return _static_
-
Throws _InvalidArgumentException_
* ```body``` _string|array_, (multiple) logic code (chunks) row(s),
note, code without 'baseIndent'
* Return _static_
---
* ```FcnFrameMgr::setReturnValue()``` alias
* Set directive for method/function end-up scalar return code (ex 'return true;')
* ```returnArg``` _bool_|_int_|_float_|_string_
* Return _static_
* Throws _InvalidArgumentException_
-
-
Set directive for method end-up class return code ('return $this;')
-
Return _static_
* ```FcnFrameMgr::setReturnValue()``` alias
* Set directive for method end-up class return code (ex 'return $this->returnArg;')
* Dynamic variables (ex '{$varDto}') not supported
* ```returnArg``` _string_
* ```returnArg2``` _int_|_string_
'return $this->returnArg\[$returnArg2];' (if string)
* Return _static_
* Throws _InvalidArgumentException_
ArgumentDto
_ArgumentDto_ instance creation ([ArgumentDto])
* ```name``` _string_, argument name ( with or without leading '$')
* ```varType``` _string_, variable type (type hint), default null
convenient constants found in PcGenInterface
* ```default```, _mixed_, the argument value if null
* ```summary``` _string_, the [phpdoc] summary
* ```description``` _string_|_array_, the [phpdoc] description
<br>
###### VarDto
_VarDto_ instance creation ([VarDto])
-
-
convenient constants found in PcGenInterface
-
-
-
Example
<?php
$code = FcnFrameMgr::init()
->setName( 'someFunction' )
->addArgument( 'iterator', FcnFrameMgr::ARRAY )
->setBody(
' // this is the function body'
)
->toString();
Result :
public function someFunction( array $iterator )
{
// this is the function body
}
<small>Return to PcGen [README], [Summary]</small>
[ArgumentDto]:ArgumentDto.md
[ChainInvokeMgr]:ChainInvokeMgr.md
[Common methods]:CommonMethods.md
[FcnInvokeMgr]:FcnInvokeMgr.md
[phpdoc]:https://phpdoc.org
[README]:../README.md
[Summary]:Summary.md
[VarDto]:VarDto.md
|