@@ -44,27 +44,27 @@ discard block |
||
| 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 |
||
| 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,14 +104,14 @@ discard block |
||
| 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 | - $name = isset($exp[4])?:null; |
|
| 114 | + $name = isset($exp[4]) ?: null; |
|
| 115 | 115 | $image = new OrganizationImage(); |
| 116 | 116 | $image->setId($id); |
| 117 | 117 | $image->setName($name); |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | echo "Generate keywords for $count applications ...\n"; |
| 63 | 63 | |
| 64 | - $progress = new ProgressBar($count); |
|
| 64 | + $progress = new ProgressBar($count); |
|
| 65 | 65 | |
| 66 | 66 | /** @var \Core\Repository\Filter\PropertyToKeywords $filter */ |
| 67 | 67 | $filter = $services->get('filtermanager')->get('Core/Repository/PropertyToKeywords'); |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | /** @var \Applications\Entity\Application $application */ |
| 71 | 71 | foreach ($applications as $application) { |
| 72 | - $progress->update($i++, 'Application ' . $i . ' / ' . $count); |
|
| 72 | + $progress->update($i++, 'Application '.$i.' / '.$count); |
|
| 73 | 73 | $keywords = $filter->filter($application); |
| 74 | 74 | |
| 75 | 75 | $application->setKeywords($keywords); |
@@ -95,13 +95,13 @@ discard block |
||
| 95 | 95 | { |
| 96 | 96 | $applications = $this->fetchApplications(); |
| 97 | 97 | $count = count($applications); |
| 98 | - $i=0; |
|
| 99 | - echo "Calculate rating for " . $count . " applications ...\n"; |
|
| 98 | + $i = 0; |
|
| 99 | + echo "Calculate rating for ".$count." applications ...\n"; |
|
| 100 | 100 | |
| 101 | 101 | $progress = new ProgressBar($count); |
| 102 | 102 | /** @var \Applications\Entity\Application $application */ |
| 103 | 103 | foreach ($applications as $application) { |
| 104 | - $progress->update($i++, 'Application ' . $i . ' / ' . $count); |
|
| 104 | + $progress->update($i++, 'Application '.$i.' / '.$count); |
|
| 105 | 105 | $application->getRating(/* recalculate */ true); |
| 106 | 106 | } |
| 107 | 107 | $progress->update($i, 'Write to database...'); |
@@ -129,17 +129,17 @@ discard block |
||
| 129 | 129 | $documentManager = $services->get('Core/DocumentManager'); |
| 130 | 130 | |
| 131 | 131 | $count = count($applications); |
| 132 | - $i=0; |
|
| 132 | + $i = 0; |
|
| 133 | 133 | |
| 134 | - echo $count . " applications in Draft Mode and older than " . $days . " days will be deleted\n"; |
|
| 134 | + echo $count." applications in Draft Mode and older than ".$days." days will be deleted\n"; |
|
| 135 | 135 | |
| 136 | 136 | $progress = new ProgressBar($count); |
| 137 | 137 | |
| 138 | 138 | foreach ($applications as $application) { |
| 139 | - $progress->update($i++, 'Application ' . $i . ' / ' . $count); |
|
| 139 | + $progress->update($i++, 'Application '.$i.' / '.$count); |
|
| 140 | 140 | try { |
| 141 | 141 | $documentManager->remove($application); |
| 142 | - } catch (\Exception $e){ |
|
| 142 | + } catch (\Exception $e) { |
|
| 143 | 143 | // log something |
| 144 | 144 | $e->getCode(); |
| 145 | 145 | } |
@@ -163,17 +163,17 @@ discard block |
||
| 163 | 163 | |
| 164 | 164 | $table->appendRow(array('Module', 'Name', 'Description')); |
| 165 | 165 | |
| 166 | - $offset=strlen(getcwd())+1; |
|
| 167 | - $links=""; |
|
| 168 | - $github='https://github.com/cross-solution/YAWIK/blob/master/'; |
|
| 166 | + $offset = strlen(getcwd()) + 1; |
|
| 167 | + $links = ""; |
|
| 168 | + $github = 'https://github.com/cross-solution/YAWIK/blob/master/'; |
|
| 169 | 169 | |
| 170 | 170 | foreach ($config['view_manager']['template_map'] as $key => $absolute_filename) { |
| 171 | 171 | // strip the application_root plus an additional slash |
| 172 | - $filename=substr(realpath($absolute_filename), $offset); |
|
| 172 | + $filename = substr(realpath($absolute_filename), $offset); |
|
| 173 | 173 | if (preg_match('~module/([^/]+)~', $filename, $match)) { |
| 174 | - $module=$match[1]; |
|
| 174 | + $module = $match[1]; |
|
| 175 | 175 | } else { |
| 176 | - $module="not found ($key)"; |
|
| 176 | + $module = "not found ($key)"; |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | $viewModel = new ViewModel(); |
@@ -182,17 +182,17 @@ discard block |
||
| 182 | 182 | $row = new Row(); |
| 183 | 183 | $row->appendColumn(new Column($module)); |
| 184 | 184 | if ($filename) { |
| 185 | - $row->appendColumn(new Column('`' . $key . '`_')); |
|
| 186 | - $links.='.. _'. $key .': '. $github.$filename .PHP_EOL; |
|
| 185 | + $row->appendColumn(new Column('`'.$key.'`_')); |
|
| 186 | + $links .= '.. _'.$key.': '.$github.$filename.PHP_EOL; |
|
| 187 | 187 | } else { |
| 188 | 188 | $row->appendColumn(new Column("WRONG CONFIGURATION")); |
| 189 | 189 | } |
| 190 | - $comment=""; |
|
| 190 | + $comment = ""; |
|
| 191 | 191 | if (file_exists($absolute_filename)) { |
| 192 | - $src=file_get_contents($absolute_filename); |
|
| 193 | - $comment="file exists"; |
|
| 192 | + $src = file_get_contents($absolute_filename); |
|
| 193 | + $comment = "file exists"; |
|
| 194 | 194 | if (preg_match("/{{rtd:\s*(.*)}}/", $src, $match)) { |
| 195 | - $comment=$match['1']; |
|
| 195 | + $comment = $match['1']; |
|
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | 198 | $row->appendColumn(new Column($comment)); |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | { |
| 210 | 210 | echo "Loading applications... "; |
| 211 | 211 | |
| 212 | - $filter = \Zend\Json\Json::decode($this->params('filter', '{}'), \Zend\Json\Json::TYPE_ARRAY); |
|
| 212 | + $filter = \Zend\Json\Json::decode($this->params('filter', '{}'), \Zend\Json\Json::TYPE_ARRAY); |
|
| 213 | 213 | $filter['$or'] = array( |
| 214 | 214 | array('attachments' => array('$exists' => 1)), |
| 215 | 215 | array('contact.image' => array('$exists' => 1)), |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | return; |
| 224 | 224 | } |
| 225 | 225 | $progress = new ProgressBar($count); |
| 226 | - $i=0; |
|
| 226 | + $i = 0; |
|
| 227 | 227 | |
| 228 | 228 | foreach ($applications as $app) { |
| 229 | 229 | $progress->update($i++, "Process $i / $count"); |