ValueGenerator
extends AbstractGenerator
in package
Table of Contents
Constants
- LINE_FEED = "\n"
- Line feed to use in place of EOL
- OUTPUT_MULTIPLE_LINE = 'multipleLine'
- OUTPUT_SINGLE_LINE = 'singleLine'
- TYPE_ARRAY = 'array'
- TYPE_ARRAY_LONG = 'array_long'
- TYPE_ARRAY_SHORT = 'array_short'
- TYPE_AUTO = 'auto'
- TYPE_BOOL = 'bool'
- TYPE_BOOLEAN = 'boolean'
- TYPE_CONSTANT = 'constant'
- TYPE_DOUBLE = 'double'
- TYPE_FLOAT = 'float'
- TYPE_INT = 'int'
- TYPE_INTEGER = 'integer'
- TYPE_NULL = 'null'
- TYPE_NUMBER = 'number'
- TYPE_OBJECT = 'object'
- TYPE_OTHER = 'other'
- TYPE_STRING = 'string'
Properties
- $allowedTypes : array<string|int, mixed>
- $arrayDepth : int
- $constants : ArrayObject|ArrayObject
- Autodetectable constants
- $indentation : string
- $isSourceDirty : bool
- $outputMode : string
- $sourceContent : string|null
- TODO: Type should be changed to "string" in the next major version. Nullable for BC
- $type : string
- $value : mixed
Methods
- __construct() : mixed
- __toString() : string
- addConstant() : $this
- Add constant to list
- deleteConstant() : bool
- Delete constant from constant list
- escape() : string
- Quotes value for PHP code.
- generate() : string
- getArrayDepth() : int
- getAutoDeterminedType() : string
- getConstants() : ArrayObject|ArrayObject
- Return constant list
- getIndentation() : string
- getOutputMode() : string
- getSourceContent() : string|null
- getType() : string
- getValue() : mixed
- initEnvironmentConstants() : mixed
- Init constant list by defined and magic constants
- isSourceDirty() : bool
- isValidConstantType() : bool
- setArrayDepth() : ValueGenerator
- setIndentation() : AbstractGenerator
- setOptions() : AbstractGenerator
- setOutputMode() : ValueGenerator
- setSourceContent() : AbstractGenerator
- setSourceDirty() : AbstractGenerator
- setType() : ValueGenerator
- setValue() : ValueGenerator
- getValidatedType() : string
Constants
LINE_FEED
Line feed to use in place of EOL
public
mixed
LINE_FEED
= "\n"
OUTPUT_MULTIPLE_LINE
public
mixed
OUTPUT_MULTIPLE_LINE
= 'multipleLine'
OUTPUT_SINGLE_LINE
public
mixed
OUTPUT_SINGLE_LINE
= 'singleLine'
TYPE_ARRAY
public
mixed
TYPE_ARRAY
= 'array'
TYPE_ARRAY_LONG
public
mixed
TYPE_ARRAY_LONG
= 'array_long'
TYPE_ARRAY_SHORT
public
mixed
TYPE_ARRAY_SHORT
= 'array_short'
TYPE_AUTO
public
mixed
TYPE_AUTO
= 'auto'
TYPE_BOOL
public
mixed
TYPE_BOOL
= 'bool'
TYPE_BOOLEAN
public
mixed
TYPE_BOOLEAN
= 'boolean'
TYPE_CONSTANT
public
mixed
TYPE_CONSTANT
= 'constant'
TYPE_DOUBLE
public
mixed
TYPE_DOUBLE
= 'double'
TYPE_FLOAT
public
mixed
TYPE_FLOAT
= 'float'
TYPE_INT
public
mixed
TYPE_INT
= 'int'
TYPE_INTEGER
public
mixed
TYPE_INTEGER
= 'integer'
TYPE_NULL
public
mixed
TYPE_NULL
= 'null'
TYPE_NUMBER
public
mixed
TYPE_NUMBER
= 'number'
TYPE_OBJECT
public
mixed
TYPE_OBJECT
= 'object'
TYPE_OTHER
public
mixed
TYPE_OTHER
= 'other'
TYPE_STRING
public
mixed
TYPE_STRING
= 'string'
Properties
$allowedTypes
protected
array<string|int, mixed>
$allowedTypes
= []
$arrayDepth
protected
int
$arrayDepth
= 0
$constants
Autodetectable constants
protected
ArrayObject|ArrayObject
$constants
$indentation
protected
string
$indentation
= ' '
4 spaces by default
$isSourceDirty
protected
bool
$isSourceDirty
= true
$outputMode
protected
string
$outputMode
= self::OUTPUT_MULTIPLE_LINE
$sourceContent
TODO: Type should be changed to "string" in the next major version. Nullable for BC
protected
string|null
$sourceContent
= null
$type
protected
string
$type
= self::TYPE_AUTO
$value
protected
mixed
$value
Methods
__construct()
public
__construct([mixed $value = null ][, string $type = self::TYPE_AUTO ][, string $outputMode = self::OUTPUT_MULTIPLE_LINE ][, null|ArrayObject|ArrayObject $constants = null ]) : mixed
Parameters
- $value : mixed = null
- $type : string = self::TYPE_AUTO
- $outputMode : string = self::OUTPUT_MULTIPLE_LINE
- $constants : null|ArrayObject|ArrayObject = null
__toString()
public
__toString() : string
Return values
stringaddConstant()
Add constant to list
public
addConstant(string $constant) : $this
Parameters
- $constant : string
Return values
$thisdeleteConstant()
Delete constant from constant list
public
deleteConstant(string $constant) : bool
Parameters
- $constant : string
Return values
boolescape()
Quotes value for PHP code.
public
static escape(string $input[, bool $quote = true ]) : string
Parameters
- $input : string
-
Raw string.
- $quote : bool = true
-
Whether add surrounding quotes or not.
Return values
string —PHP-ready code.
generate()
public
generate() : string
Tags
Return values
stringgetArrayDepth()
public
getArrayDepth() : int
Return values
intgetAutoDeterminedType()
public
getAutoDeterminedType(mixed $value) : string
Parameters
- $value : mixed
Return values
stringgetConstants()
Return constant list
public
getConstants() : ArrayObject|ArrayObject
Return values
ArrayObject|ArrayObjectgetIndentation()
public
getIndentation() : string
Return values
stringgetOutputMode()
public
getOutputMode() : string
Return values
stringgetSourceContent()
public
getSourceContent() : string|null
Return values
string|nullgetType()
public
getType() : string
Return values
stringgetValue()
public
getValue() : mixed
initEnvironmentConstants()
Init constant list by defined and magic constants
public
initEnvironmentConstants() : mixed
isSourceDirty()
public
isSourceDirty() : bool
Return values
boolisValidConstantType()
public
isValidConstantType() : bool
Return values
boolsetArrayDepth()
public
setArrayDepth(int $arrayDepth) : ValueGenerator
Parameters
- $arrayDepth : int
Return values
ValueGeneratorsetIndentation()
public
setIndentation(string $indentation) : AbstractGenerator
Parameters
- $indentation : string
Return values
AbstractGeneratorsetOptions()
public
setOptions(array<string|int, mixed>|Traversable $options) : AbstractGenerator
Parameters
- $options : array<string|int, mixed>|Traversable
Tags
Return values
AbstractGeneratorsetOutputMode()
public
setOutputMode(string $outputMode) : ValueGenerator
Parameters
- $outputMode : string
Return values
ValueGeneratorsetSourceContent()
public
setSourceContent(string|null $sourceContent) : AbstractGenerator
Parameters
- $sourceContent : string|null
Return values
AbstractGeneratorsetSourceDirty()
public
setSourceDirty([bool $isSourceDirty = true ]) : AbstractGenerator
Parameters
- $isSourceDirty : bool = true
Return values
AbstractGeneratorsetType()
public
setType(string $type) : ValueGenerator
Parameters
- $type : string
Return values
ValueGeneratorsetValue()
public
setValue(mixed $value) : ValueGenerator
Parameters
- $value : mixed
Return values
ValueGeneratorgetValidatedType()
protected
getValidatedType(string $type) : string
Parameters
- $type : string