File: docs/AssignClauseMgr.md

Recommend this page to a friend!
  Classes of Kjell-Inge Gustafsson  >  PcGen  >  docs/AssignClauseMgr.md  >  Download  
File: docs/AssignClauseMgr.md
Role: Auxiliary data
Content type: text/markdown
Description: Auxiliary data
Class: PcGen
Generate PHP code from parameters
Author: By
Last change: 1.1.25
1.1.14
1.1.11
1.1.7
1.1
Date: 1 month ago
Size: 7,187 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)

AssignClauseMgr

The `AssignClauseMgr` manages the code assign * of a target class property or variable (value) * from * source class property or variable (value), opt (int/variable) index * (scalar) fixedSourceValue * single function/method or chained invokes * PHP expression * default assign operator is `=` * ex result `$this->property = OtherClass::CONSTANT;`

The result of this class toString()/toArray() methods is used by other classes setBody() method.

AssignClauseMgr Methods

Inherited [Common methods]

* ```targetClass``` _string_ one of null, self, $this, 'otherClass', '$class'
  * convenient constants found in PcGenInterface 
* ```targetVariable``` _string_ variable/property name
  * uppercase is autodetected as CONSTANT
  * variable $-prefixed
* ```targetIndex```  _int_|_string_ opt array index
* ```sourceClass``` _string_ one of null, self,  $this, 'otherClass', '$class'
  * convenient constants found in PcGenInterface 
* ```sourceVariable``` _string_ class/variable/property name
  * uppercase is autodetected as CONSTANT
  * variable $-prefixed
* ```sourceIndex```  _int_|_string_ opt array index
* For eol and indents, defaults are used
* Return static
---

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

  • Return [EntityMgr]
* Return _bool_ true if not null

  • `class` _string_|[EntityMgr] if string, one of null, self, $this, 'otherClass', '$class' * convenient constants found in PcGenInterface
  • `variable` _string_ class/variable/property name * uppercase is autodetected as CONSTANT * variable $-prefixed
  • `index` _int_|_string_ opt array index
  • Return static
  • Throws InvalidArgumentException
* convenient shortcut for ```AssignClauseMgr::setTarget()```
* Give target result ```$this->property```
* ```property``` _string_
* ```index```  _int_|_string_ opt array index
* Return static
* Throws InvalidArgumentException

  • convenient shortcut for `AssignClauseMgr::setTarget()`
  • Give target result `$variable`
  • `variable` _string_
  • `index` _int_|_string_ opt array index
  • Return static
  • Throws InvalidArgumentException
* Only applicable for '$targetClass', ignored by the others
* ```forceTargetAsInstance``` _bool_
  * true : force ```$targetClass->property```
  * false : NOT, default (```$targetClass::$property```)
* Return _static_
---

  • Return _bool_|_int_|_float_|_string_, scalar
* Return _bool_ true if not null

  • Set a fixed (scalar) source
  • `fixedSourceValue` _bool_|_int_|_float_|_string_, scalar
  • Return _static_
  • Throws InvalidException ---
* Set a PHP expression
* ```expression``` _string_
* Return _static_
* Throws InvalidException
---

  • Return [EntityMgr]
* Return _bool_ true if not null

  • `class` _string_ if string, one of null, self, $this, 'otherClass', '$class' * convenient constants found in PcGenInterface
  • `variable` _string_ class/variable/property/constant name * variable $-prefixed
  • `index` _int_|_string_ opt array index
  • Return static
  • Throws InvalidArgumentException
* ```source``` [EntityMgr]
  *  note ```EntityMgr``` below
* Return static
* Throws InvalidArgumentException

  • convenient shortcut for `AssignClauseMgr::setSource()`
  • Give source result `$this->property`
  • `property` _string_
  • `index` _int_|_string_ opt array index
  • Return static
  • Throws InvalidArgumentException
* convenient shortcut for ```AssignClauseMgr::setSource()```
* Give source result ```$variable```
* ```variable``` _string_
* ```index```  _int_|_string_ opt array index
* Return static
* Throws InvalidArgumentException

  • `isConst` _bool_ * true : force `$class::CONSTANT` * false : NOT, (default) `$class->$constant`
  • Return _static_
* ```isConst``` _bool_
  * true : force ```$class::variable```
  * false : NOT, default, ```$class->$variable``` 
* Return _static_
---

* Return _bool_ true if not null

  • `fcnInvoke` [FcnInvokeMgr]
  • Return static
  • Throws InvalidArgumentException
* ```fcnInvoke``` [FcnInvokeMgr]\[]  
* Return static
* Throws InvalidArgumentException

Note on chained invokes
* The first must have a "class" : parent, self, $this, 'otherClass', '$class' when next is set
* All but first must have $this, 'otherClass', '$class'

Ex on _AssignClauseMgr::setFcnInvoke_ input

[

FcnInvokeMgr::factory( 'aClass', 'factory', [ 'arg1', 'arg2' ] ),
FcnInvokeMgr::factory( 'aClass', 'someMethod', [ 'arg3', 'arg4' ] )

]

results in 

aClass::factory( $arg1, arg2 )

->someMethod( $arg3, arg4 );
---

  • Default assign operator is `=`
  • `operator` _string_, one of `=`, `+=`, ..., see [operators]
  • Return _static_
  • Throws InvalidException ---

Misc

_EntityMgr_ instance creation ([EntityMgr])<br><br>

* ```class```, _string_, one of ```null```, ```self```, ```this```, ```otherClass``` (fqcn), ```$class```
  * convenient constants found in PcGenInterface
* ```fcnName``` _string_, the name
---
<small>Return to [README] - [Summary]</small>

[ChainInvokeMgr]:ChainInvokeMgr.md
[Common methods]:CommonMethods.md
[EntityMgr]:EntityMgr.md
[FcnInvokeMgr]:FcnInvokeMgr.md
[operators]:https://www.php.net/manual/en/language.operators.assignment.php
[PropertyMgr]:PropertyMgr.md
[README]:../README.md
[Summary]:Summary.md
[VariableMgr]:VariableMgr.md

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