Completed
Push — master ( fa7cf7...2ed941 )
by Florian
03:07
created
Form/QueryType.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -51,21 +51,21 @@  discard block
 block discarded – undo
51 51
 		$maxChoiceGroupCount = $options['max_choice_group_count'];
52 52
 		$data = array();
53 53
 		
54
-		if($usedFacets && !$result) {
55
-			foreach($usedFacets as $facetType) {
54
+		if ($usedFacets && !$result) {
55
+			foreach ($usedFacets as $facetType) {
56 56
 				$preferredChoices = isset($preferredFilterChoices[$facetType]) ? $preferredFilterChoices[$facetType] : array(); 
57 57
 				
58
-				$builder->add('facet_' . $facetType, FacetType::class, array(
59
-					'label' => 'stinger_soft_entity_search.forms.query.' . $facetType . '.label',
58
+				$builder->add('facet_'.$facetType, FacetType::class, array(
59
+					'label' => 'stinger_soft_entity_search.forms.query.'.$facetType.'.label',
60 60
 					'multiple' => true,
61 61
 					'expanded' => true,
62
-					'preferred_choices' => function ($val) use ($preferredChoices, $data) {
63
-						return count($preferredChoices) == 0 || in_array($val, $preferredChoices) || in_array($val, $data['facet_' . $facetType]);
62
+					'preferred_choices' => function($val) use ($preferredChoices, $data) {
63
+						return count($preferredChoices) == 0 || in_array($val, $preferredChoices) || in_array($val, $data['facet_'.$facetType]);
64 64
 					},
65 65
 				));
66 66
 			}
67 67
 		}
68
-		if($result) {
68
+		if ($result) {
69 69
 			$this->createFacets($builder, $result->getFacets());
70 70
 		}
71 71
 		
@@ -101,16 +101,16 @@  discard block
 block discarded – undo
101 101
 		$preferredFilterChoices = $options['preferred_filter_choices'];
102 102
 		$maxChoiceGroupCount = $options['max_choice_group_count'];
103 103
 		$data = array();
104
-		foreach($facets->getFacets() as $facetType => $facetValues) {
104
+		foreach ($facets->getFacets() as $facetType => $facetValues) {
105 105
 			$preferredChoices = isset($preferredFilterChoices[$facetType]) ? $preferredFilterChoices[$facetType] : array();
106 106
 			
107
-			$builder->add('facet_' . $facetType, FacetType::class, array(
108
-				'label' => 'stinger_soft_entity_search.forms.query.' . $facetType . '.label',
107
+			$builder->add('facet_'.$facetType, FacetType::class, array(
108
+				'label' => 'stinger_soft_entity_search.forms.query.'.$facetType.'.label',
109 109
 				'multiple' => true,
110 110
 				'expanded' => true,
111
-				'choices' => $this->generateFacetChoices($facetType, $facetValues) ,
112
-				'preferred_choices' => function ($val) use ($preferredChoices, $data) {
113
-					return count($preferredChoices) == 0 || in_array($val, $preferredChoices) || in_array($val, $data['facet_' . $facetType]);
111
+				'choices' => $this->generateFacetChoices($facetType, $facetValues),
112
+				'preferred_choices' => function($val) use ($preferredChoices, $data) {
113
+					return count($preferredChoices) == 0 || in_array($val, $preferredChoices) || in_array($val, $data['facet_'.$facetType]);
114 114
 				},
115 115
 			));
116 116
 		}
@@ -124,10 +124,10 @@  discard block
 block discarded – undo
124 124
 	protected function generateFacetChoices($facetType, array $facets) {
125 125
 		$choices = array();
126 126
 		
127
-		foreach($facets as $facet => $count) {
128
-			if($count == 0)
127
+		foreach ($facets as $facet => $count) {
128
+			if ($count == 0)
129 129
 				break;
130
-			$choices[$facet . ' (' . $count . ')'] = $facet;
130
+			$choices[$facet.' ('.$count.')'] = $facet;
131 131
 		}
132 132
 		return $choices;
133 133
 	}
Please login to merge, or discard this patch.