@@ -293,7 +293,7 @@ |
||
| 293 | 293 | * @param string|array $options String is either event name or aggregate name (when name is int). |
| 294 | 294 | * Array are the options from config. [ [event,..], method, priority, lazy] |
| 295 | 295 | * |
| 296 | - * @return array |
|
| 296 | + * @return \Zend\EventManager\EventManagerInterface |
|
| 297 | 297 | */ |
| 298 | 298 | protected function normalizeListenerOptions($name, $options) |
| 299 | 299 | { |
@@ -278,7 +278,7 @@ |
||
| 278 | 278 | /* @var \Core\Listener\DeferredListenerAggregate $aggregate */ |
| 279 | 279 | $aggregate = $services->get('Core/Listener/DeferredListenerAggregate'); |
| 280 | 280 | $aggregate->setListeners($lazyListeners) |
| 281 | - ->attach($eventManager); |
|
| 281 | + ->attach($eventManager); |
|
| 282 | 282 | } |
| 283 | 283 | } |
| 284 | 284 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | $defaults = [ |
| 149 | 149 | 'service' => 'EventManager', |
| 150 | 150 | 'configure' => true, |
| 151 | - 'identifiers' => [ $name ], |
|
| 151 | + 'identifiers' => [$name], |
|
| 152 | 152 | 'event' => '\Zend\EventManager\Event', |
| 153 | 153 | 'listeners' => [], |
| 154 | 154 | ]; |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | foreach ($listeners as $name => $options) { |
| 240 | 240 | $options = $this->normalizeListenerOptions($name, $options); |
| 241 | 241 | |
| 242 | - if ($options['lazy'] && null !== $options['attach'] ) { |
|
| 242 | + if ($options['lazy'] && null !== $options['attach']) { |
|
| 243 | 243 | foreach ($options['attach'] as $spec) { |
| 244 | 244 | $lazyListeners[] = [ |
| 245 | 245 | 'service' => $options['service'], |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | foreach ($options['attach'] as $spec) { |
| 272 | - $callback = $spec['method'] ? [ $listener, $spec['method'] ] : $listener; |
|
| 272 | + $callback = $spec['method'] ? [$listener, $spec['method']] : $listener; |
|
| 273 | 273 | $eventManager->attach($spec['events'], $callback, $spec['priority']); |
| 274 | 274 | } |
| 275 | 275 | } |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | |
| 341 | 341 | if (is_string($options)) { |
| 342 | 342 | /* Only an event name is provided in config */ |
| 343 | - $normalized['attach'] = [ [ 'events' => [ $options ], 'method' => null, 'priority' => 0 ] ]; |
|
| 343 | + $normalized['attach'] = [['events' => [$options], 'method' => null, 'priority' => 0]]; |
|
| 344 | 344 | return $normalized; |
| 345 | 345 | |
| 346 | 346 | } |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | } else if (is_string($opt)) { |
| 370 | 370 | if (null === $event) { |
| 371 | 371 | /* first string found is assumed to be the event name */ |
| 372 | - $event = [ $opt ]; |
|
| 372 | + $event = [$opt]; |
|
| 373 | 373 | } else { |
| 374 | 374 | /* second string found must be a method name. */ |
| 375 | 375 | $method = $opt; |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | } |
| 386 | 386 | } |
| 387 | 387 | |
| 388 | - $normalized['attach'] = [ [ 'events' => $event, 'method' => $method, 'priority' => $priority ] ]; |
|
| 388 | + $normalized['attach'] = [['events' => $event, 'method' => $method, 'priority' => $priority]]; |
|
| 389 | 389 | $normalized['lazy'] = $lazy; |
| 390 | 390 | |
| 391 | 391 | return $normalized; |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | protected function normalizeEventsSpec($options) |
| 395 | 395 | { |
| 396 | 396 | $listenerPriority = isset($options['priority']) ? $options['priority'] : 0; |
| 397 | - $listenerMethod = isset($options['method']) ? $options['method'] : '__none__'; |
|
| 397 | + $listenerMethod = isset($options['method']) ? $options['method'] : '__none__'; |
|
| 398 | 398 | $events = []; |
| 399 | 399 | |
| 400 | 400 | foreach ($options['events'] as $event => $spec) { |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | } else if (is_array($spec)) { |
| 415 | 415 | if (isset($spec['method'])) { |
| 416 | 416 | if (!is_array($spec['method'])) { |
| 417 | - $spec['method'] = [ $spec['method'] ]; |
|
| 417 | + $spec['method'] = [$spec['method']]; |
|
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | foreach ($spec['method'] as $method => $methodPriority) { |
@@ -64,7 +64,7 @@ |
||
| 64 | 64 | /** |
| 65 | 65 | * Gets the form instance. |
| 66 | 66 | * |
| 67 | - * @return Container|FormInterface |
|
| 67 | + * @return FormInterface |
|
| 68 | 68 | */ |
| 69 | 69 | public function getForm() |
| 70 | 70 | { |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | public function getConsoleBanner(Console $console) |
| 37 | 37 | { |
| 38 | 38 | $version = `git describe 2>/dev/null`; |
| 39 | - $name = 'YAWIK ' . trim($version); |
|
| 39 | + $name = 'YAWIK '.trim($version); |
|
| 40 | 40 | $width = $console->getWidth(); |
| 41 | 41 | return sprintf( |
| 42 | 42 | "==%1\$s==\n%2\$s%3\$s\n**%1\$s**\n", |
@@ -72,12 +72,12 @@ discard block |
||
| 72 | 72 | $sharedManager = $eventManager->getSharedManager(); |
| 73 | 73 | |
| 74 | 74 | if (!\Zend\Console\Console::isConsole()) { |
| 75 | - $redirectCallback = function () use ($e) { |
|
| 75 | + $redirectCallback = function() use ($e) { |
|
| 76 | 76 | $routeMatch = $e->getRouteMatch(); |
| 77 | 77 | $lang = $routeMatch ? $routeMatch->getParam('lang', 'en') : 'en'; |
| 78 | - $uri = $e->getRouter()->getBaseUrl() . '/' . $lang . '/error'; |
|
| 78 | + $uri = $e->getRouter()->getBaseUrl().'/'.$lang.'/error'; |
|
| 79 | 79 | |
| 80 | - header('Location: ' . $uri); |
|
| 80 | + header('Location: '.$uri); |
|
| 81 | 81 | }; |
| 82 | 82 | |
| 83 | 83 | $errorHandlerListener = new ErrorHandlerListener($sm->get('ErrorLogger'), $redirectCallback); |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | $eventManager->attach( |
| 111 | 111 | MvcEvent::EVENT_DISPATCH_ERROR, |
| 112 | - function ($event) { |
|
| 112 | + function($event) { |
|
| 113 | 113 | $application = $event->getApplication(); |
| 114 | 114 | if ($application::ERROR_EXCEPTION == $event->getError()) { |
| 115 | 115 | $ex = $event->getParam('exception'); |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | ); |
| 124 | 124 | $eventManager->attach( |
| 125 | 125 | MvcEvent::EVENT_DISPATCH, |
| 126 | - function ($event) use ($eventManager) { |
|
| 126 | + function($event) use ($eventManager) { |
|
| 127 | 127 | $eventManager->trigger('postDispatch', $event); |
| 128 | 128 | }, |
| 129 | 129 | -150 |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | */ |
| 139 | 139 | public function getConfig() |
| 140 | 140 | { |
| 141 | - $config = include __DIR__ . '/config/module.config.php'; |
|
| 141 | + $config = include __DIR__.'/config/module.config.php'; |
|
| 142 | 142 | return $config; |
| 143 | 143 | if (\Zend\Console\Console::isConsole()) { |
| 144 | 144 | $config['doctrine']['configuration']['odm_default']['generate_proxies'] = false; |
@@ -158,9 +158,9 @@ discard block |
||
| 158 | 158 | return array( |
| 159 | 159 | 'Zend\Loader\StandardAutoloader' => array( |
| 160 | 160 | 'namespaces' => array( |
| 161 | - __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__, |
|
| 162 | - 'CoreTest' => __DIR__ . '/test/' . 'CoreTest', |
|
| 163 | - 'CoreTestUtils' => __DIR__ . '/test/CoreTestUtils', |
|
| 161 | + __NAMESPACE__ => __DIR__.'/src/'.__NAMESPACE__, |
|
| 162 | + 'CoreTest' => __DIR__.'/test/'.'CoreTest', |
|
| 163 | + 'CoreTestUtils' => __DIR__.'/test/CoreTestUtils', |
|
| 164 | 164 | ), |
| 165 | 165 | ), |
| 166 | 166 | ); |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | if (!empty($this->parent)) { |
| 335 | 335 | $name = $this->getName(); |
| 336 | 336 | if (!empty($name)) { |
| 337 | - $formName .= $name . '.'; |
|
| 337 | + $formName .= $name.'.'; |
|
| 338 | 338 | } |
| 339 | 339 | } |
| 340 | 340 | $formName .= $form['name']; |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | $formAction = $formInstance->getAttribute('action'); |
| 343 | 343 | |
| 344 | 344 | if (empty($formAction)) { |
| 345 | - $formInstance->setAttribute('action', '?form=' . $formName); |
|
| 345 | + $formInstance->setAttribute('action', '?form='.$formName); |
|
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | if (isset($form['label'])) { |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | $spec->setParent($this); |
| 387 | 387 | } |
| 388 | 388 | |
| 389 | - $spec = [ '__instance__' => $spec, 'name' => $key, 'entity' => '*' ]; |
|
| 389 | + $spec = ['__instance__' => $spec, 'name' => $key, 'entity' => '*']; |
|
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | if (!is_array($spec)) { |
@@ -505,7 +505,7 @@ discard block |
||
| 505 | 505 | } |
| 506 | 506 | $this->activeForms = array_filter( |
| 507 | 507 | $this->activeForms, |
| 508 | - function ($item) use ($key) { |
|
| 508 | + function($item) use ($key) { |
|
| 509 | 509 | return !in_array($item, $key); |
| 510 | 510 | } |
| 511 | 511 | ); |
@@ -519,7 +519,7 @@ discard block |
||
| 519 | 519 | * @param EntityInterface $entity |
| 520 | 520 | * @return self |
| 521 | 521 | */ |
| 522 | - public function setEntity(EntityInterface $entity, $key='*') |
|
| 522 | + public function setEntity(EntityInterface $entity, $key = '*') |
|
| 523 | 523 | { |
| 524 | 524 | $this->entities[$key] = $entity; |
| 525 | 525 | |
@@ -537,7 +537,7 @@ discard block |
||
| 537 | 537 | * |
| 538 | 538 | * @return \Core\Entity\EntityInterface |
| 539 | 539 | */ |
| 540 | - public function getEntity($key='*') |
|
| 540 | + public function getEntity($key = '*') |
|
| 541 | 541 | { |
| 542 | 542 | return isset($this->entities[$key]) ? $this->entities[$key] : null; |
| 543 | 543 | } |
@@ -740,10 +740,10 @@ discard block |
||
| 740 | 740 | $actualKey = $this->getActiveFormActual(); |
| 741 | 741 | if (isset($actualKey)) { |
| 742 | 742 | $forms = array_keys($this->forms); |
| 743 | - $formsFlip = array_flip($forms); |
|
| 743 | + $formsFlip = array_flip($forms); |
|
| 744 | 744 | $index = $formsFlip[$actualKey]; |
| 745 | 745 | if (0 < $index) { |
| 746 | - $key = $forms[$index-1]; |
|
| 746 | + $key = $forms[$index - 1]; |
|
| 747 | 747 | } |
| 748 | 748 | } |
| 749 | 749 | return $key; |
@@ -760,10 +760,10 @@ discard block |
||
| 760 | 760 | $actualKey = $this->getActiveFormActual(); |
| 761 | 761 | if (isset($actualKey)) { |
| 762 | 762 | $forms = array_keys($this->forms); |
| 763 | - $formsFlip = array_flip($forms); |
|
| 763 | + $formsFlip = array_flip($forms); |
|
| 764 | 764 | $index = $formsFlip[$actualKey]; |
| 765 | 765 | if ($index < count($forms) - 1) { |
| 766 | - $key = $forms[$index+1]; |
|
| 766 | + $key = $forms[$index + 1]; |
|
| 767 | 767 | } |
| 768 | 768 | } |
| 769 | 769 | return $key; |
@@ -785,8 +785,8 @@ discard block |
||
| 785 | 785 | $options['use_files_array'] = false; |
| 786 | 786 | } |
| 787 | 787 | |
| 788 | - $formName = (($name = $this->getName()) ? $name . '.' : '') . $form['name']; |
|
| 789 | - $action = '?form=' . $formName; |
|
| 788 | + $formName = (($name = $this->getName()) ? $name.'.' : '').$form['name']; |
|
| 789 | + $action = '?form='.$formName; |
|
| 790 | 790 | |
| 791 | 791 | return $action; |
| 792 | 792 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * @param array $colMap |
| 33 | 33 | * @return Form|string |
| 34 | 34 | */ |
| 35 | - public function __invoke(FormInterface $form = null, $colMap=[]) |
|
| 35 | + public function __invoke(FormInterface $form = null, $colMap = []) |
|
| 36 | 36 | { |
| 37 | 37 | if (!$form) { |
| 38 | 38 | return $this; |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | return $this->render($form, $colMap); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - public function render(FormInterface $form, $colMap=[]) |
|
| 44 | + public function render(FormInterface $form, $colMap = []) |
|
| 45 | 45 | { |
| 46 | 46 | if (method_exists($form, 'prepare')) { |
| 47 | 47 | $form->prepare(); |
@@ -51,12 +51,12 @@ discard block |
||
| 51 | 51 | $form->setAttribute('data-search-params', \Zend\Json\Json::encode($params)); |
| 52 | 52 | |
| 53 | 53 | $formContent = '<div class="row" style="padding: 0 15px;">'; $buttonsRendered = false; |
| 54 | - $buttonsContent = '<input type="submit" class="btn btn-primary" name="submit" value="' . $this->getView()->translate('Search') . '">' |
|
| 55 | - . '<input type="reset" class="btn btn-default" name="clear" value="' . $this->getView()->translate('Clear') . '">'; |
|
| 54 | + $buttonsContent = '<input type="submit" class="btn btn-primary" name="submit" value="'.$this->getView()->translate('Search').'">' |
|
| 55 | + . '<input type="reset" class="btn btn-default" name="clear" value="'.$this->getView()->translate('Clear').'">'; |
|
| 56 | 56 | |
| 57 | 57 | |
| 58 | 58 | if ($form instanceOf ViewPartialProviderInterface) { |
| 59 | - return $this->getView()->partial($form->getViewPartial(), [ 'element' => $form, 'buttons' => $buttonsContent ]); |
|
| 59 | + return $this->getView()->partial($form->getViewPartial(), ['element' => $form, 'buttons' => $buttonsContent]); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | if (empty($colMap)) { |
@@ -64,14 +64,14 @@ discard block |
||
| 64 | 64 | $r = floor($c / 3); |
| 65 | 65 | |
| 66 | 66 | if (0 != $r) { |
| 67 | - for ($i=0; $i<$r; $i+=1) { |
|
| 67 | + for ($i = 0; $i < $r; $i += 1) { |
|
| 68 | 68 | $colMap[] = 4; |
| 69 | 69 | $colMap[] = 4; |
| 70 | 70 | $colMap[] = 4; |
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | if ($l = $c % 3) { |
| 74 | - for ($i=0; $i<$l; $i+=1) { |
|
| 74 | + for ($i = 0; $i < $l; $i += 1) { |
|
| 75 | 75 | $colMap[] = 12 / $l; |
| 76 | 76 | } |
| 77 | 77 | } |
@@ -89,24 +89,24 @@ discard block |
||
| 89 | 89 | $i += 1; |
| 90 | 90 | |
| 91 | 91 | if ($element->getName() == $form->getOption('button_element')) { |
| 92 | - $formContent.='<div class="input-group col-md-' . $col . '">' |
|
| 92 | + $formContent .= '<div class="input-group col-md-'.$col.'">' |
|
| 93 | 93 | . $this->getView()->formElement($element) |
| 94 | - . '<div class="input-group-btn search-form-buttons" style="width: 0px;">' . $buttonsContent . '</div>' |
|
| 94 | + . '<div class="input-group-btn search-form-buttons" style="width: 0px;">'.$buttonsContent.'</div>' |
|
| 95 | 95 | . '</div>'; |
| 96 | 96 | $buttonsRendered = true; |
| 97 | 97 | } else { |
| 98 | - $formContent .= '<div class="input-group col-md-' . $col . '">' . $this->getView()->formElement($element) . '</div>'; |
|
| 98 | + $formContent .= '<div class="input-group col-md-'.$col.'">'.$this->getView()->formElement($element).'</div>'; |
|
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | if (!$buttonsRendered) { |
| 104 | 104 | $c = count($form); |
| 105 | - $col = isset($colMap[$c]) ? $colMap[$c]: 12; |
|
| 106 | - $formContent .= '<div class="input-group search-form-buttons col-md-' . $col . ' text-right">' |
|
| 107 | - . '<div class="btn-group">' . $buttonsContent .'</div></div>'; |
|
| 105 | + $col = isset($colMap[$c]) ? $colMap[$c] : 12; |
|
| 106 | + $formContent .= '<div class="input-group search-form-buttons col-md-'.$col.' text-right">' |
|
| 107 | + . '<div class="btn-group">'.$buttonsContent.'</div></div>'; |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - return $this->openTag($form) . $formContent . $this->closeTag(); |
|
| 110 | + return $this->openTag($form).$formContent.$this->closeTag(); |
|
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | 113 | \ No newline at end of file |
@@ -73,25 +73,25 @@ |
||
| 73 | 73 | { |
| 74 | 74 | $this->setName('search'); |
| 75 | 75 | $this->setAttributes([ |
| 76 | - 'data-handle-by' => 'native', |
|
| 77 | - 'method' => 'get', |
|
| 78 | - 'class' => 'form-inline search-form', |
|
| 79 | - ] |
|
| 76 | + 'data-handle-by' => 'native', |
|
| 77 | + 'method' => 'get', |
|
| 78 | + 'class' => 'form-inline search-form', |
|
| 79 | + ] |
|
| 80 | 80 | ); |
| 81 | 81 | |
| 82 | 82 | $this->add([ |
| 83 | - 'type' => 'Text', |
|
| 84 | - 'name' => 'text', |
|
| 85 | - 'options' => [ |
|
| 86 | - 'label' => /*@translate*/ |
|
| 87 | - 'Search', |
|
| 88 | - 'use_formrow_helper' => false, |
|
| 89 | - ], |
|
| 90 | - 'attributes' => [ |
|
| 91 | - 'class' => 'form-control', |
|
| 92 | - 'placeholder' => $this->getOption('placeholder'), |
|
| 93 | - ] |
|
| 94 | - ] |
|
| 83 | + 'type' => 'Text', |
|
| 84 | + 'name' => 'text', |
|
| 85 | + 'options' => [ |
|
| 86 | + 'label' => /*@translate*/ |
|
| 87 | + 'Search', |
|
| 88 | + 'use_formrow_helper' => false, |
|
| 89 | + ], |
|
| 90 | + 'attributes' => [ |
|
| 91 | + 'class' => 'form-control', |
|
| 92 | + 'placeholder' => $this->getOption('placeholder'), |
|
| 93 | + ] |
|
| 94 | + ] |
|
| 95 | 95 | ); |
| 96 | 96 | |
| 97 | 97 | |