/** * This routine simulates what would happen when a object is constructed * @param string $data * @return void */ public function unserialize($data) { $injector = \Injector::inst(); $extraData = null; if (empty(self::$objectConstructorReflectionMethods[__CLASS__])) { self::$objectConstructorReflectionMethods[__CLASS__] = new \ReflectionMethod(__CLASS__, '__construct'); } if (empty(self::$classConfigs[__CLASS__])) { self::$classConfigs[__CLASS__] = $injector->getConfigLocator()->locateConfigFor(__CLASS__); } if ($this instanceof ExtraDataInterface) { $unserialized = \Heystack\Core\unserialize($data); self::$objectConstructorReflectionMethods[__CLASS__]->invoke($this, $unserialized[0]); $extraData = $unserialized[1]; } else { self::$objectConstructorReflectionMethods[__CLASS__]->invoke($this, \Heystack\Core\unserialize($data)); } // Ensure that the spec is loaded for the class if (self::$classConfigs[__CLASS__]) { $injector->load([__CLASS__ => self::$classConfigs[__CLASS__]]); } $injector->inject($this, __CLASS__); if ($extraData) { $this->setExtraData($extraData); } }
/** * @param string $key * @return mixed|null */ public function getByKey($key) { return \Heystack\Core\unserialize($this->backend->getByKey($key)); }
/** * Unserializes the data into the data array * @param string $data * @return void */ public function unserialize($data) { $this->setData(\Heystack\Core\unserialize($data)); }