GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( db8ca1...008011 )
by Florian
06:41 queued 04:44
created
Tests/Controller/SearchControllerTest.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -77,6 +77,9 @@
 block discarded – undo
77 77
 
78 78
 	}
79 79
 
80
+	/**
81
+	 * @param \StingerSoft\EntitySearchBundle\Services\DummySearchService $searchService
82
+	 */
80 83
 	protected function getSearchController(?SearchService $searchService = null): SearchController {
81 84
 		$searchService = $searchService ?? $this->getDummySearchService();
82 85
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 			return \in_array($id, ['twig', 'form.factory'], true);
98 98
 		});
99 99
 		$container->method('get')->willReturnCallback(function($id) use ($that) {
100
-			if($id === 'form.factory') {
100
+			if ($id === 'form.factory') {
101 101
 				$resolvedFormTypeFactory = new ResolvedFormTypeFactory();
102 102
 				$formTypeFactory = Forms::createFormFactoryBuilder()
103 103
 					->addType(new FacetType())
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 					->getFormFactory();
108 108
 				return $formTypeFactory;
109 109
 			}
110
-			if($id === 'twig') {
110
+			if ($id === 'twig') {
111 111
 				return $that;
112 112
 			}
113 113
 		});
Please login to merge, or discard this patch.
Controller/SearchControllerTrait.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	private $facetFormatter;
33 33
 
34 34
 	public function searchAction(Request $request, DocumentToEntityMapperInterface $mapper) {
35
-		if($request->query->get('term', false) !== false) {
35
+		if ($request->query->get('term', false) !== false) {
36 36
 			$this->setSearchTerm($request->getSession(), $request->query->get('term'));
37 37
 			return $this->redirectToRoute('stinger_soft_entity_search_search');
38 38
 		}
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 		));
49 49
 
50 50
 		$facetForm->handleRequest($request);
51
-		if($facetForm->isSubmitted()) {
52
-			if($facetForm->get('clear')->isClicked()) {
51
+		if ($facetForm->isSubmitted()) {
52
+			if ($facetForm->get('clear')->isClicked()) {
53 53
 				$query->setFacets($this->getDefaultFacets());
54 54
 			}
55 55
 			$this->setSearchTerm($request->getSession(), $query->getSearchTerm());
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
 
68 68
 			$page = (int)$request->query->get('page', 1);
69 69
 			$results = null;
70
-			if($result instanceof PaginatableResultSet) {
70
+			if ($result instanceof PaginatableResultSet) {
71 71
 				$results = $result->paginate($page, $this->getResultsPerPage());
72
-			} elseif($results !== null) {
72
+			} elseif ($results !== null) {
73 73
 				$results = $result->getResults(($page - 1) * $this->getResultsPerPage(), $this->getResultsPerPage());
74 74
 			}
75 75
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 				'mapper'    => $mapper,
81 81
 				'facetForm' => $facetForm->createView()
82 82
 			));
83
-		} catch(\Exception $exception) {
83
+		} catch (\Exception $exception) {
84 84
 			$response = $this->render($this->getErrorTemplate(), array(
85 85
 				'error' => $exception->getMessage(),
86 86
 				'term'  => $query->getSearchTerm()
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	protected function getConfiguredUsedFacets(array $queryUsedFacets) {
125 125
 		$availableFacets = $this->getAvailableFacets();
126 126
 		$usedFacets = array();
127
-		foreach($queryUsedFacets as $queryUsedFacet) {
127
+		foreach ($queryUsedFacets as $queryUsedFacet) {
128 128
 			$usedFacets[$queryUsedFacet] = $availableFacets[$queryUsedFacet];
129 129
 		}
130 130
 		return $usedFacets;
@@ -191,15 +191,15 @@  discard block
 block discarded – undo
191 191
 	}
192 192
 
193 193
 	protected function initFacets() {
194
-		if(!$this->availableFacets) {
194
+		if (!$this->availableFacets) {
195 195
 			$this->availableFacets = array();
196 196
 			$this->facetFormatter = array();
197 197
 
198 198
 			$facetServices = $this->getParameter('stinger_soft.entity_search.available_facets');
199
-			foreach($facetServices as $facetServiceId) {
199
+			foreach ($facetServices as $facetServiceId) {
200 200
 				$facetService = $this->searchService->getFacet($facetServiceId);
201 201
 				$this->availableFacets[$facetService->getField()] = $facetService->getFormOptions();
202
-				if($facetService->getFacetFormatter()) {
202
+				if ($facetService->getFacetFormatter()) {
203 203
 					$this->facetFormatter[$facetService->getField()] = $facetService->getFacetFormatter();
204 204
 				}
205 205
 			}
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 	 * @return string[string][]
214 214
 	 */
215 215
 	protected function getSearchFacets(SessionInterface $session) {
216
-		$facets = $session->get($this->getSessionPrefix() . '_facets', false);
216
+		$facets = $session->get($this->getSessionPrefix().'_facets', false);
217 217
 		return $facets ? \json_decode($facets, true) : $this->getDefaultFacets();
218 218
 	}
219 219
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 	 * @param string[string][] $facets
225 225
 	 */
226 226
 	protected function setSearchFacets(SessionInterface $session, $facets) {
227
-		$session->set($this->getSessionPrefix() . '_facets', \json_encode($facets));
227
+		$session->set($this->getSessionPrefix().'_facets', \json_encode($facets));
228 228
 	}
229 229
 
230 230
 	/**
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 	 * @return mixed
235 235
 	 */
236 236
 	protected function getSearchTerm(SessionInterface $session) {
237
-		return $session->get($this->getSessionPrefix() . '_term', false);
237
+		return $session->get($this->getSessionPrefix().'_term', false);
238 238
 	}
239 239
 
240 240
 	/**
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 	 * @param string $term
245 245
 	 */
246 246
 	protected function setSearchTerm(SessionInterface $session, $term) {
247
-		$session->set($this->getSessionPrefix() . '_term', $term);
247
+		$session->set($this->getSessionPrefix().'_term', $term);
248 248
 	}
249 249
 
250 250
 }
251 251
\ No newline at end of file
Please login to merge, or discard this patch.
Tests/Model/Result/FacetSetAdapterTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 
17 17
 class FacetSetAdapterTest extends \PHPUnit\Framework\TestCase {
18 18
 
19
-	public function testAddFacetValue(){
19
+	public function testAddFacetValue() {
20 20
 		$facets = new FacetSetAdapter(array());
21 21
 		$this->assertCount(0, $facets);
22 22
 		$facets->addFacetValue(Document::FIELD_AUTHOR, 'Oliver Kotte');
@@ -26,13 +26,13 @@  discard block
 block discarded – undo
26 26
 		$this->assertCount(1, $facets);
27 27
 		$this->assertCount(2, $facets->getFacet(Document::FIELD_AUTHOR));
28 28
 		
29
-		foreach($facets as $facetKey => $facetValues){
29
+		foreach ($facets as $facetKey => $facetValues) {
30 30
 			$this->assertEquals(Document::FIELD_AUTHOR, $facetKey);
31 31
 			$this->assertCount(2, $facetValues);
32 32
 		}
33 33
 	}
34 34
 	
35
-	public function testGetFacet(){
35
+	public function testGetFacet() {
36 36
 		$facets = new FacetSetAdapter(array());
37 37
 		$this->assertCount(0, $facets);
38 38
 		$this->assertNull($facets->getFacet('NotExisting'));
Please login to merge, or discard this patch.
DependencyInjection/StingerSoftEntitySearchExtension.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
 
38 38
 		$container->setParameter('stinger_soft.entity_search.available_facets', $config['facets']);
39 39
 
40
-		$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
40
+		$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
41 41
 		$loader->load('services.yml');
42 42
 		
43 43
 		$entityToDocumentMapperDefinition = $container->getDefinition(EntityToDocumentMapperInterface::class);
Please login to merge, or discard this patch.
DependencyInjection/Compiler/FacetCompilerPass.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,13 +16,13 @@  discard block
 block discarded – undo
16 16
 	 * @param ContainerBuilder $container
17 17
 	 */
18 18
 	public function process(ContainerBuilder $container) {
19
-		if(!$container->hasAlias(SearchService::class)) {
19
+		if (!$container->hasAlias(SearchService::class)) {
20 20
 			return;
21 21
 		}
22 22
 
23 23
 		$serviceId = (string)$container->getAlias(SearchService::class);
24 24
 
25
-		if(!$container->hasDefinition($serviceId)) {
25
+		if (!$container->hasDefinition($serviceId)) {
26 26
 			return;
27 27
 		}
28 28
 
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
 		$servicesMap = array();
32 32
 		// Builds an array with fully-qualified type class names as keys and service IDs as values
33
-		foreach($container->findTaggedServiceIds(FacetServiceInterface::TAG_NAME, true) as $serviceId => $tag) {
33
+		foreach ($container->findTaggedServiceIds(FacetServiceInterface::TAG_NAME, true) as $serviceId => $tag) {
34 34
 			// Add form type service to the service locator
35 35
 			$serviceDefinition = $container->getDefinition($serviceId);
36 36
 			$servicesMap[$serviceDefinition->getClass()] = new Reference($serviceId);
Please login to merge, or discard this patch.
DependencyInjection/Configuration.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
 	 */
32 32
 	public function getConfigTreeBuilder() {
33 33
 		$treeBuilder = new TreeBuilder('stinger_soft_entity_search');
34
-		if(Kernel::VERSION_ID < 40200) {
34
+		if (Kernel::VERSION_ID < 40200) {
35 35
 			$root = $treeBuilder->root('stinger_soft_entity_search');
36 36
 		} else {
37 37
 			$root = $treeBuilder->getRootNode();
Please login to merge, or discard this patch.
Form/FacetChoiceLoader.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
 	public function loadValuesForChoices(array $choices, $value = null): array {
42 42
 		// is called on form creat with $choices containing the preset of the bound entity
43 43
 		$values = array();
44
-		foreach($choices as $key => $choice) {
44
+		foreach ($choices as $key => $choice) {
45 45
 			// we use a DataTransformer, thus only plain values arrive as choices which can be used directly as value
46
-			if(is_callable($value)) {
46
+			if (is_callable($value)) {
47 47
 				$values[$key] = (string)call_user_func($value, $choice, $key);
48 48
 			} else {
49 49
 				$values[$key] = $choice;
@@ -87,9 +87,9 @@  discard block
 block discarded – undo
87 87
 	public function loadChoicesForValues(array $values, $value = null): array {
88 88
 		// is called on form submit after loadValuesForChoices of form create and loadChoiceList of form view create
89 89
 		$choices = array();
90
-		foreach($values as $key => $val) {
90
+		foreach ($values as $key => $val) {
91 91
 			// we use a DataTransformer, thus only plain values arrive as choices which can be used directly as value
92
-			if(is_callable($value)) {
92
+			if (is_callable($value)) {
93 93
 				$choices[$key] = (string)call_user_func($value, $val, $key);
94 94
 			} else {
95 95
 				$choices[$key] = $val;
Please login to merge, or discard this patch.
Form/FacetType.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,12 +32,12 @@
 block discarded – undo
32 32
 		$builder->resetModelTransformers();
33 33
 		$builder->resetViewTransformers();
34 34
 		
35
-		if($options['multiple']) {
36
-			$builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) {
35
+		if ($options['multiple']) {
36
+			$builder->addEventListener(FormEvents::PRE_SUBMIT, function(FormEvent $event) {
37 37
 				$event->stopPropagation();
38 38
 			}, 1);
39 39
 		}
40
-		$builder->addEventListener(FormEvents::SUBMIT, function (FormEvent $event) {
40
+		$builder->addEventListener(FormEvents::SUBMIT, function(FormEvent $event) {
41 41
 			$data = $event->getForm()->getExtraData();
42 42
 			//$event->setData(array_unique(array_merge($data, $event->getData())));
43 43
 			$event->setData($data);
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,6 @@
 block discarded – undo
18 18
 use Symfony\Component\Form\FormEvent;
19 19
 use Symfony\Component\Form\FormEvents;
20 20
 use Symfony\Component\OptionsResolver\OptionsResolver;
21
-use Symfony\Component\HttpKernel\Kernel;
22 21
 
23 22
 class FacetType extends AbstractType {
24 23
 
Please login to merge, or discard this patch.
Form/QueryType.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -55,25 +55,25 @@  discard block
 block discarded – undo
55 55
 		$preferredFilterChoices = $options['preferred_filter_choices'];
56 56
 		$maxChoiceGroupCount = (int)$options['max_choice_group_count'];
57 57
 
58
-		if($usedFacets && !$result) {
58
+		if ($usedFacets && !$result) {
59 59
 			$data = [];
60
-			foreach($usedFacets as $facetType => $facetTypeOptions) {
60
+			foreach ($usedFacets as $facetType => $facetTypeOptions) {
61 61
 				$facetTypeOptions = is_array($facetTypeOptions) ? $facetTypeOptions : [];
62 62
 				$preferredChoices = $preferredFilterChoices[$facetType] ?? [];
63 63
 				$i = 0;
64
-				$builder->add('facet_' . $facetType, FacetType::class, array_merge(array(
65
-					'label'             => 'stinger_soft_entity_search.forms.query.' . $facetType . '.label',
64
+				$builder->add('facet_'.$facetType, FacetType::class, array_merge(array(
65
+					'label'             => 'stinger_soft_entity_search.forms.query.'.$facetType.'.label',
66 66
 					'multiple'          => true,
67 67
 					'expanded'          => true,
68 68
 					'preferred_choices' => function($val) use ($preferredChoices, $data, $facetType, $maxChoiceGroupCount, &$i) {
69
-						$facetKey = 'facet_' . $facetType;
69
+						$facetKey = 'facet_'.$facetType;
70 70
 						return $i++ < $maxChoiceGroupCount || $maxChoiceGroupCount === 0 || \in_array($val, $preferredChoices) || (isset($data[$facetKey]) && \in_array($val, $data[$facetKey]));
71 71
 					}
72 72
 				), $facetTypeOptions));
73 73
 				unset($i);
74 74
 			}
75 75
 		}
76
-		if($result) {
76
+		if ($result) {
77 77
 			$builder->addEventListener(FormEvents::PRE_SET_DATA, function(FormEvent $event) use ($options, $result) {
78 78
 				$this->createFacets($event->getForm(), $result->getFacets(), $options, $event->getData());
79 79
 			});
@@ -137,14 +137,14 @@  discard block
 block discarded – undo
137 137
 		$selectedFacets = $data->getFacets();
138 138
 		$usedFacets = $options['used_facets'];
139 139
 
140
-		foreach($facets->getFacets() as $facetType => $facetValues) {
140
+		foreach ($facets->getFacets() as $facetType => $facetValues) {
141 141
 			$preferredChoices = $preferredFilterChoices[$facetType] ?? [];
142 142
 
143 143
 			$i = 0;
144 144
 			$facetTypeOptions = $usedFacets[$facetType] ?? [];
145 145
 			$formatter = $options['facet_formatter'][$facetType] ?? null;
146
-			$builder->add('facet_' . $facetType, FacetType::class, array_merge(array(
147
-				'label'             => 'stinger_soft_entity_search.forms.query.' . $facetType . '.label',
146
+			$builder->add('facet_'.$facetType, FacetType::class, array_merge(array(
147
+				'label'             => 'stinger_soft_entity_search.forms.query.'.$facetType.'.label',
148 148
 				'multiple'          => true,
149 149
 				'expanded'          => true,
150 150
 				'choices'           => $this->generateFacetChoices($facetType, $facetValues, $selectedFacets[$facetType] ?? [], $formatter),
@@ -166,16 +166,16 @@  discard block
 block discarded – undo
166 166
 	 */
167 167
 	protected function generateFacetChoices($facetType, array $facets, array $selectedFacets = [], callable $formatter = null): array {
168 168
 		$choices = [];
169
-		foreach($facets as $facet => $data) {
169
+		foreach ($facets as $facet => $data) {
170 170
 			$value = $data['value'];
171 171
 			$count = $data['count'];
172
-			if($count === 0 && !\in_array($facet, $selectedFacets)) {
172
+			if ($count === 0 && !\in_array($facet, $selectedFacets)) {
173 173
 				continue;
174 174
 			}
175 175
 			$choices[$this->formatFacet($formatter, $facetType, $facet, $value, $count)] = $facet;
176 176
 		}
177
-		foreach($selectedFacets as $facet) {
178
-			if(isset($facets[$facet])) {
177
+		foreach ($selectedFacets as $facet) {
178
+			if (isset($facets[$facet])) {
179 179
 				continue;
180 180
 			}
181 181
 			$value = $facets[$facet]['value'];
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
 	 * @return string
195 195
 	 */
196 196
 	protected function formatFacet($formatter, $facetType, $facet, $value, $count):string {
197
-		$default = $facet . ' (' . $count . ')';
198
-		if(!$formatter) {
197
+		$default = $facet.' ('.$count.')';
198
+		if (!$formatter) {
199 199
 			return $default;
200 200
 		}
201 201
 		return $formatter($facetType, $value, $count, $default);
Please login to merge, or discard this patch.