config = $config; $this->url = $url; $this->cache = $cache; $this->container=$container; } public function getCallbackSandbox() { if(null === $this->sandbox){ $sandboxCacheDir =$this->container->has('config.params.dirs.runtime.cache') ? rtrim($this->container->get('config.params.dirs.runtime.cache'), DIRECTORY_SEPARATOR) .DIRECTORY_SEPARATOR .'sbxp-parsed-php-vm-scripts'.DIRECTORY_SEPARATOR : @getenv('FRDL_WORKSPACE') .DIRECTORY_SEPARATOR. 'runtime' .DIRECTORY_SEPARATOR . 'cache' .DIRECTORY_SEPARATOR. 'sbxp-parsed-php-vm-scripts' .DIRECTORY_SEPARATOR; $this->sandbox = (new Webfan\Transform\TransformCallbacks()) ->setupCachepath($sandboxCacheDir) ->setupSandbox( $this->container->has('runtime.context.sandbox.containers') ? $this->container->get('runtime.context.sandbox.containers') : [ 'container'=>$this->container, ], $this->container->has('config.runtime.security.sandbox.allowed-functions') ? $this->container->get('config.runtime.security.sandbox.allowed-functions') : [], $this->container->has('config.sandbox.runtime.security.allowed-classes') ? $this->container->get('config.sandbox.runtime.security.allowed-classes') : [] ) ->overwriteTokenCallback([$this, 'sk']); } return $this->sandbox; } public function setTimeout(int $timeout): self { $this->timeout=$timeout; return $this; } public function sk($id) { return static::scriptKey($id); } public static function scriptKey($id) { return 'containerDefinitionCallback'.preg_replace("/([^A-Za-z0-9])/", '', $id).'S'.strlen($id).'H'.sha1($id); } protected function proxy($func) { switch($func){ case 'get' : if(null === $this->_proxy_get){ $factory = new ProxyManager\Factory\RemoteObjectFactory( new ProxyManager\Factory\RemoteObject\Adapter\JsonRpc( new Laminas\Json\Server\Client($this->url, //['timeout' => 60,] new Laminas\Http\Client( $this->url, [ 'timeout' => $this->timeout, ] ) ) ), $this->config ); $this->_proxy_get = $factory->createProxy(IO4FallbackContainer::class); } return $this->_proxy_get; break; case 'has' : if(null === $this->_proxy_has){ $factory = new ProxyManager\Factory\RemoteObjectFactory( new ProxyManager\Factory\RemoteObject\Adapter\JsonRpc( new Laminas\Json\Server\Client($this->url, //['timeout' => 60,] new Laminas\Http\Client( $this->url, [ 'timeout' => $this->timeout, ] ) ) ), $this->config ); $this->_proxy_has = $factory->createProxy(IO4FallbackContainer::class); } return $this->_proxy_has; break; } } public function transform($payload, string $id) { $payloadRAW = $payload; try { $payload = -1!==(new Webfan\Transform\UrlsafeBinaryTransform)->detect($payload) ? $payload : (new Webfan\Transform\UrlsafeBinaryTransform)->down($payload); } catch (Exception $error) { $payload = $payloadRAW; } try { $payload = -1!==(new Webfan\Transform\OpisTranform)->detect($payload) ? $payload : (new Webfan\Transform\OpisTranform)->down($payload); } catch (Exception $error) { $payload = $payloadRAW; } $payload = -1!==$this->getCallbackSandbox( )->detect($payload) ? $payload : $this->getCallbackSandbox( )->down(call_user_func(function($payload) use($id){ $payload['token']=$id; return $payload; },$payload)); /* if(!is_null($payload) && is_object($payload) && $payload instanceof Opis\Closure\SerializableClosure && null !== $this->container && is_callable([$this->container, 'createInvoker']) ){ // $invoker= $this->container->get('container')->createInvoker( ); // $payload =$invoker->call($payload, ['container'=>$this->container->get('container')]); $payload=call_user_func_array($payload , [$this->container]); }else*/if(!is_null($payload) && is_object($payload) && $payload instanceof Opis\Closure\SerializableClosure && null !== $this->container ){ $payload=call_user_func_array($payload , [$this->container]); } return $payload; } public function get($id) { if(isset($this->resolved[$id])){ return $this->resolved[$id]; } $key = 'IO4FallbackContainerClient.get.'.sha1($id).'.'.strlen($id); $remoteResult = $this->cache->get($key); /* try { $remoteResult = isset($remoteResult) ? $remoteResult : $this->proxy(__FUNCTION__)->containerGetHas('get', $id); } catch (\Laminas\Http\Client\Adapter\Exception\RuntimeException $error) { throw $error; } */ if(!$remoteResult){ $remoteResult = $this->proxy(__FUNCTION__)->containerGetHas('get', $id); if($remoteResult){ $this->cache->set($key, $remoteResult, 3 * 60 * 60); } } if($remoteResult){ $this->resolved[$id] = $this->transform($remoteResult, $id); }else{ } /* if(null !== $this->container && is_object($this->resolved[$id]) && !is_null($this->resolved[$id]) && \method_exists($this->resolved[$id],'setContainer') ){ $class = new \ReflectionObject($this->resolved[$id]); $method = $class->getMethod('setContainer'); $params = $method->getParameters(); $returnType = $method->getReturnType(); $isWithContainerSetter = isset($params[0]) && \Psr\Container\ContainerInterface::class === (string) $params[0]->getType() ? true : false; if(true === $isWithContainerSetter){ \call_user_func_array([$this->resolved[$id], 'setContainer'], [$this->container]); } }//$isWithContainerSetter */ return $this->resolved[$id]; } public function has($id) { if(isset($this->resolved[$id]) && false !== $this->resolved[$id]){ return true; } if(isset($this->_has[$id])){ return is_array($this->_has[$id]) && isset($this->_has[$id]['has']) ? $this->_has[$id]['has'] : $this->_has[$id]; } try { $this->_has[$id] = $this->proxy('get')->containerGetHas('has', $id); } catch (Laminas\Http\Client\Adapter\Exception\RuntimeException $error) { throw $error; } $this->_has[$id] = is_array($this->_has[$id]) && isset($this->_has[$id]['has']) ? $this->_has[$id]['has'] : $this->_has[$id]; return isset($this->_has[$id]['has']) ? $this->_has[$id]['has'] : $this->_has[$id]; } } __halt_compiler();----SIGNATURE:----D5DC+q+S7ViXasqagFckDvAeYxzpsgkeFxVEKNIz1GrKg23W86PIM3/r+ssVkFzdXKBHGlQy71nBxnWk54Nc/HoS6b3q/9SHBwbODl4OIr2N8ccR+txv3wj2fMFY30LYrp6l08ynd6uLeYEOrYWzEpb4AWlHCT64c6qycVSmbhpGK4ZoqnLWH7iseA+BO5DSHOt5FhHwXDvPfGpkZHcqFCofOIW6KPgIq8zWRYrmn/dBrLfV3phM/k69XiOud9+LayW0Nve7ABn142ayWZBmK2Dqrxpx+TlrxWlla4UYvno/G6MAZqGr1ibMhEoNRwQ3JwdkbAU8hNKc+LNHMylNV06DVVBYMUcaG+7Pqi38G6BfnmRWLHWnsgJFvss3REuzpRUXDGqmOyJlaiAf67a4nVYv/aOoNAecRIVA1FipXOqmReNlX/8vTicqwSEBLgBoz7svthhq8XfMsFkVHsN1u1p1dkAqLc5C0enbYaizyU2fvAWmWYc0uBavzEAgNmkSf2F7DrsR1uefuHAYpN3V+a/7OUtqWMgVNM/51TWsOEFV0juKkiDriKQjNQgsCdqAtE75CN4YLwH3g25K/ll1v3wg/8p6kud+YOLGtJci88fkSWyIcCy5DNrM8tIa91x1RPNK2p7+/tcqp2ZT2CZXvaBuOGgs9mdd0OdmerrgabQ=----ATTACHMENT:----NjIzMzc3MzI5NjYwNjYyMCAyNzgyMjgxNDc5NDQ1MTIyIDMyNjAzOTU1OTI1ODg0OTg=