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 ( 008011...b35119 )
by Florian
47s
created
Services/DoctrineListener.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	 * @param LifecycleEventArgs $args
119 119
 	 */
120 120
 	public function postPersist(LifecycleEventArgs $args): void {
121
-		if(!$this->enableIndexing) {
121
+		if (!$this->enableIndexing) {
122 122
 			return;
123 123
 		}
124 124
 		$this->updateEntity($args->getObject(), $args->getObjectManager());
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	 * @throws \Doctrine\ORM\OptimisticLockException
131 131
 	 */
132 132
 	public function postFlush(PostFlushEventArgs $eventArgs): void {
133
-		if($this->needsFlush) {
133
+		if ($this->needsFlush) {
134 134
 			$this->needsFlush = false;
135 135
 			$eventArgs->getEntityManager()->flush();
136 136
 		}
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 * @param LifecycleEventArgs $args
143 143
 	 */
144 144
 	public function preRemove(LifecycleEventArgs $args): void {
145
-		if(!$this->enableIndexing) {
145
+		if (!$this->enableIndexing) {
146 146
 			return;
147 147
 		}
148 148
 		$this->removeEntity($args->getObject(), $args->getObjectManager());
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	 * @param LifecycleEventArgs $args
155 155
 	 */
156 156
 	public function postUpdate(LifecycleEventArgs $args): void {
157
-		if(!$this->enableIndexing) return;
157
+		if (!$this->enableIndexing) return;
158 158
 		$this->updateEntity($args->getObject(), $args->getObjectManager());
159 159
 	}
160 160
 
@@ -179,12 +179,12 @@  discard block
 block discarded – undo
179 179
 	 * @param object $entity
180 180
 	 */
181 181
 	protected function updateEntity(object $entity, ObjectManager $manager): void {
182
-		if($entity instanceof SearchableAlias) {
182
+		if ($entity instanceof SearchableAlias) {
183 183
 			$entity = $entity->getEntityToIndex();
184 184
 		}
185 185
 		$document = $this->getEntityToDocumentMapper()->createDocument($manager, $entity);
186
-		if($document !== null) {
187
-			if($this->getEventDispatcher()) {
186
+		if ($document !== null) {
187
+			if ($this->getEventDispatcher()) {
188 188
 				$event = new DocumentPreSaveEvent($document);
189 189
 				$this->getEventDispatcher()->dispatch($event, DocumentPreSaveEvent::NAME);
190 190
 			}
@@ -198,11 +198,11 @@  discard block
 block discarded – undo
198 198
 	 * @param object $entity
199 199
 	 */
200 200
 	protected function removeEntity(object $entity, ObjectManager $manager): void {
201
-		if($entity instanceof SearchableAlias) {
201
+		if ($entity instanceof SearchableAlias) {
202 202
 			$entity = $entity->getEntityToIndex();
203 203
 		}
204 204
 		$document = $this->getEntityToDocumentMapper()->createDocument($manager, $entity);
205
-		if($document !== null) {
205
+		if ($document !== null) {
206 206
 			$this->getSearchService()->removeDocument($document);
207 207
 			$this->needsFlush = true;
208 208
 		}
Please login to merge, or discard this patch.
Services/Mapping/DocumentToEntityMapper.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,14 +36,14 @@
 block discarded – undo
36 36
 	public function getEntity(Document $document): ?object {
37 37
 		$clazz = $document->getEntityClass();
38 38
 
39
-		if($clazz === null) {
39
+		if ($clazz === null) {
40 40
 			return null;
41 41
 		}
42
-		if(!$document->getEntityId()) {
42
+		if (!$document->getEntityId()) {
43 43
 			return null;
44 44
 		}
45 45
 		$manager = $this->managerRegistry->getManagerForClass($clazz);
46
-		if($manager === null) {
46
+		if ($manager === null) {
47 47
 			return null;
48 48
 		}
49 49
 		return $manager->getRepository($clazz)->find($document->getEntityId());
Please login to merge, or discard this patch.
Services/AbstractSearchService.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
 	 * @required
54 54
 	 */
55 55
 	public function setObjectManager(EntityManagerInterface $om): void {
56
-		if($this->objectManager)
56
+		if ($this->objectManager)
57 57
 			return;
58 58
 		$this->objectManager = $om;
59 59
 	}
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,8 +53,9 @@
 block discarded – undo
53 53
 	 * @required
54 54
 	 */
55 55
 	public function setObjectManager(EntityManagerInterface $om): void {
56
-		if($this->objectManager)
57
-			return;
56
+		if($this->objectManager) {
57
+					return;
58
+		}
58 59
 		$this->objectManager = $om;
59 60
 	}
60 61
 
Please login to merge, or discard this patch.
StingerSoftEntitySearchBundle.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
 
25 25
 	public static function getRequiredBundles(string $env, array &$requiredBundles = []): array {
26 26
 
27
-		if(isset($requiredBundles['StingerSoftEntitySearchBundle'])) {
27
+		if (isset($requiredBundles['StingerSoftEntitySearchBundle'])) {
28 28
 			return $requiredBundles;
29 29
 		}
30 30
 
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),
@@ -167,17 +167,17 @@  discard block
 block discarded – undo
167 167
 	protected function generateFacetChoices($facetType, array $facets, array $selectedFacets = [], callable $formatter = null): array {
168 168
 		$choices = [];
169 169
 		$handledFacets = [];
170
-		foreach($facets as $facet => $data) {
170
+		foreach ($facets as $facet => $data) {
171 171
 			$value = $data['value'];
172 172
 			$count = $data['count'];
173
-			if($count === 0 && !\in_array($facet, $selectedFacets)) {
173
+			if ($count === 0 && !\in_array($facet, $selectedFacets)) {
174 174
 				continue;
175 175
 			}
176 176
 			$handledFacets[$facet] = true;
177 177
 			$choices[$this->formatFacet($formatter, $facetType, $facet, $value, $count)] = $facet;
178 178
 		}
179
-		foreach($selectedFacets as $facet) {
180
-			if(!isset($facets[$facet]) || isset($handledFacets[$facet])) {
179
+		foreach ($selectedFacets as $facet) {
180
+			if (!isset($facets[$facet]) || isset($handledFacets[$facet])) {
181 181
 				continue;
182 182
 			}
183 183
 			$value = $facets[$facet]['value'];
@@ -196,8 +196,8 @@  discard block
 block discarded – undo
196 196
 	 * @return string
197 197
 	 */
198 198
 	protected function formatFacet($formatter, $facetType, $facet, $value, $count):string {
199
-		$default = $facet . ' (' . $count . ')';
200
-		if(!$formatter) {
199
+		$default = $facet.' ('.$count.')';
200
+		if (!$formatter) {
201 201
 			return $default;
202 202
 		}
203 203
 		return $formatter($facetType, $value, $count, $default);
Please login to merge, or discard this patch.
Command/SyncCommand.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
 		$this->searchService = $searchService;
72 72
 		$this->entityToDocumentMapper = $mapper;
73 73
 		// Detect upload path
74
-		if(!self::$defaultUploadPath) {
74
+		if (!self::$defaultUploadPath) {
75 75
 			$root = $kernel->getProjectDir();
76
-			self::$defaultUploadPath = $root . '/../web/uploads';
76
+			self::$defaultUploadPath = $root.'/../web/uploads';
77 77
 		}
78 78
 	}
79 79
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 		// Get the entity argument
114 114
 		$entity = $input->getArgument('entity');
115 115
 
116
-		if($entity === 'all') {
116
+		if ($entity === 'all') {
117 117
 			/**
118 118
 			 * @var EntityManager $entityManager
119 119
 			 */
@@ -124,12 +124,12 @@  discard block
 block discarded – undo
124 124
 			/**
125 125
 			 * @var ClassMetadata $m
126 126
 			 */
127
-			foreach($meta as $m) {
127
+			foreach ($meta as $m) {
128 128
 
129
-				if($m->getReflectionClass()->isAbstract() || $m->getReflectionClass()->isInterface()) {
129
+				if ($m->getReflectionClass()->isAbstract() || $m->getReflectionClass()->isInterface()) {
130 130
 					continue;
131 131
 				}
132
-				if(!$this->entityToDocumentMapper->isClassIndexable($m->getReflectionClass()->getName())) {
132
+				if (!$this->entityToDocumentMapper->isClassIndexable($m->getReflectionClass()->getName())) {
133 133
 					continue;
134 134
 				}
135 135
 				$this->indexEntity($input, $output, $m->getReflectionClass()->getName());
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 		try {
164 164
 			// Get repository for the given entity type
165 165
 			$repository = $entityManager->getRepository($entity);
166
-		} catch(Exception $e) {
166
+		} catch (Exception $e) {
167 167
 			$output->writeln(sprintf('<error>No repository found for "%s", check your input</error>', $entity));
168 168
 			return;
169 169
 		}
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 
176 176
 		$useBatch = !($entityManager->getConnection()->getDatabasePlatform() instanceof SQLServerPlatform);
177 177
 		$iterableResult = $useBatch ? $queryBuilder->getQuery()->iterate() : $queryBuilder->getQuery()->getResult();
178
-		if($entityCount === 0) {
178
+		if ($entityCount === 0) {
179 179
 			$output->writeln('<comment>No entities found for indexing</comment>');
180 180
 			return;
181 181
 		}
@@ -185,25 +185,25 @@  discard block
 block discarded – undo
185 185
 		$entitiesIndexed = 0;
186 186
 
187 187
 		// Index each entity separate
188
-		foreach($iterableResult as $row) {
188
+		foreach ($iterableResult as $row) {
189 189
 			$entity = $useBatch ? $row[0] : $row;
190 190
 			$progressBar->advance();
191
-			if($this->entityToDocumentMapper->isIndexable($entity)) {
191
+			if ($this->entityToDocumentMapper->isIndexable($entity)) {
192 192
 				$document = $this->entityToDocumentMapper->createDocument($entityManager, $entity);
193
-				if($document === null) {
193
+				if ($document === null) {
194 194
 					continue;
195 195
 				}
196 196
 				try {
197
-					if($this->getEventDispatcher()) {
197
+					if ($this->getEventDispatcher()) {
198 198
 						$event = new DocumentPreSaveEvent($document);
199 199
 						$this->getEventDispatcher()->dispatch($event, DocumentPreSaveEvent::NAME);
200 200
 					}
201 201
 					$this->searchService->saveDocument($document);
202 202
 					$entitiesIndexed++;
203
-				} catch(Exception $e) {
204
-					$output->writeln('<error>Failed to index entity with ID ' . $document->getEntityId() . '</error>');
203
+				} catch (Exception $e) {
204
+					$output->writeln('<error>Failed to index entity with ID '.$document->getEntityId().'</error>');
205 205
 				}
206
-				if($entitiesIndexed % 50 === 0) {
206
+				if ($entitiesIndexed % 50 === 0) {
207 207
 					$entityManager->flush();
208 208
 				}
209 209
 			}
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 		$entityManager->clear();
214 214
 		$progressBar->finish();
215 215
 		$output->writeln('');
216
-		$output->writeln('<comment>Indexed ' . $entitiesIndexed . ' entities</comment>');
216
+		$output->writeln('<comment>Indexed '.$entitiesIndexed.' entities</comment>');
217 217
 	}
218 218
 
219 219
 	/**
Please login to merge, or discard this patch.
Controller/SearchControllerTrait.php 1 patch
Spacing   +18 added lines, -18 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
 			$this->removeFilterOptions($request->getSession());
38 38
 			return $this->redirectToRoute('stinger_soft_entity_search_search');
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
 		));
50 50
 
51 51
 		$facetForm->handleRequest($request);
52
-		if($facetForm->isSubmitted()) {
53
-			if($facetForm->get('clear')->isClicked()) {
52
+		if ($facetForm->isSubmitted()) {
53
+			if ($facetForm->get('clear')->isClicked()) {
54 54
 				$query->setFacets($this->getDefaultFacets());
55 55
 			}
56 56
 			$this->setSearchTerm($request->getSession(), $query->getSearchTerm());
57 57
 			$this->setSearchFacets($request->getSession(), $query->getFacets());
58
-		} elseif($this->getUnsetFilterOptions($request->getSession())) {
58
+		} elseif ($this->getUnsetFilterOptions($request->getSession())) {
59 59
 			$query->setFacets($this->getDefaultFacets());
60 60
 		}
61 61
 
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
 
71 71
 			$page = (int)$request->query->get('page', 1);
72 72
 			$results = null;
73
-			if($result instanceof PaginatableResultSet) {
73
+			if ($result instanceof PaginatableResultSet) {
74 74
 				$results = $result->paginate($page, $this->getResultsPerPage());
75
-			} elseif($result !== null) {
75
+			} elseif ($result !== null) {
76 76
 				$results = $result->getResults(($page - 1) * $this->getResultsPerPage(), $this->getResultsPerPage());
77 77
 			}
78 78
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 				'mapper'    => $mapper,
84 84
 				'facetForm' => $facetForm->createView()
85 85
 			));
86
-		} catch(\Exception $exception) {
86
+		} catch (\Exception $exception) {
87 87
 			$response = $this->render($this->getErrorTemplate(), array(
88 88
 				'error' => $exception->getMessage(),
89 89
 				'term'  => $query->getSearchTerm()
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	protected function getConfiguredUsedFacets(array $queryUsedFacets) {
128 128
 		$availableFacets = $this->getAvailableFacets();
129 129
 		$usedFacets = array();
130
-		foreach($queryUsedFacets as $queryUsedFacet) {
130
+		foreach ($queryUsedFacets as $queryUsedFacet) {
131 131
 			$usedFacets[$queryUsedFacet] = $availableFacets[$queryUsedFacet];
132 132
 		}
133 133
 		return $usedFacets;
@@ -194,15 +194,15 @@  discard block
 block discarded – undo
194 194
 	}
195 195
 
196 196
 	protected function initFacets() {
197
-		if(!$this->availableFacets) {
197
+		if (!$this->availableFacets) {
198 198
 			$this->availableFacets = array();
199 199
 			$this->facetFormatter = array();
200 200
 
201 201
 			$facetServices = $this->getParameter('stinger_soft.entity_search.available_facets');
202
-			foreach($facetServices as $facetServiceId) {
202
+			foreach ($facetServices as $facetServiceId) {
203 203
 				$facetService = $this->searchService->getFacet($facetServiceId);
204 204
 				$this->availableFacets[$facetService->getField()] = $facetService->getFormOptions();
205
-				if($facetService->getFacetFormatter()) {
205
+				if ($facetService->getFacetFormatter()) {
206 206
 					$this->facetFormatter[$facetService->getField()] = $facetService->getFacetFormatter();
207 207
 				}
208 208
 			}
@@ -216,16 +216,16 @@  discard block
 block discarded – undo
216 216
 	 * @return string[string][]
217 217
 	 */
218 218
 	protected function getSearchFacets(SessionInterface $session) {
219
-		$facets = $session->get($this->getSessionPrefix() . '_facets', false);
219
+		$facets = $session->get($this->getSessionPrefix().'_facets', false);
220 220
 		return $facets ? \json_decode($facets, true) : $this->getDefaultFacets();
221 221
 	}
222 222
 
223 223
 	protected function removeFilterOptions(SessionInterface $session) {
224
-		$session->remove($this->getSessionPrefix() . '_filter_options');
224
+		$session->remove($this->getSessionPrefix().'_filter_options');
225 225
 	}
226 226
 
227 227
 	protected function getUnsetFilterOptions(SessionInterface $session) {
228
-		return $session->get($this->getSessionPrefix() . '_filter_options', true);
228
+		return $session->get($this->getSessionPrefix().'_filter_options', true);
229 229
 	}
230 230
 
231 231
 	/**
@@ -235,8 +235,8 @@  discard block
 block discarded – undo
235 235
 	 * @param string[string][] $facets
236 236
 	 */
237 237
 	protected function setSearchFacets(SessionInterface $session, $facets) {
238
-		$session->set($this->getSessionPrefix() . '_facets', \json_encode($facets));
239
-		$session->set($this->getSessionPrefix() . '_filter_options', false);
238
+		$session->set($this->getSessionPrefix().'_facets', \json_encode($facets));
239
+		$session->set($this->getSessionPrefix().'_filter_options', false);
240 240
 	}
241 241
 
242 242
 	/**
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 	 * @return mixed
247 247
 	 */
248 248
 	protected function getSearchTerm(SessionInterface $session) {
249
-		return $session->get($this->getSessionPrefix() . '_term', false);
249
+		return $session->get($this->getSessionPrefix().'_term', false);
250 250
 	}
251 251
 
252 252
 	/**
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 	 * @param string $term
257 257
 	 */
258 258
 	protected function setSearchTerm(SessionInterface $session, $term) {
259
-		$session->set($this->getSessionPrefix() . '_term', $term);
259
+		$session->set($this->getSessionPrefix().'_term', $term);
260 260
 	}
261 261
 
262 262
 }
263 263
\ No newline at end of file
Please login to merge, or discard this patch.