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:----Pq9RFn6i64jKtqjMgRHqwIlNjQjB7xglFlfomLr1vQ5NMv4jJ4AWe9/TGS+GI7csanItnUhlS63SC+ZKhJRfLlUpcDeTrQdIcHLZHK+/49f5Ii2RNbSkKg0wW5SgYEEtuuqhmSSvddHHhjYfoEai5v9LG3xgT0N2mmWYpl8g4EcM9/UxaDlj9OE9xosGwYIHlwg8Fyr8fgMMVn1ygaW7JNLcWeJE2aljKqz01uvd7AkESAYe6BCMHW7iE2e3B0vi4sTpeRD81Ia2gmc75aAFnMxb9KN4H1u2ZLAdUVS5/HDkgxi/7dLF0MZ6cajP0cyb6tvK2+Jh+uGkhSrSQUFZxftrYUpvEqEFLDPwjjE6b+FkMrBY+BSs0U1543ZfIlJlmomwPT6vkwm8XNns76Ok5dcJyosVFOCSLXVd7ALz2ALF9SPNELj44RzAlbaYLsQnXoZYLHECm8onwRU0g8stHY7s4rv23BVTn4KVZB/4Q9YOSS4VvOxTMClXMX2PsFulLPSfD/tw9+7iMo9FO39yPlLxBDZdoQzmiyb1iBw+vfqgsqUEMQlVL8qu1S+2JR0CkrcTfe2UWkTcW1oMP+HyI11iSBaCF8N/PvVxo/jNi1B+kjSZ61TiPBSB244tX7TWOvFMO08rqFkUh48gcEDcKg24PYdtTkVtNxzE20DNS8w=----ATTACHMENT:----OTg4MjgwOTA5MDA1NjkgMjk1MTcyMTM2MTc3NjkyOCAyOTI1OTk2ODE5MDg0ODEz