Constants

TYPE

TYPE

CIRCLE

CIRCLE

DEFS

DEFS

GROUP

GROUP

LINE

LINE

MARKER

MARKER

PATH

PATH

RECT

RECT

SVG

SVG

TEXT

TEXT

Properties

$mandatoryFields

$mandatoryFields

$attributes

$attributes : array

The array that holds all attributes

Type

array

$elementString

$elementString : string

The string that has all the element as a string

Type

string

$childElements

$childElements : \SVGCreator\Element[]

Array with the child elements

Type

\SVGCreator\Element[]

$defs

$defs : array

Definitons array

Type

array

$text

$text : string

The text to put inside the element

Type

string

Methods

__construct()

__construct( $attributes)

Parameters

$attributes

attr()

attr(mixed $attrKey, string $attrValue) : mixed

Set's an attribute for the current element

Parameters

mixed $attrKey

The name of the attribute

string $attrValue

The value of the attribute

Returns

mixed —

Could be an \SVGCreator\Element or could be the value of the attribute, this means that the second parameter wasn't passed

append()

append(mixed $element) : \SVGCreator\Element

Appends an element to the current element

Parameters

mixed $element

The element to append to this element could be an object \SVGCreator\Element or a string of the type to create

Returns

\SVGCreator\Element

The element append

getString()

getString() : string

Returns the element string

Returns

string —

Returns the element string

saveElementAsFile()

saveElementAsFile(string $fileName) : string

Saves the element as a file

Parameters

string $fileName

The filename with path to save

Returns

string —

Returns the filename or false on failure

text()

text(string $text) : \SVGCreator\Element

Set's or returns the text of the element

Parameters

string $text

The text to add to the element

Returns

\SVGCreator\Element

validateElementValues()

validateElementValues()

getDefs()

getDefs() : array

Returns the defs array for this element

Returns

array

setDefs()

setDefs( $defs) : \SVGCreator\Element

Set's the definition array

Parameters

$defs

Returns

\SVGCreator\Element

validateMandatoryAttribs()

validateMandatoryAttribs()

validateElement()

validateElement()

factoryElement()

factoryElement(string $type) : \SVGCreator\Element

Factory for building the several elements available

Parameters

string $type

The type of element to build

Returns

\SVGCreator\Element