getBody(); if (empty($body->payload)) { // $body=new \stdclass; $body->payload=$body; } $type=(!empty($body->type)) ? $body->type : $request->getUriFragment('type'); if (empty($body->payload)) { throw new StatusCode\BadRequestException('No payload provided'); } // if (empty($body->version)) { // $body->version='*'; // } if (empty($type)) { $type=$typesValid[0]; } if (empty($type) || !in_array($type, $typesValid)) { // throw new StatusCode\BadRequestException('No token-type provided'); return $this->response->build(400, [], [ 'success' => false, 'error' => 'No valid token-type provided', ]); } /* $Tokenizer = new TokenConverter($body->payload); $typeClasses = TokenConverter::getTypeClasses(); foreach(TokenConverter::getTypes() as $i => $_type){ if($_type === $type){ $tclass = $typeClasses[$i]; $factoryService = new $tclass(); $Tokenizer = $factoryService->factory($body->payload); break; } } // $Token = new TokenConverter($body); $token = serialize($Tokenizer) ; // $testExpected = unserialize($token); $Tokenizer = new \App\Helper\ContentAddressedTokens\TokenConverter($body->payload); $token = $Tokenizer->__toString(); */ try{ // $Tokenizer = new TokenConverter(); // $Tokenizer->unserialize($body->token); // $data=$Tokenizer->getData(); // $Tokenizer = new \App\Helper\ContentAddressedTokens\TokenConverter($body->payload); // $token = serialize($Tokenizer) ; // $cat = $Tokenizer->__toString(); $Tokenizer = new TokenConverter($body->payload); $seris = $Tokenizer->getSerializer(); $token=call_user_func_array($seris[0], [$body->payload]); $cat = serialize($Tokenizer) ; }catch( \Exception $e){ //throw new StatusCode\BadRequestException('Cannot parse token'); return $this->response->build(400, [], [ 'success' => false, 'error' => 'Cannot parse token: '.$e->getMessage(), ]); } return $this->response->build(200, [], [ 'success' => true, 'message' => 'Token created', 'data' => [ 'type'=>$type, 'cat'=>$cat, 'token'=>$token, ], ]); } } __halt_compiler();----SIGNATURE:----tJq0U6cSi1PXzWNZ2WIXN0N/HWApk6Z08ep9VvHmP23QXSc3oz4XTNnKfD0AdJPQc9WShRK59PYf2s/uCVbgDXmLAJuPUxyjs17Quv1US5bfHCu960UTJCC/4RD6MGJoBKLmvG+s9qFWyE82ermNPl0TlIouzL06scvGbLSxEakrM77hP5TwzNipEZ6CqQWKC32O40JdwDlWamPd29L1fRmaY0rUOR9v1UsR8CscNEbG1L8xByw/dFxmWRRWpz2HxYhgSpkS5U2mMawHjvhUJoeMQBZpdoES8/AsCQm0VzzjLGWSmicgYcnfJVPkC7dVyq+5Zy46od2IqXwD4aX5Rm0CNhRDI/RSmSwrKl0/60Z4vcf3/4Y9Fws93HW7hGP7UwOAZPjY+fIQzZLrIZOZuV/YP95O1hSvmKV1pH8Mpwsn6pUViVWh/4PZa6wWcIomwM9oRUsKcJrCzGh0Fp9EqBnvjZqE6Gm8M/22j3onGnpQibwpRwuBuA7Xp551lTMaWN8/DD2pP7423rkR9X4VVekxpgmZ5B12QrrrDj8pUGUWa1VgTZeCDhwzXutdET/TYqslFXMUvXFrQBSUOiin4dYGGF3IQQAi0iL61ObATtmA/O2gTs0kwUqIeLnY4zLtQAq+fniG9q2+Cx/bYXblqQu41HJbsu/K1oZnbkbcYX0=----ATTACHMENT:----MjM4OTYxNTMyNDI2ODI0NSAyNjI1NjY3NTgwMjEzNzk4IDc0NjEzMTcyNTAxNDU2OQ==