@@ -30,7 +30,7 @@ |
||
| 30 | 30 | $auth = $container->get('AuthenticationService'); |
| 31 | 31 | $user = $auth->getUser(); |
| 32 | 32 | $options['user'] = $user; |
| 33 | - $mail = new Confirmation($options); |
|
| 33 | + $mail = new Confirmation($options); |
|
| 34 | 34 | |
| 35 | 35 | return $mail; |
| 36 | 36 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | echo "Generate keywords for $count applications ...\n"; |
| 100 | 100 | |
| 101 | - $progress = new ProgressBar($count); |
|
| 101 | + $progress = new ProgressBar($count); |
|
| 102 | 102 | |
| 103 | 103 | /** @var \Core\Repository\Filter\PropertyToKeywords $filter */ |
| 104 | 104 | $filter = $this->filterManager->get('Core/Repository/PropertyToKeywords'); |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | /** @var \Applications\Entity\Application $application */ |
| 108 | 108 | foreach ($applications as $application) { |
| 109 | - $progress->update($i++, 'Application ' . $i . ' / ' . $count); |
|
| 109 | + $progress->update($i++, 'Application '.$i.' / '.$count); |
|
| 110 | 110 | $keywords = $filter->filter($application); |
| 111 | 111 | |
| 112 | 112 | $application->setKeywords($keywords); |
@@ -132,13 +132,13 @@ discard block |
||
| 132 | 132 | { |
| 133 | 133 | $applications = $this->fetchApplications(); |
| 134 | 134 | $count = count($applications); |
| 135 | - $i=0; |
|
| 136 | - echo "Calculate rating for " . $count . " applications ...\n"; |
|
| 135 | + $i = 0; |
|
| 136 | + echo "Calculate rating for ".$count." applications ...\n"; |
|
| 137 | 137 | |
| 138 | 138 | $progress = new ProgressBar($count); |
| 139 | 139 | /** @var \Applications\Entity\Application $application */ |
| 140 | 140 | foreach ($applications as $application) { |
| 141 | - $progress->update($i++, 'Application ' . $i . ' / ' . $count); |
|
| 141 | + $progress->update($i++, 'Application '.$i.' / '.$count); |
|
| 142 | 142 | $application->getRating(/* recalculate */ true); |
| 143 | 143 | } |
| 144 | 144 | $progress->update($i, 'Write to database...'); |
@@ -165,17 +165,17 @@ discard block |
||
| 165 | 165 | $documentManager = $this->documentManager; |
| 166 | 166 | |
| 167 | 167 | $count = count($applications); |
| 168 | - $i=0; |
|
| 168 | + $i = 0; |
|
| 169 | 169 | |
| 170 | - echo $count . " applications in Draft Mode and older than " . $days . " days will be deleted\n"; |
|
| 170 | + echo $count." applications in Draft Mode and older than ".$days." days will be deleted\n"; |
|
| 171 | 171 | |
| 172 | 172 | $progress = new ProgressBar($count); |
| 173 | 173 | |
| 174 | 174 | foreach ($applications as $application) { |
| 175 | - $progress->update($i++, 'Application ' . $i . ' / ' . $count); |
|
| 175 | + $progress->update($i++, 'Application '.$i.' / '.$count); |
|
| 176 | 176 | try { |
| 177 | 177 | $documentManager->remove($application); |
| 178 | - } catch (\Exception $e){ |
|
| 178 | + } catch (\Exception $e) { |
|
| 179 | 179 | // log something |
| 180 | 180 | $e->getCode(); |
| 181 | 181 | } |
@@ -199,17 +199,17 @@ discard block |
||
| 199 | 199 | |
| 200 | 200 | $table->appendRow(array('Module', 'Name', 'Description')); |
| 201 | 201 | |
| 202 | - $offset=strlen(getcwd())+1; |
|
| 203 | - $links=""; |
|
| 204 | - $github='https://github.com/cross-solution/YAWIK/blob/master/'; |
|
| 202 | + $offset = strlen(getcwd()) + 1; |
|
| 203 | + $links = ""; |
|
| 204 | + $github = 'https://github.com/cross-solution/YAWIK/blob/master/'; |
|
| 205 | 205 | |
| 206 | 206 | foreach ($config['view_manager']['template_map'] as $key => $absolute_filename) { |
| 207 | 207 | // strip the application_root plus an additional slash |
| 208 | - $filename=substr(realpath($absolute_filename), $offset); |
|
| 208 | + $filename = substr(realpath($absolute_filename), $offset); |
|
| 209 | 209 | if (preg_match('~module/([^/]+)~', $filename, $match)) { |
| 210 | - $module=$match[1]; |
|
| 210 | + $module = $match[1]; |
|
| 211 | 211 | } else { |
| 212 | - $module="not found ($key)"; |
|
| 212 | + $module = "not found ($key)"; |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | $viewModel = new ViewModel(); |
@@ -218,17 +218,17 @@ discard block |
||
| 218 | 218 | $row = new Row(); |
| 219 | 219 | $row->appendColumn(new Column($module)); |
| 220 | 220 | if ($filename) { |
| 221 | - $row->appendColumn(new Column('`' . $key . '`_')); |
|
| 222 | - $links.='.. _'. $key .': '. $github.$filename .PHP_EOL; |
|
| 221 | + $row->appendColumn(new Column('`'.$key.'`_')); |
|
| 222 | + $links .= '.. _'.$key.': '.$github.$filename.PHP_EOL; |
|
| 223 | 223 | } else { |
| 224 | 224 | $row->appendColumn(new Column("WRONG CONFIGURATION")); |
| 225 | 225 | } |
| 226 | - $comment=""; |
|
| 226 | + $comment = ""; |
|
| 227 | 227 | if (file_exists($absolute_filename)) { |
| 228 | - $src=file_get_contents($absolute_filename); |
|
| 229 | - $comment="file exists"; |
|
| 228 | + $src = file_get_contents($absolute_filename); |
|
| 229 | + $comment = "file exists"; |
|
| 230 | 230 | if (preg_match("/{{rtd:\s*(.*)}}/", $src, $match)) { |
| 231 | - $comment=$match['1']; |
|
| 231 | + $comment = $match['1']; |
|
| 232 | 232 | } |
| 233 | 233 | } |
| 234 | 234 | $row->appendColumn(new Column($comment)); |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | { |
| 246 | 246 | echo "Loading applications... "; |
| 247 | 247 | |
| 248 | - $filter = \Zend\Json\Json::decode($this->params('filter', '{}'), \Zend\Json\Json::TYPE_ARRAY); |
|
| 248 | + $filter = \Zend\Json\Json::decode($this->params('filter', '{}'), \Zend\Json\Json::TYPE_ARRAY); |
|
| 249 | 249 | $filter['$or'] = array( |
| 250 | 250 | array('attachments' => array('$exists' => 1)), |
| 251 | 251 | array('contact.image' => array('$exists' => 1)), |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | return; |
| 260 | 260 | } |
| 261 | 261 | $progress = new ProgressBar($count); |
| 262 | - $i=0; |
|
| 262 | + $i = 0; |
|
| 263 | 263 | |
| 264 | 264 | foreach ($applications as $app) { |
| 265 | 265 | $progress->update($i++, "Process $i / $count"); |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | return $ob; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - public function setContainer( ContainerInterface $container ) |
|
| 75 | + public function setContainer(ContainerInterface $container) |
|
| 76 | 76 | { |
| 77 | 77 | $this->config = $container->get('Config'); |
| 78 | 78 | $this->imageCacheManager = $container->get('Organizations\ImageFileCache\Manager'); |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | throw new \RuntimeException('Invalid application id.'); |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - $action = 'process'; |
|
| 128 | + $action = 'process'; |
|
| 129 | 129 | |
| 130 | 130 | $routeMatch->setParam('action', $action); |
| 131 | 131 | } else { |
@@ -209,14 +209,14 @@ discard block |
||
| 209 | 209 | |
| 210 | 210 | $container->setEntity($application); |
| 211 | 211 | $this->configureContainer($container); |
| 212 | - $this->formContainer = $container; |
|
| 212 | + $this->formContainer = $container; |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | public function jobNotFoundAction() |
| 216 | 216 | { |
| 217 | 217 | $this->response->setStatusCode(410); |
| 218 | 218 | $model = new ViewModel( |
| 219 | - [ 'content' => /*@translate*/ 'Invalid apply id'] |
|
| 219 | + ['content' => /*@translate*/ 'Invalid apply id'] |
|
| 220 | 220 | ); |
| 221 | 221 | $model->setTemplate('applications/error/not-found'); |
| 222 | 222 | return $model; |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | $postData = $form->getOption('use_post_array') ? $params->fromPost() : array(); |
| 336 | 336 | //@TODO: [ZF3] option use_files_array is false by default |
| 337 | 337 | //$filesData = $form->getOption('use_files_array') ? $params->fromFiles() : array(); |
| 338 | - $form->setData(array_merge($postData,$_FILES)); |
|
| 338 | + $form->setData(array_merge($postData, $_FILES)); |
|
| 339 | 339 | |
| 340 | 340 | if (!$form->isValid()) { |
| 341 | 341 | return new JsonModel( |
@@ -397,13 +397,13 @@ discard block |
||
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | if ('previewmail' == $this->params()->fromQuery('do')) { |
| 400 | - $this->mailer('Applications/CarbonCopy', [ 'application' => $application], true); |
|
| 400 | + $this->mailer('Applications/CarbonCopy', ['application' => $application], true); |
|
| 401 | 401 | $this->notification()->success(/*@translate*/ 'Mail has been send'); |
| 402 | 402 | return new JsonModel(); |
| 403 | 403 | } |
| 404 | 404 | |
| 405 | 405 | if ('sendmail' == $this->params()->fromQuery('do')) { |
| 406 | - $jobEntity = $application->getJob(); |
|
| 406 | + $jobEntity = $application->getJob(); |
|
| 407 | 407 | |
| 408 | 408 | $mailData = array( |
| 409 | 409 | 'application' => $application, |
@@ -434,8 +434,8 @@ discard block |
||
| 434 | 434 | |
| 435 | 435 | $repositories->store($application); |
| 436 | 436 | |
| 437 | - $events = $this->appEvents; |
|
| 438 | - $events->trigger(ApplicationEvent::EVENT_APPLICATION_POST_CREATE, $this, [ 'application' => $application ]); |
|
| 437 | + $events = $this->appEvents; |
|
| 438 | + $events->trigger(ApplicationEvent::EVENT_APPLICATION_POST_CREATE, $this, ['application' => $application]); |
|
| 439 | 439 | |
| 440 | 440 | $model = new ViewModel( |
| 441 | 441 | array( |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | $this->appOptions = $appOptions; |
| 72 | 72 | $this->appEvents = $appEvents; |
| 73 | 73 | $this->translator = $translator; |
| 74 | - $this->container = $container; |
|
| 74 | + $this->container = $container; |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | |
| 171 | 171 | |
| 172 | - $format=$this->params()->fromQuery('format'); |
|
| 172 | + $format = $this->params()->fromQuery('format'); |
|
| 173 | 173 | |
| 174 | 174 | if ($application->isDraft()) { |
| 175 | 175 | $list = false; |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | && ($network = $this->params()->fromQuery('network')) |
| 298 | 298 | && ($data = $this->params()->fromPost('data')) |
| 299 | 299 | ) { |
| 300 | - $profileClass = '\\Auth\\Entity\\SocialProfiles\\' . $network; |
|
| 300 | + $profileClass = '\\Auth\\Entity\\SocialProfiles\\'.$network; |
|
| 301 | 301 | $profile = new $profileClass(); |
| 302 | 302 | $profile->setData(\Zend\Json\Json::decode($data, \Zend\Json\Json::TYPE_ARRAY)); |
| 303 | 303 | } else { |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | |
| 367 | 367 | $event->setIsPostRequest($request->isPost()); |
| 368 | 368 | $event->setPostData($request->getPost()); |
| 369 | - $events->trigger($event->getName(),$event); |
|
| 369 | + $events->trigger($event->getName(), $event); |
|
| 370 | 370 | |
| 371 | 371 | $params = $event->getFormData(); |
| 372 | 372 | |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | |
| 416 | 416 | $this->acl($application, 'forward'); |
| 417 | 417 | |
| 418 | - $translator = $this->translator; |
|
| 418 | + $translator = $this->translator; |
|
| 419 | 419 | |
| 420 | 420 | if (!$emailAddress) { |
| 421 | 421 | throw new \InvalidArgumentException('An email address must be supplied.'); |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | public function deleteAction() |
| 456 | 456 | { |
| 457 | 457 | $id = $this->params('id'); |
| 458 | - $repositories= $this->repositories; |
|
| 458 | + $repositories = $this->repositories; |
|
| 459 | 459 | $repository = $repositories->get('Applications/Application'); |
| 460 | 460 | $application = $repository->find($id); |
| 461 | 461 | |
@@ -465,8 +465,8 @@ discard block |
||
| 465 | 465 | |
| 466 | 466 | $this->acl($application, 'delete'); |
| 467 | 467 | |
| 468 | - $events = $this->appEvents; |
|
| 469 | - $events->trigger(ApplicationEvent::EVENT_APPLICATION_PRE_DELETE, $this, [ 'application' => $application ]); |
|
| 468 | + $events = $this->appEvents; |
|
| 469 | + $events->trigger(ApplicationEvent::EVENT_APPLICATION_PRE_DELETE, $this, ['application' => $application]); |
|
| 470 | 470 | |
| 471 | 471 | $repositories->remove($application); |
| 472 | 472 | |
@@ -100,7 +100,7 @@ |
||
| 100 | 100 | return $viewModel; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - public function setContainer( ContainerInterface $container ) |
|
| 103 | + public function setContainer(ContainerInterface $container) |
|
| 104 | 104 | { |
| 105 | 105 | $this->repositories = $container->get('repositories'); |
| 106 | 106 | $this->formManager = $container->get('forms'); |
@@ -136,7 +136,7 @@ |
||
| 136 | 136 | * |
| 137 | 137 | * @return Forward |
| 138 | 138 | */ |
| 139 | - static public function factory(ContainerInterface $container,$requestedName,array $options=[]) |
|
| 139 | + static public function factory(ContainerInterface $container, $requestedName, array $options = []) |
|
| 140 | 140 | { |
| 141 | 141 | $ob = new self($options); |
| 142 | 142 | $ob->setContainer($container); |
@@ -122,11 +122,11 @@ discard block |
||
| 122 | 122 | return $this; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - public function remove($entity,$flush=false) |
|
| 125 | + public function remove($entity, $flush = false) |
|
| 126 | 126 | { |
| 127 | 127 | $this->checkEntityType($entity); |
| 128 | 128 | $this->dm->remove($entity); |
| 129 | - if($flush){ |
|
| 129 | + if ($flush) { |
|
| 130 | 130 | $this->dm->flush($entity); |
| 131 | 131 | } |
| 132 | 132 | return $this; |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | |
| 135 | 135 | protected function checkEntityType($entity) |
| 136 | 136 | { |
| 137 | - if ( !($entity instanceOf $this->entityPrototype) ) { |
|
| 137 | + if (!($entity instanceOf $this->entityPrototype)) { |
|
| 138 | 138 | throw new \InvalidArgumentException(sprintf( |
| 139 | 139 | 'Entity must be of type %s but recieved %s instead', |
| 140 | 140 | get_class($this->entityPrototype), |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | class DocumentManagerFactory implements FactoryInterface |
| 24 | 24 | { |
| 25 | - public function __invoke( ContainerInterface $container, $requestedName, array $options = null ) { |
|
| 25 | + public function __invoke(ContainerInterface $container, $requestedName, array $options = null) { |
|
| 26 | 26 | $container->setAllowOverride(true); |
| 27 | 27 | $container->setFactory('doctrine.configuration.odm_default', new ConfigurationFactory('odm_default')); |
| 28 | 28 | $container->setAllowOverride(false); |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | class RepositoryServiceFactory implements FactoryInterface |
| 22 | 22 | { |
| 23 | 23 | |
| 24 | - public function __invoke( ContainerInterface $container, $requestedName, array $options = null ) { |
|
| 24 | + public function __invoke(ContainerInterface $container, $requestedName, array $options = null) { |
|
| 25 | 25 | $dm = $container->get('Core/DocumentManager'); |
| 26 | 26 | $service = new RepositoryService($dm); |
| 27 | 27 | |