setPath(CACHE_DIR); $cache->purgeCache(86400); // 24 hours $cache->setParameters($params); unset($params['action']); unset($params['bridge']); unset($params['format']); unset($params['_noproxy']); unset($params['_cache_timeout']); // Load cache & data try { $bridge->setCache($cache); $bridge->setCacheTimeout($cache_timeout); $bridge->setDatas($params); } catch(Error $e) { http_response_code($e->getCode()); header('Content-Type: text/html'); die(buildBridgeException($e, $bridge)); } catch(Exception $e) { http_response_code($e->getCode()); header('Content-Type: text/html'); die(buildBridgeException($e, $bridge)); } // Data transformation try { $format = Format::create($format); $format->setItems($bridge->getItems()); $format->setExtraInfos($bridge->getExtraInfos()); $format->display(); } catch(Error $e) { http_response_code($e->getCode()); header('Content-Type: text/html'); die(buildTransformException($e, $bridge)); } catch(Exception $e) { http_response_code($e->getCode()); header('Content-Type: text/html'); die(buildBridgeException($e, $bridge)); } } else { echo BridgeList::create($whitelist_selection, $showInactive); } } catch(HttpException $e) { http_response_code($e->getCode()); header('Content-Type: text/plain'); die($e->getMessage()); } catch(\Exception $e) { die($e->getMessage()); }