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 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -131,7 +131,9 @@
 block discarded – undo
131 131
 	 * @param LifecycleEventArgs $args
132 132
 	 */
133 133
 	public function postUpdate(LifecycleEventArgs $args): void {
134
-		if(!$this->enableIndexing) return;
134
+		if(!$this->enableIndexing) {
135
+			return;
136
+		}
135 137
 		$this->updateEntity($args->getObject(), $args->getObjectManager());
136 138
 	}
137 139
 
Please login to merge, or discard this 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/DummySearchService.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
 	 */
67 67
 	public function autocomplete(string $search, int $maxResults = 10): array {
68 68
 		$words = array();
69
-		foreach($this->index as $doc) {
70
-			foreach($doc->getFields() as $content) {
71
-				if(is_string($content)) {
69
+		foreach ($this->index as $doc) {
70
+			foreach ($doc->getFields() as $content) {
71
+				if (is_string($content)) {
72 72
 					$words = array_merge($words, explode(' ', $content));
73 73
 				}
74 74
 			}
@@ -92,10 +92,10 @@  discard block
 block discarded – undo
92 92
 		$facets = new FacetSetAdapter();
93 93
 
94 94
 		$hits = array();
95
-		foreach($this->index as $key => $doc) {
96
-			foreach($doc->getFields() as $content) {
97
-				if(is_string($content) && stripos($content, $term) !== false) {
98
-					if(!isset($hits[$key])) {
95
+		foreach ($this->index as $key => $doc) {
96
+			foreach ($doc->getFields() as $content) {
97
+				if (is_string($content) && stripos($content, $term) !== false) {
98
+					if (!isset($hits[$key])) {
99 99
 						$hits[$key] = 0;
100 100
 					}
101 101
 					$hits[$key] = $hits[$key] + 1;
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 		}
105 105
 		arsort($hits);
106 106
 		$results = array();
107
-		foreach(array_keys($hits) as $docId) {
107
+		foreach (array_keys($hits) as $docId) {
108 108
 			$doc = $this->index[$docId];
109 109
 			$facets->addFacetValue(FacetSet::FACET_ENTITY_TYPE, $doc->getEntityClass());
110 110
 			$facets->addFacetValue(FacetSet::FACET_AUTHOR, (string)$doc->getFieldValue(Document::FIELD_AUTHOR));
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 		$id = $document->getEntityClass();
132 132
 		$id .= '#';
133 133
 		$entityId = $document->getEntityId();
134
-		if(is_scalar($entityId)) {
134
+		if (is_scalar($entityId)) {
135 135
 			$id .= $entityId;
136 136
 		} else {
137 137
 			$id .= md5(serialize($entityId));
Please login to merge, or discard this patch.
Model/Query.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -92,10 +92,10 @@  discard block
 block discarded – undo
92 92
 	 * @return array
93 93
 	 */
94 94
 	public function __get($name) {
95
-		if(strrpos($name, 'facet_', -strlen($name)) !== false) {
95
+		if (strrpos($name, 'facet_', -strlen($name)) !== false) {
96 96
 			$facetname = substr($name, 6);
97 97
 
98
-			if(isset($this->facets[$facetname])) {
98
+			if (isset($this->facets[$facetname])) {
99 99
 				return $this->facets[$facetname];
100 100
 			}
101 101
 			return array();
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 *            The value of the property
111 111
 	 */
112 112
 	public function __set($name, $value): void {
113
-		if(strrpos($name, 'facet_', -strlen($name)) !== false) {
113
+		if (strrpos($name, 'facet_', -strlen($name)) !== false) {
114 114
 			$facetname = substr($name, 6);
115 115
 			$this->facets[$facetname] = $value;
116 116
 		}
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 	 * @return boolean
124 124
 	 */
125 125
 	public function __isset($name): bool {
126
-		if(strrpos($name, 'facet_', -strlen($name)) !== false) {
126
+		if (strrpos($name, 'facet_', -strlen($name)) !== false) {
127 127
 			return true;
128 128
 		}
129 129
 
Please login to merge, or discard this patch.
Model/DocumentAdapter.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 	public function getFieldValue($fieldName) {
86 86
 		$value = $this->fields[$fieldName] ?? null;
87
-		if(\in_array($fieldName, self::$forceSingleValueFields) && \is_array($value)) {
87
+		if (\in_array($fieldName, self::$forceSingleValueFields) && \is_array($value)) {
88 88
 			return current($value);
89 89
 		}
90 90
 		return $value;
@@ -97,15 +97,15 @@  discard block
 block discarded – undo
97 97
 	 * @see \StingerSoft\EntitySearchBundle\Model\Document::addMultiValueField()
98 98
 	 */
99 99
 	public function addMultiValueField(string $fieldName, $value): void {
100
-		if(!array_key_exists($fieldName, $this->fields)) {
100
+		if (!array_key_exists($fieldName, $this->fields)) {
101 101
 			$this->fields[$fieldName] = array(
102 102
 				$value
103 103
 			);
104
-		} else if(!\is_array($this->fields[$fieldName])) {
104
+		} else if (!\is_array($this->fields[$fieldName])) {
105 105
 			$this->fields[$fieldName] = array(
106 106
 				$value, $this->fields[$fieldName]
107 107
 			);
108
-		} else if(!\in_array($value, $this->fields[$fieldName])) {
108
+		} else if (!\in_array($value, $this->fields[$fieldName])) {
109 109
 			$this->fields[$fieldName][] = $value;
110 110
 		}
111 111
 	}
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 */
129 129
 	public function setEntityClass(string $clazz): void {
130 130
 		$this->entityClass = $clazz;
131
-		if(!$this->entityType) {
131
+		if (!$this->entityType) {
132 132
 			$this->entityType = $clazz;
133 133
 		}
134 134
 	}
Please login to merge, or discard this patch.
Model/Result/FacetSetAdapter.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,10 +33,10 @@  discard block
 block discarded – undo
33 33
 
34 34
 	public function addFacetValue(string $key, string $label, $value = null, int $increaseCounterBy = 1) : void {
35 35
 		$value = $value ?? $label;
36
-		if(!isset($this->facets[$key])) {
36
+		if (!isset($this->facets[$key])) {
37 37
 			$this->facets[$key] = array();
38 38
 		}
39
-		if(!isset($this->facets[$key][$label])) {
39
+		if (!isset($this->facets[$key][$label])) {
40 40
 			$this->facets[$key][$label] = array(
41 41
 				'value' => $value,
42 42
 				'count' => 0,
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 * @see \StingerSoft\EntitySearchBundle\Model\Result\FacetSet::getFacet()
53 53
 	 */
54 54
 	public function getFacet(string $key): ?array {
55
-		if(isset($this->facets[$key])) {
55
+		if (isset($this->facets[$key])) {
56 56
 			return $this->facets[$key];
57 57
 		}
58 58
 		return null;
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.