$this->response = $response; $status = $response->getStatusCode(); if ($throwException && $status > 399 && $status < 500) { $error = new ClientResponseException( sprintf("%s %s: %s", $status, $response->getReasonPhrase(), (string) $response->getBody()), $status ); throw $error->setResponse($response); } elseif ($throwException && $status > 499 && $status < 600) { $error = new ServerResponseException( sprintf("%s %s: %s", $status, $response->getReasonPhrase(), (string) $response->getBody()), $status ); throw $error->setResponse($response); } } /** * Return true if status code is 2xx
} $start = microtime(true); $response = $this->transport->sendRequest($request); $this->logger->info(sprintf("Response time in %.3f sec", microtime(true) - $start)); $result = new Elasticsearch; $result->setResponse($response, $request->getMethod() === 'HEAD' ? false : $this->getResponseException()); return $result; } }
} $url = $this->addQueryString($url, $params, ['analyzer','analyze_wildcard','ccs_minimize_roundtrips','default_operator','df','explain','stored_fields','docvalue_fields','from','force_synthetic_source','ignore_unavailable','ignore_throttled','allow_no_indices','expand_wildcards','lenient','preference','q','routing','scroll','search_type','size','sort','_source','_source_excludes','_source_includes','terminate_after','stats','suggest_field','suggest_mode','suggest_size','suggest_text','timeout','track_scores','track_total_hits','allow_partial_search_results','typed_keys','version','seq_no_primary_term','request_cache','batched_reduce_size','max_concurrent_shard_requests','pre_filter_shard_size','rest_total_hits_as_int','min_compatible_shard_node','include_named_queries_score','pretty','human','error_trace','source','filter_path']); $headers = [ 'Accept' => 'application/json', 'Content-Type' => 'application/json', ]; return $this->sendRequest($this->createRequest($method, $url, $headers, $params['body'] ?? null)); } /** * Searches a vector tile for geospatial values. Returns results as a binary Mapbox vector tile. *
$params['aggs']['enum_agg']['terms']['size'] = 99999; $result = $this->elastic->search( [ 'index' => $this->source, 'type' => 'products', 'size' => 0, 'body' => $params, ] )->asArray(); $buckets = $result['aggregations']['enum_agg']['buckets']; $enumTotalCount = []; foreach ($buckets as $bucket) {
/** * @throws Exception */ protected function handleProps(): void { $props = $this->getPropsFromDb(); $props = $this->getPropsTotalCount($props); $props = $this->getPropsInput($props); $props = array_filter($props, static function ($item) { return !(isset($item['isShow']) && $item['isShow'] === false); });
{ $this->handlePrice(); $this->handleIsInStock(); $this->handleSpecialOffers(); $this->handleBrands(); $this->handleCollections(); $this->handleProps(); // echo "<pre>"; // print_r($this->props); // die; return $this;
protected Filter $filter; public function handle(array $input = [], ?Brand $brand = null, ?Collection $collection = null): self { $this->paramsHandler = (new ParamsHandler($input, $brand, $collection, true))->handle(); $this->searchHandler = (new SearchHandler($this->paramsHandler))->handle(); $this->filter = (new Filter($this->paramsHandler, $this->searchHandler, $input, $brand, $collection))->handle(); return $this; } /** * @return Filter
if ($pageType === LinkHandler::PAGE_TYPE_DETAIL_PAGE) { return $this->render('detail_page', ['productHandler' => $linkHandler->getProductHandler()]); } $input = Yii::$app->request->get(); $brand = $linkHandler->getBrand(); $collection = $linkHandler->getCollection(); $turboSearch = Yii::$app->turboSearch->handle($input, $brand, $collection); $filter = $turboSearch->getFilter(); // Обработка асинхронных запросов if ($request->isAjax && (bool)$request->get('async', '0')) { Yii::$app->response->format = Response::FORMAT_JSON;
$args = $this->controller->bindActionParams($this, $params); Yii::debug('Running action: ' . get_class($this->controller) . '::' . $this->actionMethod . '()', __METHOD__); if (Yii::$app->requestedParams === null) { Yii::$app->requestedParams = $args; } return call_user_func_array([$this->controller, $this->actionMethod], $args); } }
} $result = null; if ($runAction && $this->beforeAction($action)) { // run the action $result = $action->runWithParams($params); $result = $this->afterAction($action, $result); // call afterAction on modules foreach ($modules as $module) { /* @var $module Module */
$parts = $this->createController($route); if (is_array($parts)) { /* @var $controller Controller */ list($controller, $actionID) = $parts; $oldController = Yii::$app->controller; Yii::$app->controller = $controller; $result = $controller->runAction($actionID, $params); if ($oldController !== null) { Yii::$app->controller = $oldController; } return $result; }
$params = $this->catchAll; unset($params[0]); } try { Yii::debug("Route requested: '$route'", __METHOD__); $this->requestedRoute = $route; $result = $this->runAction($route, $params); if ($result instanceof Response) { return $result; } $response = $this->getResponse(); if ($result !== null) {
{ try { $this->state = self::STATE_BEFORE_REQUEST; $this->trigger(self::EVENT_BEFORE_REQUEST); $this->state = self::STATE_HANDLING_REQUEST; $response = $this->handleRequest($this->getRequest()); $this->state = self::STATE_AFTER_REQUEST; $this->trigger(self::EVENT_AFTER_REQUEST); $this->state = self::STATE_SENDING_RESPONSE; $response->send();
$config = ArrayHelper::merge( require BASE_PATH . '/common/config/main.php', require APP_WEB_PATH . '/config/main.php', ); (new Application($config))->run();
$_GET = [ 'link' => '10215-3-npn2', ]; $_SESSION = [ '__flash' => [], ];