@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function createQuery(array $params, $query) |
42 | 42 | { |
43 | - $search = isset($params['search']) ? $params['search']:''; |
|
43 | + $search = isset($params['search']) ? $params['search'] : ''; |
|
44 | 44 | |
45 | - if(!empty($search)){ |
|
45 | + if (!empty($search)) { |
|
46 | 46 | $q = \SolrUtils::escapeQueryChars($search); |
47 | - }else{ |
|
47 | + } else { |
|
48 | 48 | $q = '*:*'; |
49 | 49 | } |
50 | 50 | |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | $query->addFilterQuery('isActive:1'); |
54 | 54 | $query->addField('*'); |
55 | 55 | |
56 | - if(isset($params['location'])){ |
|
56 | + if (isset($params['location'])) { |
|
57 | 57 | /* @var Location $location */ |
58 | 58 | $location = $params['location']; |
59 | - if(is_object($location->getCoordinates())){ |
|
59 | + if (is_object($location->getCoordinates())) { |
|
60 | 60 | $coordinate = Util::convertLocationCoordinates($location); |
61 | 61 | |
62 | 62 | $query->addFilterQuery( |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | { |
30 | 30 | $coordinates = $location->getCoordinates()->getCoordinates(); |
31 | 31 | $coordinate = doubleval($coordinates[0]).'%'.doubleval($coordinates[1]); |
32 | - $coordinate = strtr($coordinate,[ |
|
32 | + $coordinate = strtr($coordinate, [ |
|
33 | 33 | '%'=>',', |
34 | 34 | ','=>'.' |
35 | 35 | ]); |
@@ -55,15 +55,15 @@ discard block |
||
55 | 55 | */ |
56 | 56 | static public function validateDate($value) |
57 | 57 | { |
58 | - if ($value instanceof \SolrObject || is_array($value)){ |
|
58 | + if ($value instanceof \SolrObject || is_array($value)) { |
|
59 | 59 | return $value; |
60 | 60 | } |
61 | 61 | $value = trim($value); |
62 | - $date = \DateTime::createFromFormat(Manager::SOLR_DATE_FORMAT,$value); |
|
62 | + $date = \DateTime::createFromFormat(Manager::SOLR_DATE_FORMAT, $value); |
|
63 | 63 | $check = $date && ($date->format(Manager::SOLR_DATE_FORMAT) === $value); |
64 | - if($check){ |
|
64 | + if ($check) { |
|
65 | 65 | return $date; |
66 | - }else{ |
|
66 | + } else { |
|
67 | 67 | return $value; |
68 | 68 | } |
69 | 69 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @var bool |
39 | 39 | */ |
40 | - protected $useGeoLocation=false; |
|
40 | + protected $useGeoLocation = false; |
|
41 | 41 | |
42 | 42 | /** |
43 | 43 | * @var ServiceLocatorInterface |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $entities = []; |
66 | 66 | $solrObjects = []; |
67 | 67 | |
68 | - foreach($response['response']['docs'] as $doc){ |
|
68 | + foreach ($response['response']['docs'] as $doc) { |
|
69 | 69 | $solrObjects[$doc->id] = $doc; |
70 | 70 | } |
71 | 71 | |
@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | $qb = $repository->createQueryBuilder(); |
76 | 76 | $qb->hydrate(true)->field('id')->in($keys); |
77 | 77 | $result = $qb->getQuery()->execute(); |
78 | - foreach($result as $document){ |
|
78 | + foreach ($result as $document) { |
|
79 | 79 | $solrObject = $solrObjects[$document->getId()]; |
80 | - $entity = new $class($document,$solrObject); |
|
80 | + $entity = new $class($document, $solrObject); |
|
81 | 81 | $entity->setFacets($facets); |
82 | 82 | $entities[] = $entity; |
83 | 83 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | protected $facets; |
41 | 41 | |
42 | - public function __construct(JobInterface $job,$solr) |
|
42 | + public function __construct(JobInterface $job, $solr) |
|
43 | 43 | { |
44 | 44 | $this->document = $job; |
45 | 45 | $blacklist = ['getPublisher']; |
@@ -51,12 +51,12 @@ discard block |
||
51 | 51 | { |
52 | 52 | $document = $this->document; |
53 | 53 | $methods = get_class_methods($document); |
54 | - foreach($methods as $method){ |
|
55 | - if(0 === strpos($method,'get') && !in_array($method,$blacklist)){ |
|
56 | - $value = call_user_func(array($document,$method)); |
|
57 | - if(!is_null($value)){ |
|
58 | - $setter = 'set'.substr($method,3); |
|
59 | - call_user_func(array($this,$setter),$value); |
|
54 | + foreach ($methods as $method) { |
|
55 | + if (0 === strpos($method, 'get') && !in_array($method, $blacklist)) { |
|
56 | + $value = call_user_func(array($document, $method)); |
|
57 | + if (!is_null($value)) { |
|
58 | + $setter = 'set'.substr($method, 3); |
|
59 | + call_user_func(array($this, $setter), $value); |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | } |