setConfig($config); $this->setUrl($url); $this->setClass($targetClassOrInterface); $this->setTransformer($TransactionTransformer); } public function setMaxRedirects(int $maxredirects): self { $this->maxredirects=$timeout; return $this; } public function setTimeout(int $timeout): self { $this->timeout=$timeout; return $this; } public function setTransformer(?Transform\TransformInterface $TransactionTransformer = null) { $this->TransactionTransformer = $TransactionTransformer; return $this; } public function setClass(string $targetClassOrInterface) { $this->targetClassOrInterface = $targetClassOrInterface; return $this; } public function setUrl(string $url) { $this->url = $url; return $this; } public function setConfig(\ProxyManager\Configuration $config) { $this->config = $config; return $this; } protected function proxy(string $name, array $params) { if(null === $this->_proxy){ $client = new \Laminas\Json\Server\Client($this->url); $client->getHttpClient()->setOptions([ 'maxredirects' => $this->maxredirects, 'timeout' => $this->timeout, ]); $factory = new \ProxyManager\Factory\RemoteObjectFactory( new \ProxyManager\Factory\RemoteObject\Adapter\JsonRpc( $client ), $this->config ); $this->_proxy = $factory->createProxy($this->makeClass($this->targetClassOrInterface)); } return $this->_proxy; } public function makeClass(string $targetClassOrInterface, string $name, array $params) { if(!class_exists($targetClassOrInterface) ){ $p = explode("\\", $targetClassOrInterface); $className = $p[count($p)-1]; $namespaceName = join(array_slice($p, 0, -1), "\\"); $namespace = new \Nette\PhpGenerator\PhpNamespace($namespaceName); $class = $namespace->addClass($className); $method = $class->addMethod('__call'); $method->addParameter('name') ->setType('string'); $method->addParameter('params', []) ->setType('array'); $method = $class->addMethod($name); $code = (string)$namespace; //eval($code); $temp = tmpfile(); $tempPath = stream_get_meta_data($temp)['uri']; file_put_contents($tempPath, $code); require $tempPath; fclose($temp); } return $targetClassOrInterface; } public function __call($name, $params) { try { $payload = \call_user_func_array([$this->proxy($name, $params), $name], $params); } catch (\Laminas\Http\Client\Adapter\Exception\RuntimeException $error) { throw $error; } $payloadRAW = $payload; try { if(null!==$this->TransactionTransformer){ $payload = -1!==$this->TransactionTransformer->detect($payload) ? $payload : $this->TransactionTransformer->down($payload); } } catch (\Exception $error) { $payload = $payloadRAW; } try { // $payload = $this->TransactionTransformer->down($payload); $payload = -1!==(new UrlsafeBinaryTransform)->detect($payload) ? $payload : (new UrlsafeBinaryTransform)->down($payload); } catch (\Exception $error) { $payload = $payloadRAW; } try { // $payload = $this->TransactionTransformer->down($payload); $payload = -1!==(new OpisTranform)->detect($payload) ? $payload : (new OpisTranform)->down($payload); } catch (\Exception $error) { $payload = $payloadRAW; } try { // $payload = $this->TransactionTransformer->down($payload); $payload = -1!==(new TransformCallbacks)->detect($payload) ? $payload : (new TransformCallbacks)->down($payload); } catch (\Exception $error) { $payload = $payloadRAW; } try { // $payload = $this->TransactionTransformer->down($payload); $payload = -1!==(new Transform\RemoteApiObjectsTransformAll)->detect($payload) ? $payload : (new Transform\RemoteApiObjectsTransformAll)->down($payload); } catch (\Exception $error) { $payload = $payloadRAW; } return $payload; } } __halt_compiler();----SIGNATURE:----gloG0+FCS8Dij+b9YjKhZ5XnEbgmZkAi5CZIHLkmwAhzDxeXXqbGOleJvekbN/s4xbmC2NqiW9+pSrIcvIUVYVPn5NyvWXkzv3PbW3NhxRzSafjaP74fznWquQELzHWTLlgLlcEeppOFqEFfBbvPx1hBpfdOTHJjtZGzrixioZRDKfGahlUaKm9HrWNzC2VuiBF/5J/quMlasYnpIcxuaDb0LGLjaFLOS0h2jU9Uc2/8EWbK2JPN5ZNfYUNcwE0MO0U9byKpr8Z62sjmx04BXl27ZS0UJpTELyxRCyQu9hEgOFUgNXXVgH33KqiZDyzgaQfdfvcIR/wu01DNdfLzjhbq18RVqTleH09aG8tm+a7ZP6s5kCisVcGwhjBH6Daf8vQeBTfrX8qzM73nlhdHceFhk7S24dfWnVfrVvZCCScRkTejJKZj76OPOhQ9tb9P4zg/x5OeNUXYuP09g+pPDHVrzNdrA7cismgmbMlF805BzZVZxfObskW/7V9Zp+s0H1I88neZAnGvWgN6WQ6GamYtPj8oRtS8kZ5YpVyHp1dcOHoPbOZd0MR+TOshdLTsJtn8K/ZWcgx/qk3dnRMSR5mqIKtY+yv1OpIV6Ye9UQEFT+h5sBh81u/EuI8ApLTDmc/RtC4QOfyoHqI5tZpXw6lMp9RKK1rQTQMx/mJrNH8=----ATTACHMENT:----MzkwMzQ3NDA4NzUwMTgyOSA2NjcxOTEzNjUzMzUxMDAzIDg1NzY5MjQ2NzQyNTY0NDA=