SetaPDF_Core_Type_Array Class representing an array

File: /SetaPDF/Core/Type/Array.php

Class hierarchy

Implements

Summary

Properties

$_count

protected integer SetaPDF_Core_Type_Array::$_count = 0

The array count

$_observed

protected boolean SetaPDF_Core_Type_Array::$_observed = false

Defines if this object is under observation

$_observers

protected array SetaPDF_Core_Type_Array::$_observers = array()

This will be the PDF document or another value holding this one. Initially this will be an array.

$_values

protected $_values array SetaPDF_Core_Type_Array::$_values = array()

An array of SetaPDF_Core_Type_AbstractType objects


Static Methods

writePdfString()

static public void SetaPDF_Core_Type_Array::writePdfString ( SetaPDF_Core_WriteInterface $writer, array $values )

Parses a php array to a pdf array string and writes it into a writer.

Parameters
$writer : SetaPDF_Core_WriteInterface
 
$values : array
 
Exceptions

Throws InvalidArgumentException

See

Methods

__construct()

public SetaPDF_Core_Type_Array::__construct ( [ array $values = null ] )

The constructor.

Parameters
$values : array

An array filled with values of type SetaPDF_Core_Type_AbstractType

Exceptions

Throws InvalidArgumentException

__sleep()

public array SetaPDF_Core_Type_AbstractType::__sleep ( void )

Implementation of __sleep.

We remove the observers from all elements because they will get read if they are waked up in an observed object.

__wakeup()

public void SetaPDF_Core_Type_AbstractType::__wakeup ( void )

Implementation of __wakeup.

Unset the observed flag.

attach()

public void SetaPDF_Core_Type_Array::attach ( SplObserver $observer )

Add an observer to the object.

This method forwards the attach()-call to all values of this array.

Parameters
$observer : SplObserver
 

cleanUp()

public void SetaPDF_Core_Type_Array::cleanUp ( void )

Release objects/memory.

See

clear()

public void SetaPDF_Core_Type_Array::clear ( void )

Clears the array.

count()

public int SetaPDF_Core_Type_Array::count ( void )

Returns the number of elements in the array.

current()

public SetaPDF_Core_Type_AbstractType SetaPDF_Core_Type_Array::current ( void )

Returns the current element.

deepClone()

public SetaPDF_Core_Type_AbstractType SetaPDF_Core_Type_Array::deepClone ( SetaPDF_Core_Document $document )

Clone the object recursively in the context of a document.

Parameters
$document : SetaPDF_Core_Document
 

detach()

public void SetaPDF_Core_Type_AbstractType::detach ( SplObserver $observer )

Detach an observer from the object.

Implementation of the Observer Pattern.

Parameters
$observer : SplObserver
 

detachAll()

public void SetaPDF_Core_Type_AbstractType::detachAll ( void )

Detach all observers from this object.

Be careful with this method!!!

ensure()

public SetaPDF_Core_Type_AbstractType SetaPDF_Core_Type_AbstractType::ensure ( [ boolean|null $forceObservation = null ] )

Returns the main value.

This method is used for automatically resolving of indirect references.

Parameters
$forceObservation : boolean|null
 

getChildren()

public array SetaPDF_Core_Type_Array::getChildren ( void )

Returns an iterator for the current entry.

getValue()

public array SetaPDF_Core_Type_Array::getValue ( void )

Gets the value.

hasChildren()

public boolean SetaPDF_Core_Type_Array::hasChildren ( void )

Check whether the current entry is an SetaPDF_Core_Type_Array.

indexOf()

public int SetaPDF_Core_Type_Array::indexOf ( SetaPDF_Core_Type_AbstractType $element )

Returns the index of the element.

If the element isn't in this array -1 will returned.

Parameters
$element : SetaPDF_Core_Type_AbstractType
 

insertBefore()

public void SetaPDF_Core_Type_Array::insertBefore ( SetaPDF_Core_Type_AbstractType $value [, null|integer $beforeIndex = 0 ] )

Inserts an element before another one.

Index mustn't be higher than the count of elements in array.

Index 0 is allowed in an empty array.

Parameters
$value : SetaPDF_Core_Type_AbstractType
 
$beforeIndex : null|integer
 
Exceptions

Throws InvalidArgumentException

isObserved()

public boolean SetaPDF_Core_Type_AbstractType::isObserved ( void )

Checks if this object is observed.

key()

public integer SetaPDF_Core_Type_Array::key ( void )

Returns the key of the current element.

merge()

public void SetaPDF_Core_Type_Array::merge ( void )

Merges this PDF array with other PDF arrays.

Exceptions

Throws InvalidArgumentException

mergeUnique()

public void SetaPDF_Core_Type_Array::mergeUnique ( void )

Merges this PDF array with other PDF arrays while only taking not existing values.

Exceptions

Throws InvalidArgumentException

next()

public SetaPDF_Core_Type_AbstractType SetaPDF_Core_Type_Array::next ( void )

Moves forward to next element.

notify()

public void SetaPDF_Core_Type_AbstractType::notify ( void )

Notifies all attached observers.

Implementation of the Observer Pattern.

Has to be called by any method that changes a value.

offsetExists()

public boolean SetaPDF_Core_Type_Array::offsetExists ( int $offset )

Checks whether a offset exists.

Parameters
$offset : int

An offset to check for.

offsetGet()

public SetaPDF_Core_Type_AbstractType|null SetaPDF_Core_Type_Array::offsetGet ( int $offset )

Offset to retrieve.

Parameters
$offset : int

The offset to retrieve.

offsetSet()

public void SetaPDF_Core_Type_Array::offsetSet ( null|int $offset, SetaPDF_Core_Type_AbstractType $value )

Offset to set.

Parameters
$offset : null|int

The offset to assign the value to.

$value : SetaPDF_Core_Type_AbstractType

The value to set.

Exceptions

Throws InvalidArgumentException

offsetUnset()

public void SetaPDF_Core_Type_Array::offsetUnset ( string $offset )

Checks whether a offset exists.

Parameters
$offset : string
 

push()

public void SetaPDF_Core_Type_Array::push ( SetaPDF_Core_Type_AbstractType $value )

Pushes a value onto the end of the array.

Parameters
$value : SetaPDF_Core_Type_AbstractType
 

rewind()

public void SetaPDF_Core_Type_Array::rewind ( void )

Rewinds the Iterator to the first element.

setValue()

public void SetaPDF_Core_Type_Array::setValue ( array|SetaPDF_Core_Type_Array $values )

Sets the values.

Parameters
$values : array|SetaPDF_Core_Type_Array

An array of SetaPDF_Core_Type_AbstractType objects

Exceptions

Throws InvalidArgumentException

toPdfString()

public string SetaPDF_Core_Type_Array::toPdfString ( SetaPDF_Core_Document $pdfDocument )

Returns the type as a formatted PDF string.

Parameters
$pdfDocument : SetaPDF_Core_Document
 

toPhp()

public array SetaPDF_Core_Type_Array::toPhp ( void )

Converts the PDF data type to a PHP data type and returns it.

See

unshift()

public void SetaPDF_Core_Type_Array::unshift ( SetaPDF_Core_Type_AbstractType $value )

Prepends one element to the beginning of the array.

Parameters
$value : SetaPDF_Core_Type_AbstractType
 

update()

public void SetaPDF_Core_Type_Array::update ( SplSubject $SplSubject )

Triggered if a value of this object is changed.

Forward this to other observers.

Parameters
$SplSubject : SplSubject
 

valid()

public boolean SetaPDF_Core_Type_Array::valid ( void )

Checks if current position is valid.

See

writeTo()

public void SetaPDF_Core_Type_Array::writeTo ( SetaPDF_Core_Document $pdfDocument )

Writes the type as a formatted PDF string to the document.

Parameters
$pdfDocument : SetaPDF_Core_Document