public function encode($data)
    {
        // loop over params, look for closure
        if (
            // not a server exception
            !($data instanceof \Plinker\Core\Exception\Server) &&
            // params should be set & array
            isset($data['params']) && is_array($data['params'])) {
            foreach ($data['params'] as $key => $param) {
                if (is_object($param) && ($param instanceof \Closure)) {
                    $data['params'][$key] = new SerializableClosure($param);
                }
            }
        }
        
        $data = serialize($data);

        return [
            "data"  => $this->encrypt($data, $this->config["secret"]),
            "token" => hash_hmac(
                "sha256",
                $data,
                $this->config["secret"]
            )
        ];
    }