@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | class Manager |
| 26 | 26 | { |
| 27 | - const SOLR_DATE_FORMAT = 'Y-m-d\TH:i:s\Z'; |
|
| 27 | + const SOLR_DATE_FORMAT = 'Y-m-d\TH:i:s\Z'; |
|
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | 30 | * @var ModuleOptions |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | * @param string $path |
| 47 | 47 | * @return \SolrClient |
| 48 | 48 | */ |
| 49 | - public function getClient($path='/solr') |
|
| 49 | + public function getClient($path = '/solr') |
|
| 50 | 50 | { |
| 51 | 51 | $options = $this->options; |
| 52 | 52 | $options = [ |
@@ -69,15 +69,15 @@ discard block |
||
| 69 | 69 | * @param string $path |
| 70 | 70 | * @throws ServerException When failed adding document to server |
| 71 | 71 | */ |
| 72 | - public function addDocument(\SolrInputDocument $document,$path='/solr') |
|
| 72 | + public function addDocument(\SolrInputDocument $document, $path = '/solr') |
|
| 73 | 73 | { |
| 74 | 74 | $client = $this->getClient($path); |
| 75 | - try{ |
|
| 75 | + try { |
|
| 76 | 76 | $client->addDocument($document); |
| 77 | 77 | $client->commit(); |
| 78 | 78 | $client->optimize(); |
| 79 | - }catch (\Exception $e){ |
|
| 80 | - throw new ServerException('Can not add document to server!',$e->getCode(),$e); |
|
| 79 | + } catch (\Exception $e) { |
|
| 80 | + throw new ServerException('Can not add document to server!', $e->getCode(), $e); |
|
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | * @param ResultConverter $resultConverter |
| 72 | 72 | * @param array $params |
| 73 | 73 | */ |
| 74 | - public function __construct($client,$filter,$resultConverter,$params=array()) |
|
| 74 | + public function __construct($client, $filter, $resultConverter, $params = array()) |
|
| 75 | 75 | { |
| 76 | 76 | $this->client = $client; |
| 77 | 77 | $this->filter = $filter; |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | { |
| 87 | 87 | return $this->resultConverter->convert( |
| 88 | 88 | $this->filter, |
| 89 | - $this->getResponse($offset,$itemCountPerPage)->getResponse() |
|
| 89 | + $this->getResponse($offset, $itemCountPerPage)->getResponse() |
|
| 90 | 90 | ); |
| 91 | 91 | } |
| 92 | 92 | |
@@ -109,20 +109,20 @@ discard block |
||
| 109 | 109 | * @return \SolrQueryResponse |
| 110 | 110 | * @throws ServerException |
| 111 | 111 | */ |
| 112 | - protected function getResponse($offset=0,$itemCountPerPage=0) |
|
| 112 | + protected function getResponse($offset = 0, $itemCountPerPage = 0) |
|
| 113 | 113 | { |
| 114 | 114 | $id = md5($offset.$itemCountPerPage); |
| 115 | - if(!isset($this->responses[$id])){ |
|
| 115 | + if (!isset($this->responses[$id])) { |
|
| 116 | 116 | $query = new \SolrDisMaxQuery(); |
| 117 | 117 | $query->useEDisMaxQueryParser(); |
| 118 | - $query = $this->filter->filter($this->params,$query); |
|
| 118 | + $query = $this->filter->filter($this->params, $query); |
|
| 119 | 119 | $query->setStart($offset); |
| 120 | 120 | $query->setRows($itemCountPerPage); |
| 121 | - try{ |
|
| 121 | + try { |
|
| 122 | 122 | $this->responses[$id] = $this->client->query($query); |
| 123 | - }catch (\Exception $e){ |
|
| 123 | + } catch (\Exception $e) { |
|
| 124 | 124 | $message = 'Failed to process query'; |
| 125 | - throw new ServerException($message,$e->getCode(),$e); |
|
| 125 | + throw new ServerException($message, $e->getCode(), $e); |
|
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | 128 | |
@@ -150,7 +150,7 @@ |
||
| 150 | 150 | ) |
| 151 | 151 | { |
| 152 | 152 | // get concatenated list of cities from the locations |
| 153 | - $locations = trim(implode(', ', array_unique(array_map(function (ArrayAccess $doc) |
|
| 153 | + $locations = trim(implode(', ', array_unique(array_map(function(ArrayAccess $doc) |
|
| 154 | 154 | { |
| 155 | 155 | return isset($doc->city) ? trim($doc->city) : ''; |
| 156 | 156 | }, $this->solrResult['locations']['docs'])))); |
@@ -48,10 +48,10 @@ |
||
| 48 | 48 | $query->addFilterQuery('isActive:1'); |
| 49 | 49 | $query->addField('*'); |
| 50 | 50 | |
| 51 | - if(isset($params['location'])){ |
|
| 51 | + if (isset($params['location'])) { |
|
| 52 | 52 | /* @var Location $location */ |
| 53 | 53 | $location = $params['location']; |
| 54 | - if(is_object($location->getCoordinates())){ |
|
| 54 | + if (is_object($location->getCoordinates())) { |
|
| 55 | 55 | $coordinate = Util::convertLocationCoordinates($location); |
| 56 | 56 | |
| 57 | 57 | $query->addFilterQuery( |