public function make($params, array $search_config) { if (empty($params) || !is_string($params) || empty($search_config['query']['params']['fields']) || !isset($search_config['query']['params']['append'])) { throw new \InvalidArgumentException(); } $this->config = $search_config; $this->query_string = stripNonAlphaNumerics(trim($params)); $query = $this->makeBaseQuery(); return $this->addSearchFields($query); }
/** * Places each keyword / phrase into an array, cleans end spaces and non alpha numerics from each * @return [type] [description] */ public function keywordsArray() { $exploded = explode(',', $this->keywords); $array = []; foreach ($exploded as $term) { $formatted_term = stripNonAlphaNumerics($term); if (!empty($formatted_term)) { $array[] = $formatted_term; } } return $array; }