Properties

$data

$data : array

Type

array — The main array which is containing the data

Methods

__construct()

__construct(array $arr) : void

Constructor

Parameters

array $arr

merge()

merge(array $arr) : void

Adds an array to the dataset

Parameters

array $arr

add()

add(\Xily\arr $arr, bool $keep) : void

Only adds additional settings to the data set

Parameters

\Xily\arr $arr
bool $keep

Keep current values

push()

push(string $value) : void

Pushes a new value to the array

Parameters

string $value

addOptions()

addOptions(string $opt, string $delim, string $sign) : void

Adds an option string to the data set

Parameters

string $opt

Option string ("option1:value1,option2:value2")

string $delim

Delimiter for the option statement

string $sign

Textual representations of the assignment

set()

set(string|array $mxt, string $value) : void

Sets a value for a specified attribute or sets a complete array

Parameters

string|array $mxt

Name of the attribute or complete array

string $value

Value to be set

get()

get(string $attr, string $type, mixed $default) : mixed

Returns a specified item from the object

Parameters

string $attr

Attribute name

string $type

Variable type

mixed $default

Default value

Returns

mixed

getFiltered()

getFiltered(string $attr, string $type, mixed $default, array $accept, array $refuse) : mixed

Returns a specified item from the object and applies a filter to the returned value

Parameters

string $attr

Attribute name

string $type

Variable type

mixed $default

Default value

array $accept

List of all values the variable may have

array $refuse

List of all values the variable may not have

Returns

mixed

getClear()

getClear() : array

Returns the complete data array of the object

Returns

array

has()

has(string $attr) : bool

Checks, whether the object has a specified attribute

Parameters

string $attr

Attribute name

Returns

bool

count()

count() : int

Counts the object's items

Returns

int

erase()

erase(string $attr) : void

Erases a specified attribute

Parameters

string $attr

Attribute name (If empty, the complete array will be cleared)

addCSV()

addCSV(string $csv, string $delim) : void

Adds data from a CSV string

Parameters

string $csv

The CSV string

string $delim

Delimiter

parseCsv()

parseCsv(mixed $csv, mixed $delim, mixed $wrapper, mixed $usetitles) : array

Parses a CSV string into an array

$csv = Xily\Dict::parseCsv(file_get_contents('data.csv'), ',', '"', true);

Parameters

mixed $csv
mixed $delim
mixed $wrapper
mixed $usetitles

Returns

array

implode()

implode(string $glue) : string

Implodes the array

Parameters

string $glue

Returns

string

insertInto()

insertInto(string $strTemplate, string $strPatternStart, string $strPatternEnd)

Insert the data into a template string

Parameters

string $strTemplate
string $strPatternStart
string $strPatternEnd

toXml()

toXml(string $strName, bool $bolAssoc) : \Xily\Xily\Xml

Converts the array data an Xily\Xml object

Parameters

string $strName

Name of the root element

bool $bolAssoc

Use the keys of an associative array to create the node titles. Otherwise, use "node"

Returns

\Xily\Xily\Xml

initValue()

initValue(int|float|array|bool|object|string $mxtValue, string $strType, int|float|array|bool|object|string $mxtDefault) : int|float|array|bool|object|string

Initialize a variable value

Parameters

int|float|array|bool|object|string $mxtValue

Value to initialize

string $strType

Variable type

int|float|array|bool|object|string $mxtDefault

Default value

Returns

int|float|array|bool|object|string —

Initialized value

initRequest()

initRequest(string $strKey, mixed $mxtDefault)

Initializes a request variable

Parameters

string $strKey

Name of the variable

mixed $mxtDefault

Default value

equationBuild()

equationBuild(string $strFilter, bool $bolList) : array

Creates an array containing the tree parameters attribute, operator and value to express an equation. The method also aims to simplify the operator by narrowing them down to <, >, =, and !

Parameters

string $strFilter

The filter string, e.g "x >= 10"

bool $bolList

Returns a list of all equations

Returns

array —

['attribute', 'operator', 'value']

equationCheck()

equationCheck(string $strValue1, string $strValue2, string $strOperator) : bool

Checks, if an equation is correct

Parameters

string $strValue1

First parameter

string $strValue2

Second parameter

string $strOperator

Equation operator (==, !=, <, >, <=, >=)

Returns

bool

strStripQuotes()

strStripQuotes(string $strQuote) : string

Strips the quote symbols form a string

Parameters

string $strQuote

Returns

string

strStripBrackets()

strStripBrackets(string $strQuote) : string

Strips the brackets from the beginning and end of a string

Parameters

string $strQuote

Returns

string

strStripString()

strStripString(string $strText, string $strOpen, string $strClose, bool $bolStrict) : string

Strips defined chars from the beginning and the end of a string

Parameters

string $strText
string $strOpen
string $strClose
bool $bolStrict

Only strip symmetrical strings

Returns

string

strStripWhitespaces()

strStripWhitespaces(string $strText) : string

Strips all whitespaces from the beginning and end of a string

Parameters

string $strText

Returns

string

strStripInline()

strStripInline(string $strText, bool $bolLineBreaks) : string

Reduces a paragraph to one single line, removing all linebreaks, tabs and blank spaces

Parameters

string $strText
bool $bolLineBreaks

If set, also linebreaks are removed (otherwise only tabs and blank spaces)

Returns

string

strShorten()

strShorten(string $strText, int $numLength, bool $bolDots, bool $bolWords) : string

Shortens a string to a specified number of chars.

Parameters

string $strText
int $numLength
bool $bolDots

Puts three dots [...] at the end of the shortened string.

bool $bolWords

Respect single words when shortening a text.

Returns

string

strToFloat()

strToFloat(string $strNumber, bool $bolNegative) : float

Converts a formated string into a float

Parameters

string $strNumber

The formated number, e.g. "1,293.00 €"

bool $bolNegative

Support negative numbers

Returns

float

htmlDecode()

htmlDecode(string $strHTML, bool $bolBreak) : string

Converts a HTML string into a plain text string, decoding existing HTML special chars

Parameters

string $strHTML
bool $bolBreak

Also replace
linebreaks in regular linebreaks "\n"

Returns

string

htmlEncode()

htmlEncode(string $strText, string $bolBreak) : \Xily\unknown

Converts a regular string into HTML code, encoding HTML special chars.

Parameters

string $strText
string $bolBreak

If linebreak is true, the function will add
linebreaks

Returns

\Xily\unknown

xmlChars()

xmlChars(string $strRaw) : string

Encodes special XML characters

Parameters

string $strRaw

Returns

string

createUID()

createUID() : string

Creates a unique identifier

Returns

string

fileFormatDir()

fileFormatDir(string $strDirectory, string $strSlash) : string

Makes sure the directory ends with a slash

Parameters

string $strDirectory

The directory

string $strSlash

The slash format (default is DIRECTORY_SEPARATOR)

Returns

string

fileRead()

fileRead(string $strFile) : string|bool

Reads the contents of a file to a string

Parameters

string $strFile

The filename

Returns

string|bool

fileReadByLine()

fileReadByLine(string $strFile, \Xily\stirng $strFunction) : string

Reads the contents of a file to a string line by line and optionally calls a function for each line

Parameters

string $strFile

The filename

\Xily\stirng $strFunction

Name of the function to be called for each line

Returns

string —

The file contents

fileWrite()

fileWrite(string $strFile, string $strText, bool $bolModeAdd) : bool

Writes a string to a file

Parameters

string $strFile

The filename

string $strText

String to write

bool $bolModeAdd

Appends the string at the end of the file

Returns

bool

fileRemoveDir()

fileRemoveDir(string $strDirectory, bool $bolEmpty) : bool

Recursively removes a directory and the files and subdirectories contained in it

Parameters

string $strDirectory
bool $bolEmpty

Declaration of the directory to be empty

Returns

bool

fileCopyDir()

fileCopyDir(string $strDirectory, string $strDestination, bool $bolCreate) : bool

Recursively copies a directory and the files and subdirectories contained in it

Parameters

string $strDirectory
string $strDestination
bool $bolCreate

This option defines, if the whole directory should be copied or only its contents

Returns

bool

fileListDir()

fileListDir(string $strDirName, string $strFiletype) : array

Returns an array with the contents of a directory

Parameters

string $strDirName

The directory name

string $strFiletype

Filter for certain file extensions

Returns

array

fileGetExtension()

fileGetExtension(string $strFilename) : string

Returns the file extension

Parameters

string $strFilename

Filename

Returns

string

fileRename()

fileRename(string $strOldFileName, string $strNewFileName) : bool

Renames a file

Parameters

string $strOldFileName
string $strNewFileName

Returns

bool

probe()

probe(string $strSource, string $strMessage, int $intLevel) : bool

Echos a message, if modeDebug is active. This function can be very useful to place status messages in your functions, to gain some insights of what your program is doing.

Parameters

string $strSource

The function's name where the probe is placed

string $strMessage

The debug message

int $intLevel

Priority/Level of the message

Returns

bool —

Returns, whether the probe was echoed

getFromPath()

getFromPath(array $data, string $path, string $type, mixed $default) : mixed

Returns a specified item from the object

Parameters

array $data

The data array

string $path

Attribute name

string $type

Variable type

mixed $default

Default value

Returns

mixed

getValue()

getValue(array $data, string $attr, string $type, mixed $default) : mixed

Returns a specified item from the object

Parameters

array $data

The data array

string $attr

Attribute name

string $type

Variable type

mixed $default

Default value

Returns

mixed

fromXml()

fromXml(\Xily\Xily\Xml $xmlNode, array $mxtData, bool $bolAssoc) : \Xily\Xily\Xml

Converts the array into an Xily\Xml object

Parameters

\Xily\Xily\Xml $xmlNode
array $mxtData
bool $bolAssoc

Returns

\Xily\Xily\Xml

checkAssoc()

checkAssoc(array $a)

Check, if the array is associative

Parameters

array $a