You are here

public function Purge::__sleep in Purge 7.2

Only serialize the static values.

1 call to Purge::__sleep()
PurgePurgerBundle::__sleep in includes/purge.class.inc
Override for parents sleep to make sure we include the bundled objects.
1 method overrides Purge::__sleep()
PurgePurgerBundle::__sleep in includes/purge.class.inc
Override for parents sleep to make sure we include the bundled objects.

File

includes/purge.class.inc, line 112
Contains all class and interface definitions for Purge.

Class

Purge
Class for purge configuration management.

Code

public function __sleep() {
  $return_properties = array();
  $basic_properties = array(
    'name',
    'description',
    'enabled',
    'access',
  );
  $return_properties = $basic_properties;

  // Build the static item array so we don't have to serialize all objects.
  if (count($this->item)) {

    // Make sure the item array is serialized once finished.
    $return_properties[] = 'item';

    //
    foreach ($this->item as $type_name => $items) {

      // Check we're parsing an option and this is a Purger.
      if ($this instanceof PurgePurger && ($type_name = 'option')) {

        // Store the option values in this purges item array.
        $this->item['option'] = array();
        foreach ($this->option as $option_name => $option) {
          $this->item['option'][$option_name] = array();

          // Set the current value of the option in the item array.
          $this->item['option'][$option_name] = $option->value;
        }
      }
      else {
        $this->item[$type_name] = array();

        // .
        foreach ($items as $item_name => $item) {
          $this->item[$type_name][] = $item_name;
        }
      }
    }
  }
  return $return_properties;
}