Completed
Push — develop ( 143852...728aa6 )
by
unknown
08:15
created
module/Solr/src/Solr/Paginator/Adapter/SolrAdapter.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      * @param   ResultConverter             $resultConverter
71 71
      * @param   array                       $params
72 72
      */
73
-    public function __construct($client,$filter,$resultConverter,$params=array())
73
+    public function __construct($client, $filter, $resultConverter, $params = array())
74 74
     {
75 75
         $this->client           = $client;
76 76
         $this->filter           = $filter;
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     {
86 86
         return $this->resultConverter->convert(
87 87
             $this->filter,
88
-            $this->getResponse($offset,$itemCountPerPage)
88
+            $this->getResponse($offset, $itemCountPerPage)
89 89
         );
90 90
     }
91 91
 
@@ -108,19 +108,19 @@  discard block
 block discarded – undo
108 108
      * @return  \SolrQueryResponse
109 109
      * @throws  \Exception
110 110
      */
111
-    protected function getResponse($offset=0,$itemCountPerPage=5)
111
+    protected function getResponse($offset = 0, $itemCountPerPage = 5)
112 112
     {
113 113
         $id = md5($offset.$itemCountPerPage);
114
-        if(!isset($this->responses[$id])){
114
+        if (!isset($this->responses[$id])) {
115 115
             $query = new \SolrQuery();
116
-            $query = $this->filter->filter($this->params,$query);
116
+            $query = $this->filter->filter($this->params, $query);
117 117
             $query->setStart($offset);
118 118
             $query->setRows($itemCountPerPage);
119
-            try{
119
+            try {
120 120
                 $this->responses[$id] = $this->client->query($query);
121
-            }catch (\Exception $e){
121
+            } catch (\Exception $e) {
122 122
                 $message = 'Failed to process query';
123
-                throw new ServerException($message,$e->getCode(),$e);
123
+                throw new ServerException($message, $e->getCode(), $e);
124 124
             }
125 125
         }
126 126
 
Please login to merge, or discard this patch.
module/Solr/src/Solr/Bridge/Util.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
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
         ]);
Please login to merge, or discard this patch.
module/Solr/src/Solr/Filter/JobBoardPaginationQuery.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -44,27 +44,27 @@  discard block
 block discarded – undo
44 44
      */
45 45
     public function createQuery(array $params, $query)
46 46
     {
47
-        $search = isset($params['search']) ? $params['search']:'';
47
+        $search = isset($params['search']) ? $params['search'] : '';
48 48
 
49
-        if(!empty($search)){
49
+        if (!empty($search)) {
50 50
             $q = 'title:'.$search.' OR organizationName:'.$search;
51
-        }else{
51
+        } else {
52 52
             $q = '*:*';
53 53
         }
54 54
 
55 55
         $query->setQuery($q);
56 56
         
57
-        if(isset($params['sort'])){
57
+        if (isset($params['sort'])) {
58 58
             $sorts = $this->filterSort($params['sort']);
59
-            foreach($sorts as $field=>$order){
60
-                $query->addSortField($field,$order);
59
+            foreach ($sorts as $field=>$order) {
60
+                $query->addSortField($field, $order);
61 61
             }
62 62
         }
63 63
 
64
-        if(isset($params['location'])){
64
+        if (isset($params['location'])) {
65 65
             /* @var Location $location */
66 66
             $location = $params['location'];
67
-            if(is_object($location->getCoordinates())){
67
+            if (is_object($location->getCoordinates())) {
68 68
                 $coordinate = Util::convertLocationCoordinates($location);
69 69
                 $query->addFilterQuery(sprintf(
70 70
                     "{!geofilt pt=%s sfield=latLon d=%s}",
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
      * @param Job       $ob
91 91
      * @param string    $value
92 92
      */
93
-    public function convertOrganizationName($ob,$value)
93
+    public function convertOrganizationName($ob, $value)
94 94
     {
95
-        if(!is_object($ob->getOrganization())){
95
+        if (!is_object($ob->getOrganization())) {
96 96
             $ob->setOrganization(new Organization());
97 97
         }
98 98
         $orgName = new OrganizationName($value);
@@ -104,12 +104,12 @@  discard block
 block discarded – undo
104 104
      * @param   Job     $ob
105 105
      * @param   mixed   $value
106 106
      */
107
-    public function convertCompanyLogo($ob,$value)
107
+    public function convertCompanyLogo($ob, $value)
108 108
     {
109
-        if(!is_object($ob->getOrganization())){
109
+        if (!is_object($ob->getOrganization())) {
110 110
             $ob->setOrganization(new Organization());
111 111
         }
112
-        $exp    = explode('/',$value);
112
+        $exp    = explode('/', $value);
113 113
         $id     = $exp[3];
114 114
         $name   = $exp[4];
115 115
         $image = new OrganizationImage();
Please login to merge, or discard this patch.
module/Solr/src/Solr/Listener/JobEventSubscriber.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -91,13 +91,13 @@  discard block
 block discarded – undo
91 91
      */
92 92
     protected function updateIndex($document)
93 93
     {
94
-        if(!$document instanceof Job){
94
+        if (!$document instanceof Job) {
95 95
             return;
96 96
         }
97 97
         $solrDoc = $this->generateInputDocument($document, new \SolrInputDocument());
98
-        try{
99
-            $this->solrManager->addDocument($solrDoc,$this->solrManager->getOptions()->getJobsPath());
100
-        }catch (\Exception $e){
98
+        try {
99
+            $this->solrManager->addDocument($solrDoc, $this->solrManager->getOptions()->getJobsPath());
100
+        } catch (\Exception $e) {
101 101
             // @TODO: What to do when the process failed?
102 102
         }
103 103
     }
@@ -110,26 +110,26 @@  discard block
 block discarded – undo
110 110
      */
111 111
     public function generateInputDocument(Job $job, $document)
112 112
     {
113
-        $document->addField('id',$job->getId());
114
-        $document->addField('title',$job->getTitle());
115
-        $document->addField('applicationEmail',$job->getContactEmail());
116
-        if($job->getDateCreated()){
117
-            $document->addField('dateCreated',Util::convertDateTime($job->getDateCreated()));
113
+        $document->addField('id', $job->getId());
114
+        $document->addField('title', $job->getTitle());
115
+        $document->addField('applicationEmail', $job->getContactEmail());
116
+        if ($job->getDateCreated()) {
117
+            $document->addField('dateCreated', Util::convertDateTime($job->getDateCreated()));
118 118
         }
119
-        if($job->getDateModified()){
120
-            $document->addField('dateModified',Util::convertDateTime($job->getDateModified()));
119
+        if ($job->getDateModified()) {
120
+            $document->addField('dateModified', Util::convertDateTime($job->getDateModified()));
121 121
         }
122
-        if($job->getDatePublishStart()){
123
-            $document->addField('datePublishStart',Util::convertDateTime($job->getDatePublishStart()));
122
+        if ($job->getDatePublishStart()) {
123
+            $document->addField('datePublishStart', Util::convertDateTime($job->getDatePublishStart()));
124 124
         }
125
-        if($job->getDatePublishEnd()){
126
-            $document->addField('datePublishEnd',Util::convertDateTime($job->getDatePublishEnd()));
125
+        if ($job->getDatePublishEnd()) {
126
+            $document->addField('datePublishEnd', Util::convertDateTime($job->getDatePublishEnd()));
127 127
         }
128
-        $document->addField('isActive',$job->isActive());
129
-        $document->addField('lang',$job->getLanguage());
130
-        $this->processLocation($job,$document);
131
-        if(!is_null($job->getOrganization())){
132
-            $this->processOrganization($job,$document);
128
+        $document->addField('isActive', $job->isActive());
129
+        $document->addField('lang', $job->getLanguage());
130
+        $this->processLocation($job, $document);
131
+        if (!is_null($job->getOrganization())) {
132
+            $this->processOrganization($job, $document);
133 133
         }
134 134
         return $document;
135 135
     }
@@ -139,14 +139,14 @@  discard block
 block discarded – undo
139 139
      * @param Job                   $job
140 140
      * @param \SolrInputDocument    $document
141 141
      */
142
-    public function processOrganization(Job $job,$document)
142
+    public function processOrganization(Job $job, $document)
143 143
     {
144
-        if(!is_null($job->getOrganization()->getImage())){
144
+        if (!is_null($job->getOrganization()->getImage())) {
145 145
             $uri = $job->getOrganization()->getImage()->getUri();
146
-            $document->addField('companyLogo',$uri);
146
+            $document->addField('companyLogo', $uri);
147 147
         }
148
-        $document->addField('organizationName',$job->getOrganization()->getOrganizationName()->getName());
149
-        $document->addField('organizationId',$job->getOrganization()->getId());
148
+        $document->addField('organizationName', $job->getOrganization()->getOrganizationName()->getName());
149
+        $document->addField('organizationId', $job->getOrganization()->getId());
150 150
     }
151 151
 
152 152
     /**
@@ -154,18 +154,18 @@  discard block
 block discarded – undo
154 154
      * @param Job                $job
155 155
      * @param \SolrInputDocument $document
156 156
      */
157
-    public function processLocation(Job $job,$document)
157
+    public function processLocation(Job $job, $document)
158 158
     {
159 159
         /* @var \Jobs\Entity\Location $location */
160
-        foreach($job->getLocations() as $location){
161
-            if(is_object($location->getCoordinates())){
160
+        foreach ($job->getLocations() as $location) {
161
+            if (is_object($location->getCoordinates())) {
162 162
                 $coordinate = Util::convertLocationCoordinates($location);
163
-                $document->addField('latLon',$coordinate);
163
+                $document->addField('latLon', $coordinate);
164 164
             }
165
-            $document->addField('postCode',$location->getPostalCode());
166
-            $document->addField('regionText',$location->getRegion());
165
+            $document->addField('postCode', $location->getPostalCode());
166
+            $document->addField('regionText', $location->getRegion());
167 167
         }
168 168
 
169
-        $document->addField('location',$job->getLocation());
169
+        $document->addField('location', $job->getLocation());
170 170
     }
171 171
 }
172 172
\ No newline at end of file
Please login to merge, or discard this patch.