woocommerce/classes/abstracts/abstract-wc-session.php

66 lines
1.3 KiB
PHP
Raw Normal View History

<?php
/**
* Handle data for the current customers session.
*
* @class WC_Session
2012-12-03 19:19:58 +00:00
* @version 2.0.0
* @package WooCommerce/Classes/Abstracts
* @author WooThemes
*/
abstract class WC_Session {
/** _data */
protected $_data = array();
/** When something changes */
protected $_dirty = false;
2012-11-27 16:22:47 +00:00
/**
* __get function.
2012-11-27 16:22:47 +00:00
*
* @access public
* @param mixed $property
* @return mixed
*/
public function __get( $property ) {
return isset( $this->_data[ $property ] ) ? $this->_data[ $property ] : null;
}
2012-11-27 16:22:47 +00:00
/**
* __set function.
2012-11-27 16:22:47 +00:00
*
* @access public
* @param mixed $property
* @param mixed $value
* @return void
*/
public function __set( $property, $value ) {
$this->_data[ $property ] = $value;
$this->_dirty = true;
}
2012-11-27 16:22:47 +00:00
/**
* __isset function.
2012-11-27 16:22:47 +00:00
*
* @access public
* @param mixed $property
* @return bool
*/
public function __isset( $property ) {
return isset( $this->_data[ $property ] );
}
2012-11-27 16:22:47 +00:00
/**
* __unset function.
2012-11-27 16:22:47 +00:00
*
* @access public
* @param mixed $property
* @return void
*/
public function __unset( $property ) {
if ( isset( $this->_data[ $property ] ) ) {
unset( $this->_data[ $property ] );
$this->_dirty = true;
}
}
}