/** * Override serialize method * * @return string The serialized closure */ public function serialize() { if (static::$securityProvider === null) { throw new RuntimeException('You must set a security provider in order to use this class'); } $data = parent::serialize(); $data =& static::$securityProvider->sign($data); return serialize($data); }