Back to index

d-push  2.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
BodyPreference Class Reference
Inheritance diagram for BodyPreference:
Inheritance graph
[legend]
Collaboration diagram for BodyPreference:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 HasValues ()
 expected magic getters and setters
 GetID ()
 Returns the unique id of that data object.
 GetDataArray ()
 Returns the internal array which contains all data of this object.
 SetDataArray ($data, $markAsChanged=false)
 Sets the internal array which contains all data of this object.
 IsDataChanged ()
 Indicates if the data contained in this object was modified.
 __set ($name, $value)
 PHP magic to set an instance variable.
 __get ($name)
 PHP magic to get an instance variable if the variable was not set previousely, the value of the Unsetdata array is returned.
 __isset ($name)
 PHP magic to check if an instance variable is set.
 __unset ($name)
 PHP magic to remove an instance variable.
 __call ($name, $arguments)
 PHP magic to implement any getter, setter, has and delete operations on an instance variable.
 serialize ()
 Method to serialize a StateObject.
 unserialize ($data)
 Method to unserialize a StateObject.

Static Public Member Functions

static ThrowStateInvalidException ()
 Callback function for failed unserialize.

Protected Member Functions

 preSerialize ()
 Called before the StateObject is serialized.
 postUnserialize ()
 Called after the StateObject was unserialized.

Protected Attributes

 $unsetdata
 $data = array()
 $changed = false

Detailed Description

Definition at line 44 of file bodypreference.php.


Member Function Documentation

StateObject::__call ( name,
arguments 
) [inherited]

PHP magic to implement any getter, setter, has and delete operations on an instance variable.

Methods like e.g. "SetVariableName($x)" and "GetVariableName()" are supported

public

Returns:
mixed

Reimplemented in SyncParameters, and ContentParameters.

Definition at line 163 of file stateobject.php.

                                              {
        $name = strtolower($name);
        $operator = substr($name, 0,3);
        $var = substr($name,3);

        if ($operator == "set" && count($arguments) == 1){
            $this->$var = $arguments[0];
            return true;
        }

        if ($operator == "set" && count($arguments) == 2 && $arguments[1] === false){
            $this->data[$var] = $arguments[0];
            return true;
        }

        // getter without argument = return variable, null if not set
        if ($operator == "get" && count($arguments) == 0) {
            return $this->$var;
        }

        // getter with one argument = return variable if set, else the argument
        else if ($operator == "get" && count($arguments) == 1) {
            if (isset($this->$var)) {
                return $this->$var;
            }
            else
                return $arguments[0];
        }

        if ($operator == "has" && count($arguments) == 0)
            return isset($this->$var);

        if ($operator == "del" && count($arguments) == 0) {
            unset($this->$var);
            return true;
        }

        throw new FatalNotImplementedException(sprintf("StateObject->__call('%s'): not implemented. op: {$operator} args:". count($arguments), $name));
    }
StateObject::__get ( name) [inherited]

PHP magic to get an instance variable if the variable was not set previousely, the value of the Unsetdata array is returned.

public

Returns:

Definition at line 120 of file stateobject.php.

                                 {
        $lname = strtolower($name);

        if (array_key_exists($lname, $this->data))
            return $this->data[$lname];

        if (isset($this->unsetdata) && is_array($this->unsetdata) && array_key_exists($lname, $this->unsetdata))
            return $this->unsetdata[$lname];

        return null;
    }
StateObject::__isset ( name) [inherited]

PHP magic to check if an instance variable is set.

public

Returns:

Definition at line 138 of file stateobject.php.

                                   {
        return isset($this->data[strtolower($name)]);
    }
StateObject::__set ( name,
value 
) [inherited]

PHP magic to set an instance variable.

public

Returns:

Definition at line 103 of file stateobject.php.

                                         {
        $lname = strtolower($name);
        if (isset($this->data[$lname]) && is_scalar($value) && !is_array($value) && $this->data[$lname] === $value)
            return false;

        $this->data[$lname] = $value;
        $this->changed = true;
    }
StateObject::__unset ( name) [inherited]

PHP magic to remove an instance variable.

public

Returns:

Definition at line 148 of file stateobject.php.

                                   {
        if (isset($this->$name)) {
            unset($this->data[strtolower($name)]);
            $this->changed = true;
        }
    }
StateObject::GetDataArray ( ) [inherited]

Returns the internal array which contains all data of this object.

public

Returns:
array

Definition at line 69 of file stateobject.php.

                                   {
        return $this->data;
    }
StateObject::GetID ( ) [inherited]

Returns the unique id of that data object.

public

Returns:
array

Definition at line 56 of file stateobject.php.

                            {
        if (!isset($this->SO_internalid))
            $this->SO_internalid = sprintf('%04x%04x%04x', mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff));

        return $this->SO_internalid;
    }

Here is the caller graph for this function:

expected magic getters and setters

GetTruncationSize() + SetTruncationSize() GetAllOrNone() + SetAllOrNone() GetPreview() + SetPreview() Indicates if this object has values

public

Returns:
boolean

Definition at line 64 of file bodypreference.php.

                                {
        return (count($this->data) > 0);
    }
StateObject::IsDataChanged ( ) [inherited]

Indicates if the data contained in this object was modified.

public

Returns:
array

Definition at line 93 of file stateobject.php.

                                    {
        return $this->changed;
    }
StateObject::postUnserialize ( ) [protected, inherited]

Called after the StateObject was unserialized.

protected

Returns:
boolean

Reimplemented in SyncParameters.

Definition at line 253 of file stateobject.php.

                                         {
        return true;
    }

Here is the caller graph for this function:

StateObject::preSerialize ( ) [protected, inherited]

Called before the StateObject is serialized.

protected

Returns:
boolean

Reimplemented in SyncParameters, and ContentParameters.

Definition at line 240 of file stateobject.php.

                                      {
        // make sure the object has an id before serialization
        $this->GetID();

        return true;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

StateObject::serialize ( ) [inherited]

Method to serialize a StateObject.

public

Returns:
array

Definition at line 209 of file stateobject.php.

                                {
        // perform tasks just before serialization
        $this->preSerialize();

        return serialize(array($this->SO_internalid,$this->data));
    }

Here is the call graph for this function:

Here is the caller graph for this function:

StateObject::SetDataArray ( data,
markAsChanged = false 
) [inherited]

Sets the internal array which contains all data of this object.

Parameters:
array$datathe data to be written
boolean$markAsChanged(opt) indicates if the object should be marked as "changed", default false

public

Returns:
array

Definition at line 82 of file stateobject.php.

                                                                {
        $this->data = $data;
        $this->changed = $markAsChanged;
    }

Here is the caller graph for this function:

static StateObject::ThrowStateInvalidException ( ) [static, inherited]

Callback function for failed unserialize.

public

Exceptions:
StateInvalidException

Definition at line 263 of file stateobject.php.

                                                        {
        throw new StateInvalidException("Unserialization failed as class was not found or not compatible");
    }
StateObject::unserialize ( data) [inherited]

Method to unserialize a StateObject.

public

Returns:
array
Exceptions:
StateInvalidException

Definition at line 223 of file stateobject.php.

                                       {
        // throw a StateInvalidException if unserialize fails
        ini_set('unserialize_callback_func', 'StateObject::ThrowStateInvalidException');

        list($this->SO_internalid, $this->data) = unserialize($data);

        // perform tasks just after unserialization
        $this->postUnserialize();
        return true;
    }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

StateObject::$changed = false [protected, inherited]

Definition at line 48 of file stateobject.php.

StateObject::$data = array() [protected, inherited]

Definition at line 46 of file stateobject.php.

Initial value:
 array(   'truncationsize' => false,
                                    'allornone' => false,
                                    'preview' => false,
                                )

Reimplemented from StateObject.

Definition at line 45 of file bodypreference.php.


The documentation for this class was generated from the following file: