<?php if (!defined('VB_ENTRY')) die('Access denied.'); class vB_Context { use vB_Trait_NoSerialize; private $_key; private $_values = array(); private $_id; public function __construct($key = false, $values = false) { $this->_key = $key; if (is_array($values)) { $this->_values = $values; } } public function __set($property, $value) { $this->_values[$property] = $value; $this->_id = false; } public function getId() { if (!$this->_id) { ksort($this->_values); $result = serialize($this->_values); $this->_id = md5($result); if ($this->_key) { $this->_id = substr($this->_key . '.' . $this->_id, 0, 64); } } return $this->_id; } public function __toString() { return $this->getId(); } } 