@@ -26,7 +26,7 @@ |
||
26 | 26 | */ |
27 | 27 | public function load(array $configs, ContainerBuilder $container) |
28 | 28 | { |
29 | - $loader = new YamlFileLoader($container, new FileLocator(realpath(__DIR__.'/../Resources/config'))); |
|
29 | + $loader = new YamlFileLoader($container, new FileLocator(realpath(__DIR__ . '/../Resources/config'))); |
|
30 | 30 | |
31 | 31 | $loader->load('services.yml'); |
32 | 32 | $loader->load('helpers.yml'); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $resolver->setAllowedTypes('includeLeaf', 'bool'); |
89 | 89 | $resolver->setAllowedTypes('all', 'bool'); |
90 | 90 | |
91 | - $resolver->setNormalizer('label', function (Options $options, $label) { |
|
91 | + $resolver->setNormalizer('label', function(Options $options, $label) { |
|
92 | 92 | if (null === $label || empty($label)) { |
93 | 93 | $isMultiple = $options['multiple']; |
94 | 94 | $translator = $options['translator']; |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | return $label; |
100 | 100 | }); |
101 | - $resolver->setNormalizer('placeholder', function (Options $options, $placeholder) { |
|
101 | + $resolver->setNormalizer('placeholder', function(Options $options, $placeholder) { |
|
102 | 102 | if (!$options['required']) { |
103 | 103 | if (null == $placeholder || empty($placeholder)) { |
104 | 104 | $isMultiple = $options['multiple']; |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | return $placeholder; |
112 | 112 | }); |
113 | - $resolver->setNormalizer('choices', function (Options $options, $choices) { |
|
113 | + $resolver->setNormalizer('choices', function(Options $options, $choices) { |
|
114 | 114 | if (empty($choices)) { |
115 | 115 | $choices = $this->getCategoryChoices($options); |
116 | 116 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | 'mapped' => false, |
92 | 92 | 'required' => false |
93 | 93 | ]) |
94 | - ->addEventListener(FormEvents::SUBMIT, function (FormEvent $event) use ($options) { |
|
94 | + ->addEventListener(FormEvents::SUBMIT, function(FormEvent $event) use ($options) { |
|
95 | 95 | // ensure all locales have a display name |
96 | 96 | /** @var CategoryEntity $category */ |
97 | 97 | $category = $event->getData(); |
@@ -109,10 +109,10 @@ discard block |
||
109 | 109 | $builder->get('name') |
110 | 110 | ->addModelTransformer(new CallbackTransformer( |
111 | 111 | // remove slash from name before persistence to prevent issues with path |
112 | - function ($string) { |
|
112 | + function($string) { |
|
113 | 113 | return $string; |
114 | 114 | }, |
115 | - function ($string) { |
|
115 | + function($string) { |
|
116 | 116 | return str_replace('/', '/', $string); |
117 | 117 | } |
118 | 118 | )) |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | |
58 | 58 | /** @var CategoryRegistryEntity[] $registries */ |
59 | 59 | foreach ($registries as $registry) { |
60 | - $queryBuilderClosure = function (CategoryRepositoryInterface $repo) use ($registry, $options) { |
|
60 | + $queryBuilderClosure = function(CategoryRepositoryInterface $repo) use ($registry, $options) { |
|
61 | 61 | return $repo->getChildrenQueryBuilder($registry->getCategory(), $options['direct']); |
62 | 62 | }; |
63 | - $choiceLabelClosure = function (CategoryEntity $category) use ($registry) { |
|
63 | + $choiceLabelClosure = function(CategoryEntity $category) use ($registry) { |
|
64 | 64 | $indent = str_repeat('--', $category->getLvl() - $registry->getCategory()->getLvl() - 1); |
65 | 65 | |
66 | 66 | return (!empty($indent) ? '|' : '') . $indent . $category->getName(); |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $resolver->setAllowedTypes('entityCategoryClass', 'string'); |
120 | 120 | $resolver->setAllowedTypes('em', [ObjectManager::class, 'null']); |
121 | 121 | |
122 | - $resolver->addAllowedValues('entityCategoryClass', function ($value) { |
|
122 | + $resolver->addAllowedValues('entityCategoryClass', function($value) { |
|
123 | 123 | return is_subclass_of($value, AbstractCategoryAssignment::class); |
124 | 124 | }); |
125 | 125 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | ]) |
75 | 75 | ; |
76 | 76 | |
77 | - $formModifier = function (FormInterface $form, $modName = null) use ($options) { |
|
77 | + $formModifier = function(FormInterface $form, $modName = null) use ($options) { |
|
78 | 78 | $entities = null === $modName ? [] : $this->entitySelectionBuilder->buildFor($modName); |
79 | 79 | $form->add('entityname', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', [ |
80 | 80 | 'label' => $options['translator']->__('Entity'), |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | $builder->addEventListener( |
87 | 87 | FormEvents::PRE_SET_DATA, |
88 | - function (FormEvent $event) use ($formModifier) { |
|
88 | + function(FormEvent $event) use ($formModifier) { |
|
89 | 89 | /** @var CategoryRegistryEntity $data */ |
90 | 90 | $data = $event->getData(); |
91 | 91 | $formModifier($event->getForm(), $data->getModname()); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | |
95 | 95 | $builder->get('modname')->addEventListener( |
96 | 96 | FormEvents::POST_SUBMIT, |
97 | - function (FormEvent $event) use ($formModifier) { |
|
97 | + function(FormEvent $event) use ($formModifier) { |
|
98 | 98 | $modName = $event->getForm()->getData(); |
99 | 99 | $formModifier($event->getForm()->getParent(), $modName); |
100 | 100 | } |
@@ -54,7 +54,7 @@ |
||
54 | 54 | $newCategory->setName($category->getName() . 'copy'); |
55 | 55 | $displayNames = []; |
56 | 56 | foreach ($newCategory->getDisplay_name() as $locale => $displayName) { |
57 | - $displayNames[$locale] = $displayName . ' ' .$this->__('copy'); |
|
57 | + $displayNames[$locale] = $displayName . ' ' . $this->__('copy'); |
|
58 | 58 | } |
59 | 59 | $newCategory->setDisplay_name($displayNames); |
60 | 60 | $action = 'edit'; |
@@ -70,7 +70,8 @@ |
||
70 | 70 | $parent = $repo->find($parentId); |
71 | 71 | $category->setParent($parent); |
72 | 72 | $category->setRoot($parent->getRoot()); |
73 | - } elseif (empty($parent) && $request->request->has('after')) { // sibling of top-level child |
|
73 | + } elseif (empty($parent) && $request->request->has('after')) { |
|
74 | +// sibling of top-level child |
|
74 | 75 | $sibling = $repo->find($request->request->get('after')); |
75 | 76 | $category->setParent($sibling->getParent()); |
76 | 77 | $category->setRoot($sibling->getRoot()); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | return [ |
80 | 80 | 'decorate' => true, |
81 | 81 | 'html' => true, |
82 | - 'childOpen' => function ($node) { |
|
82 | + 'childOpen' => function($node) { |
|
83 | 83 | $jsTreeData = []; |
84 | 84 | $jsTreeData['disabled'] = $node['status'] != 'A'; |
85 | 85 | $jsTreeData['type'] = $node['is_leaf'] ? 'leaf' : 'default'; |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | return '<li ' . $jsTreeData . 'class="jstree-open" id="' . $this->domTreeNodePrefix . $node['id'] . '">'; |
89 | 89 | }, |
90 | - 'nodeDecorator' => function ($node) use ($locale) { |
|
90 | + 'nodeDecorator' => function($node) use ($locale) { |
|
91 | 91 | $displayName = isset($node['display_name'][$locale]) ? $node['display_name'][$locale] : $node['name']; |
92 | 92 | $title = ' title="' . $this->createTitleAttribute($node, $displayName, $locale) . '"'; |
93 | 93 | $classes = []; |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | } |
209 | 209 | |
210 | 210 | // does the user have admin permissions on the provider module? |
211 | - if (!$this->get('zikula_permissions_module.api.permission')->hasPermission($hookproviders[$i]['name']."::", '::', ACCESS_ADMIN)) { |
|
211 | + if (!$this->get('zikula_permissions_module.api.permission')->hasPermission($hookproviders[$i]['name'] . "::", '::', ACCESS_ADMIN)) { |
|
212 | 212 | unset($hookproviders[$i]); |
213 | 213 | continue; |
214 | 214 | } |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | if (!$this->get('kernel')->isBundle($subscriber)) { |
293 | 293 | throw new \RuntimeException($this->get('translator.default')->__f('Subscriber module "%s" is not available.', $subscriber)); |
294 | 294 | } |
295 | - if (!$this->get('zikula_permissions_module.api.permission')->hasPermission($subscriber.'::', '::', ACCESS_ADMIN)) { |
|
295 | + if (!$this->get('zikula_permissions_module.api.permission')->hasPermission($subscriber . '::', '::', ACCESS_ADMIN)) { |
|
296 | 296 | throw new AccessDeniedException(); |
297 | 297 | } |
298 | 298 | |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | if (!$this->get('kernel')->isBundle($provider)) { |
311 | 311 | throw new \RuntimeException($this->get('translator.default')->__f('Provider module "%s" is not available.', $provider)); |
312 | 312 | } |
313 | - if (!$this->get('zikula_permissions_module.api.permission')->hasPermission($provider.'::', '::', ACCESS_ADMIN)) { |
|
313 | + if (!$this->get('zikula_permissions_module.api.permission')->hasPermission($provider . '::', '::', ACCESS_ADMIN)) { |
|
314 | 314 | throw new AccessDeniedException(); |
315 | 315 | } |
316 | 316 | |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | if (!$this->get('kernel')->isBundle($subscriber)) { |
373 | 373 | throw new \RuntimeException($this->get('translator.default')->__f('Subscriber module "%s" is not available.', $subscriber)); |
374 | 374 | } |
375 | - if (!$this->get('zikula_permissions_module.api.permission')->hasPermission($subscriber.'::', '::', ACCESS_ADMIN)) { |
|
375 | + if (!$this->get('zikula_permissions_module.api.permission')->hasPermission($subscriber . '::', '::', ACCESS_ADMIN)) { |
|
376 | 376 | throw new AccessDeniedException(); |
377 | 377 | } |
378 | 378 |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | /** |
51 | 51 | * Retrieves an array with all fields which can be used for sorting instances. |
52 | 52 | * |
53 | - * @return array Sorting fields array |
|
53 | + * @return string[] Sorting fields array |
|
54 | 54 | */ |
55 | 55 | public function getAllowedSortingFields() |
56 | 56 | { |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | /** |
104 | 104 | * Returns the request. |
105 | 105 | * |
106 | - * @return Request |
|
106 | + * @return null|Request |
|
107 | 107 | */ |
108 | 108 | public function getRequest() |
109 | 109 | { |
@@ -175,7 +175,6 @@ discard block |
||
175 | 175 | /** |
176 | 176 | * Returns an array of additional template variables which are specific to the object type treated by this repository. |
177 | 177 | * |
178 | - * @param ImageHelper $imageHelper ImageHelper service instance |
|
179 | 178 | * @param string $context Usage context (allowed values: controllerAction, api, actionHandler, block, contentType) |
180 | 179 | * @param array $args Additional arguments |
181 | 180 | * |
@@ -421,7 +420,7 @@ discard block |
||
421 | 420 | /** |
422 | 421 | * Selects an object from the database. |
423 | 422 | * |
424 | - * @param mixed $id The id (or array of ids) to use to retrieve the object (optional) (default=0) |
|
423 | + * @param integer $id The id (or array of ids) to use to retrieve the object (optional) (default=0) |
|
425 | 424 | * @param boolean $useJoins Whether to include joining related objects (optional) (default=true) |
426 | 425 | * @param boolean $slimMode If activated only some basic fields are selected without using any joins (optional) (default=false) |
427 | 426 | * |
@@ -279,9 +279,9 @@ discard block |
||
279 | 279 | |
280 | 280 | $qb = $this->getEntityManager()->createQueryBuilder(); |
281 | 281 | $qb->update('Zikula\RoutesModule\Entity\RouteEntity', 'tbl') |
282 | - ->set('tbl.createdBy', $newUserId) |
|
283 | - ->where('tbl.createdBy = :creator') |
|
284 | - ->setParameter('creator', $userId); |
|
282 | + ->set('tbl.createdBy', $newUserId) |
|
283 | + ->where('tbl.createdBy = :creator') |
|
284 | + ->setParameter('creator', $userId); |
|
285 | 285 | $query = $qb->getQuery(); |
286 | 286 | $query->execute(); |
287 | 287 | |
@@ -312,9 +312,9 @@ discard block |
||
312 | 312 | |
313 | 313 | $qb = $this->getEntityManager()->createQueryBuilder(); |
314 | 314 | $qb->update('Zikula\RoutesModule\Entity\RouteEntity', 'tbl') |
315 | - ->set('tbl.updatedBy', $newUserId) |
|
316 | - ->where('tbl.updatedBy = :editor') |
|
317 | - ->setParameter('editor', $userId); |
|
315 | + ->set('tbl.updatedBy', $newUserId) |
|
316 | + ->where('tbl.updatedBy = :editor') |
|
317 | + ->setParameter('editor', $userId); |
|
318 | 318 | $query = $qb->getQuery(); |
319 | 319 | $query->execute(); |
320 | 320 | |
@@ -343,8 +343,8 @@ discard block |
||
343 | 343 | |
344 | 344 | $qb = $this->getEntityManager()->createQueryBuilder(); |
345 | 345 | $qb->delete('Zikula\RoutesModule\Entity\RouteEntity', 'tbl') |
346 | - ->where('tbl.createdBy = :creator') |
|
347 | - ->setParameter('creator', $userId); |
|
346 | + ->where('tbl.createdBy = :creator') |
|
347 | + ->setParameter('creator', $userId); |
|
348 | 348 | $query = $qb->getQuery(); |
349 | 349 | |
350 | 350 | $query->execute(); |
@@ -374,8 +374,8 @@ discard block |
||
374 | 374 | |
375 | 375 | $qb = $this->getEntityManager()->createQueryBuilder(); |
376 | 376 | $qb->delete('Zikula\RoutesModule\Entity\RouteEntity', 'tbl') |
377 | - ->where('tbl.updatedBy = :editor') |
|
378 | - ->setParameter('editor', $userId); |
|
377 | + ->where('tbl.updatedBy = :editor') |
|
378 | + ->setParameter('editor', $userId); |
|
379 | 379 | $query = $qb->getQuery(); |
380 | 380 | |
381 | 381 | $query->execute(); |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | { |
472 | 472 | if ($excludeId > 0) { |
473 | 473 | $qb->andWhere('tbl.id != :excludeId') |
474 | - ->setParameter('excludeId', $excludeId); |
|
474 | + ->setParameter('excludeId', $excludeId); |
|
475 | 475 | } |
476 | 476 | |
477 | 477 | return $qb; |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | $offset = ($currentPage-1) * $resultsPerPage; |
534 | 534 | |
535 | 535 | $query->setFirstResult($offset) |
536 | - ->setMaxResults($resultsPerPage); |
|
536 | + ->setMaxResults($resultsPerPage); |
|
537 | 537 | |
538 | 538 | return $query; |
539 | 539 | } |
@@ -599,14 +599,14 @@ discard block |
||
599 | 599 | if ((!is_numeric($v) && $v != '') || (is_numeric($v) && $v > 0)) { |
600 | 600 | if ($k == 'workflowState' && substr($v, 0, 1) == '!') { |
601 | 601 | $qb->andWhere('tbl.' . $k . ' != :' . $k) |
602 | - ->setParameter($k, substr($v, 1, strlen($v)-1)); |
|
602 | + ->setParameter($k, substr($v, 1, strlen($v)-1)); |
|
603 | 603 | } elseif (substr($v, 0, 1) == '%') { |
604 | 604 | $qb->andWhere('tbl.' . $k . ' LIKE :' . $k) |
605 | - ->setParameter($k, '%' . $v . '%'); |
|
605 | + ->setParameter($k, '%' . $v . '%'); |
|
606 | 606 | } else { |
607 | 607 | $qb->andWhere('tbl.' . $k . ' = :' . $k) |
608 | - ->setParameter($k, $v); |
|
609 | - } |
|
608 | + ->setParameter($k, $v); |
|
609 | + } |
|
610 | 610 | } |
611 | 611 | } |
612 | 612 | } |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | $parameters['searchGroup'] = '%' . $fragment . '%'; |
704 | 704 | |
705 | 705 | $qb->andWhere('(' . implode(' OR ', $filters) . ')') |
706 | - ->setParameters($parameters); |
|
706 | + ->setParameters($parameters); |
|
707 | 707 | |
708 | 708 | return $qb; |
709 | 709 | } |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | |
757 | 757 | $qb = $this->getEntityManager()->createQueryBuilder(); |
758 | 758 | $qb->select($selection) |
759 | - ->from('Zikula\RoutesModule\Entity\RouteEntity', 'tbl'); |
|
759 | + ->from('Zikula\RoutesModule\Entity\RouteEntity', 'tbl'); |
|
760 | 760 | |
761 | 761 | if (true === $useJoins) { |
762 | 762 | $this->addJoinsToFrom($qb); |
@@ -801,7 +801,7 @@ discard block |
||
801 | 801 | { |
802 | 802 | $qb = $this->getCountQuery('', false); |
803 | 803 | $qb->andWhere('tbl.' . $fieldName . ' = :' . $fieldName) |
804 | - ->setParameter($fieldName, $fieldValue); |
|
804 | + ->setParameter($fieldName, $fieldValue); |
|
805 | 805 | |
806 | 806 | $qb = $this->addExclusion($qb, $excludeId); |
807 | 807 | |
@@ -847,7 +847,7 @@ discard block |
||
847 | 847 | |
848 | 848 | $qb = $this->getEntityManager()->createQueryBuilder(); |
849 | 849 | $qb->select($selection) |
850 | - ->from('Zikula\RoutesModule\Entity\RouteEntity', 'tbl'); |
|
850 | + ->from('Zikula\RoutesModule\Entity\RouteEntity', 'tbl'); |
|
851 | 851 | |
852 | 852 | if (true === $useJoins) { |
853 | 853 | $this->addJoinsToFrom($qb); |
@@ -921,7 +921,7 @@ discard block |
||
921 | 921 | |
922 | 922 | $userId = $this->getRequest()->getSession()->get('uid'); |
923 | 923 | $qb->andWhere('tbl.createdBy = :creator') |
924 | - ->setParameter('creator', $userId); |
|
924 | + ->setParameter('creator', $userId); |
|
925 | 925 | } |
926 | 926 | |
927 | 927 | return $qb; |
@@ -940,7 +940,7 @@ discard block |
||
940 | 940 | if ($orderBy == 'RAND()') { |
941 | 941 | // random selection |
942 | 942 | $qb->addSelect('MOD(tbl.id, ' . mt_rand(2, 15) . ') AS HIDDEN randomIdentifiers') |
943 | - ->add('orderBy', 'randomIdentifiers'); |
|
943 | + ->add('orderBy', 'randomIdentifiers'); |
|
944 | 944 | $orderBy = ''; |
945 | 945 | } elseif (empty($orderBy)) { |
946 | 946 | $orderBy = $this->defaultSortingField; |
@@ -953,12 +953,12 @@ discard block |
||
953 | 953 | } |
954 | 954 | if (false !== strpos($orderBy, 'tbl.createdBy')) { |
955 | 955 | $qb->addSelect('tblCreator') |
956 | - ->leftJoin('tbl.createdBy', 'tblCreator'); |
|
956 | + ->leftJoin('tbl.createdBy', 'tblCreator'); |
|
957 | 957 | $orderBy = str_replace('tbl.createdBy', 'tblCreator.uname', $orderBy); |
958 | 958 | } |
959 | 959 | if (false !== strpos($orderBy, 'tbl.updatedBy')) { |
960 | 960 | $qb->addSelect('tblUpdater') |
961 | - ->leftJoin('tbl.updatedBy', 'tblUpdater'); |
|
961 | + ->leftJoin('tbl.updatedBy', 'tblUpdater'); |
|
962 | 962 | $orderBy = str_replace('tbl.updatedBy', 'tblUpdater.uname', $orderBy); |
963 | 963 | } |
964 | 964 | $qb->add('orderBy', $orderBy); |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | public function getSelectWherePaginatedQuery(QueryBuilder $qb, $currentPage = 1, $resultsPerPage = 25) |
529 | 529 | { |
530 | 530 | $query = $this->getQueryFromBuilder($qb); |
531 | - $offset = ($currentPage-1) * $resultsPerPage; |
|
531 | + $offset = ($currentPage - 1) * $resultsPerPage; |
|
532 | 532 | |
533 | 533 | $query->setFirstResult($offset) |
534 | 534 | ->setMaxResults($resultsPerPage); |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | if ((!is_numeric($v) && $v != '') || (is_numeric($v) && $v > 0)) { |
597 | 597 | if ($k == 'workflowState' && substr($v, 0, 1) == '!') { |
598 | 598 | $qb->andWhere('tbl.' . $k . ' != :' . $k) |
599 | - ->setParameter($k, substr($v, 1, strlen($v)-1)); |
|
599 | + ->setParameter($k, substr($v, 1, strlen($v) - 1)); |
|
600 | 600 | } elseif (substr($v, 0, 1) == '%') { |
601 | 601 | $qb->andWhere('tbl.' . $k . ' LIKE :' . $k) |
602 | 602 | ->setParameter($k, '%' . $v . '%'); |