@@ -385,6 +385,9 @@ discard block |
||
385 | 385 | } |
386 | 386 | } |
387 | 387 | |
388 | + /** |
|
389 | + * @param string $name |
|
390 | + */ |
|
388 | 391 | protected function createRegistryMock($name, $em) |
389 | 392 | { |
390 | 393 | $registry = $this->getMockBuilder(ManagerRegistry::class)->getMock(); |
@@ -396,6 +399,9 @@ discard block |
||
396 | 399 | return $registry; |
397 | 400 | } |
398 | 401 | |
402 | + /** |
|
403 | + * @param \DateTime $now |
|
404 | + */ |
|
399 | 405 | protected function generateCategoryRegistry($now) |
400 | 406 | { |
401 | 407 | $registry = new CategoryRegistryEntity(); |
@@ -411,6 +417,9 @@ discard block |
||
411 | 417 | $this->em->flush(); |
412 | 418 | } |
413 | 419 | |
420 | + /** |
|
421 | + * @param \DateTime $now |
|
422 | + */ |
|
414 | 423 | protected function generateCategories($now) |
415 | 424 | { |
416 | 425 | // root |
@@ -256,9 +256,9 @@ |
||
256 | 256 | $siteName = $this->variableApi->getSystemVar('sitename'); |
257 | 257 | $pageTitle = $this->controllerHelper->formatPermalink($this->themePageVars->get('title', '')); |
258 | 258 | $fileTitle = $this->controllerHelper->formatPermalink($siteName) |
259 | - . '-' |
|
260 | - . ($pageTitle != '' ? $pageTitle . '-' : '') |
|
261 | - . date('Ymd') . '.pdf'; |
|
259 | + . '-' |
|
260 | + . ($pageTitle != '' ? $pageTitle . '-' : '') |
|
261 | + . date('Ymd') . '.pdf'; |
|
262 | 262 | |
263 | 263 | /* |
264 | 264 | if (true === $this->request->query->getBoolean('dbg', false)) { |
@@ -93,31 +93,31 @@ |
||
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
96 | - * This method returns a list of possible object states. |
|
97 | - * |
|
98 | - * @return array List of collected state information |
|
99 | - */ |
|
100 | - public function getObjectStates() |
|
101 | - { |
|
102 | - $states = []; |
|
103 | - $states[] = [ |
|
104 | - 'value' => 'initial', |
|
105 | - 'text' => $this->translator->__('Initial'), |
|
106 | - 'ui' => 'danger' |
|
107 | - ]; |
|
108 | - $states[] = [ |
|
109 | - 'value' => 'approved', |
|
110 | - 'text' => $this->translator->__('Approved'), |
|
111 | - 'ui' => 'success' |
|
112 | - ]; |
|
113 | - $states[] = [ |
|
114 | - 'value' => 'deleted', |
|
115 | - 'text' => $this->translator->__('Deleted'), |
|
116 | - 'ui' => 'danger' |
|
117 | - ]; |
|
96 | + * This method returns a list of possible object states. |
|
97 | + * |
|
98 | + * @return array List of collected state information |
|
99 | + */ |
|
100 | + public function getObjectStates() |
|
101 | + { |
|
102 | + $states = []; |
|
103 | + $states[] = [ |
|
104 | + 'value' => 'initial', |
|
105 | + 'text' => $this->translator->__('Initial'), |
|
106 | + 'ui' => 'danger' |
|
107 | + ]; |
|
108 | + $states[] = [ |
|
109 | + 'value' => 'approved', |
|
110 | + 'text' => $this->translator->__('Approved'), |
|
111 | + 'ui' => 'success' |
|
112 | + ]; |
|
113 | + $states[] = [ |
|
114 | + 'value' => 'deleted', |
|
115 | + 'text' => $this->translator->__('Deleted'), |
|
116 | + 'ui' => 'danger' |
|
117 | + ]; |
|
118 | 118 | |
119 | - return $states; |
|
120 | - } |
|
119 | + return $states; |
|
120 | + } |
|
121 | 121 | |
122 | 122 | /** |
123 | 123 | * This method returns information about a certain state. |
@@ -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()); |