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 ( c3bbaf...3bd11d )
by Florian
12:33
created
Form/QueryType.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -53,25 +53,25 @@  discard block
 block discarded – undo
53 53
 		$maxChoiceGroupCount = $options['max_choice_group_count'];
54 54
 		$data = array();
55 55
 		
56
-		if($usedFacets && !$result) {
56
+		if ($usedFacets && !$result) {
57 57
 			$data = array();
58
-			foreach($usedFacets as $facetType) {
58
+			foreach ($usedFacets as $facetType) {
59 59
 				$preferredChoices = isset($preferredFilterChoices[$facetType]) ? $preferredFilterChoices[$facetType] : array();
60 60
 				$i = 0;
61
-				$builder->add('facet_' . $facetType, FacetType::class, array(
62
-					'label' => 'stinger_soft_entity_search.forms.query.' . $facetType . '.label',
61
+				$builder->add('facet_'.$facetType, FacetType::class, array(
62
+					'label' => 'stinger_soft_entity_search.forms.query.'.$facetType.'.label',
63 63
 					'multiple' => true,
64 64
 					'expanded' => true,
65 65
 					'allow_extra_fields' => true,
66
-					'preferred_choices' => function ($val) use ($preferredChoices, $data, $facetType, $maxChoiceGroupCount, &$i) {
67
-						return $i++ < $maxChoiceGroupCount || $maxChoiceGroupCount == 0 || in_array($val, $preferredChoices) || (isset($data['facet_' . $facetType]) && in_array($val, $data['facet_' . $facetType]));
66
+					'preferred_choices' => function($val) use ($preferredChoices, $data, $facetType, $maxChoiceGroupCount, &$i) {
67
+						return $i++ < $maxChoiceGroupCount || $maxChoiceGroupCount == 0 || in_array($val, $preferredChoices) || (isset($data['facet_'.$facetType]) && in_array($val, $data['facet_'.$facetType]));
68 68
 					} 
69 69
 				));
70 70
 				unset($i);
71 71
 			}
72 72
 		}
73
-		if($result) {
74
-			$builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use ($options, $result) {
73
+		if ($result) {
74
+			$builder->addEventListener(FormEvents::PRE_SET_DATA, function(FormEvent $event) use ($options, $result) {
75 75
 				$this->createFacets($event->getForm(), $result->getFacets(), $options, $event->getData());
76 76
 			});
77 77
 		}
@@ -109,17 +109,17 @@  discard block
 block discarded – undo
109 109
 		$maxChoiceGroupCount = $options['max_choice_group_count'];
110 110
 		$selectedFacets = $data->getFacets();
111 111
 		
112
-		foreach($facets->getFacets() as $facetType => $facetValues) {
112
+		foreach ($facets->getFacets() as $facetType => $facetValues) {
113 113
 			$preferredChoices = isset($preferredFilterChoices[$facetType]) ? $preferredFilterChoices[$facetType] : array();
114 114
 			
115 115
 			$i = 0;
116
-			$builder->add('facet_' . $facetType, FacetType::class, array(
117
-				'label' => 'stinger_soft_entity_search.forms.query.' . $facetType . '.label',
116
+			$builder->add('facet_'.$facetType, FacetType::class, array(
117
+				'label' => 'stinger_soft_entity_search.forms.query.'.$facetType.'.label',
118 118
 				'multiple' => true,
119 119
 				'expanded' => true,
120 120
 				'allow_extra_fields' => true,
121 121
 				'choices' => $this->generateFacetChoices($facetType, $facetValues, isset($selectedFacets[$facetType]) ? $selectedFacets[$facetType] : array(), $options['facet_formatter']),
122
-				'preferred_choices' => function ($val) use ($preferredChoices, $selectedFacets, $facetType, $maxChoiceGroupCount, &$i) {
122
+				'preferred_choices' => function($val) use ($preferredChoices, $selectedFacets, $facetType, $maxChoiceGroupCount, &$i) {
123 123
 					return $i++ < $maxChoiceGroupCount || $maxChoiceGroupCount == 0 || in_array($val, $preferredChoices) || (isset($selectedFacets[$facetType]) && in_array($val, $selectedFacets[$facetType]));
124 124
 				} 
125 125
 			));
@@ -134,13 +134,13 @@  discard block
 block discarded – undo
134 134
 	 */
135 135
 	protected function generateFacetChoices($facetType, array $facets, array $selectedFacets = array(), $formatter) {
136 136
 		$choices = array();
137
-		foreach($facets as $facet => $count) {
138
-			if($count == 0 && !in_array($facet, $selectedFacets))
137
+		foreach ($facets as $facet => $count) {
138
+			if ($count == 0 && !in_array($facet, $selectedFacets))
139 139
 				continue;
140 140
 			$choices[$this->formatFacet($formatter, $facetType, $facet, $count)] = $facet;
141 141
 		}
142
-		foreach($selectedFacets as $facet) {
143
-			if(isset($facets[$facet])) continue;
142
+		foreach ($selectedFacets as $facet) {
143
+			if (isset($facets[$facet])) continue;
144 144
 			$count = 0;
145 145
 			$choices[$this->formatFacet($formatter, $facetType, $facet, $count)] = $facet;
146 146
 		}
@@ -148,8 +148,8 @@  discard block
 block discarded – undo
148 148
 	}
149 149
 	
150 150
 	protected function formatFacet($formatter, $facetType, $facet, $count) {
151
-		$default = $facet . ' (' . $count . ')';
152
-		if(!$formatter) {
151
+		$default = $facet.' ('.$count.')';
152
+		if (!$formatter) {
153 153
 			return $default;
154 154
 		}
155 155
 		return call_user_func($formatter, $facetType, $facet, $count, $default);
Please login to merge, or discard this patch.
Form/FacetType.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
31 31
 		$builder->resetModelTransformers();
32 32
 		$builder->resetViewTransformers();
33 33
 		
34
-		if($options['multiple']) {
35
-			$builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) {
34
+		if ($options['multiple']) {
35
+			$builder->addEventListener(FormEvents::PRE_SUBMIT, function(FormEvent $event) {
36 36
 				$event->stopPropagation();
37 37
 			}, 1);
38 38
 		}
39
-		$builder->addEventListener(FormEvents::SUBMIT, function (FormEvent $event) {
39
+		$builder->addEventListener(FormEvents::SUBMIT, function(FormEvent $event) {
40 40
 			$data = $event->getForm()->getExtraData();
41 41
 			//$event->setData(array_unique(array_merge($data, $event->getData())));
42 42
 			$event->setData($data);
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	public function configureOptions(OptionsResolver $resolver) {
63 63
 		$resolver->setDefault('translation_domain', 'StingerSoftEntitySearchBundle');
64 64
 		$resolver->setDefault('by_reference', true);
65
-		if(Kernel::VERSION_ID < 30000) {
65
+		if (Kernel::VERSION_ID < 30000) {
66 66
 			$resolver->setDefault('choices_as_values', true);
67 67
 		}
68 68
 	}
Please login to merge, or discard this patch.
Model/DocumentAdapter.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
 	 * @see \StingerSoft\EntitySearchBundle\Model\Document::addMultiValueField()
82 82
 	 */
83 83
 	public function addMultiValueField($field, $value) {
84
-		if(!array_key_exists($field, $this->fields)) {
84
+		if (!array_key_exists($field, $this->fields)) {
85 85
 			$this->fields[$field] = array(
86 86
 				$value 
87 87
 			);
88
-		} else if(!in_array($value, $this->fields[$field])) {
88
+		} else if (!in_array($value, $this->fields[$field])) {
89 89
 			$this->fields[$field][] = $value;
90 90
 		}
91 91
 	}
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	 */
99 99
 	public function setEntityClass($clazz) {
100 100
 		$this->entityClass = $clazz;
101
-		if(!$this->entityType) {
101
+		if (!$this->entityType) {
102 102
 			$this->entityType = $clazz;
103 103
 		}
104 104
 	}
Please login to merge, or discard this patch.
Services/Mapping/DocumentToEntityMapper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,10 +34,10 @@
 block discarded – undo
34 34
 	public function getEntity(Document $document) {
35 35
 		$clazz = $document->getEntityClass();
36 36
 		
37
-		if($clazz == null) {
37
+		if ($clazz == null) {
38 38
 			return null;
39 39
 		}
40
-		if(!$document->getEntityId()) {
40
+		if (!$document->getEntityId()) {
41 41
 			return null;
42 42
 		}
43 43
 		return $this->managerRegistry->getManagerForClass($clazz)->getRepository($clazz)->find($document->getEntityId());
Please login to merge, or discard this patch.
Tests/application.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 // application.php
3
-require __DIR__ . '/../vendor/autoload.php';
3
+require __DIR__.'/../vendor/autoload.php';
4 4
 
5 5
 use StingerSoft\EntitySearchBundle\Command\ClearIndexCommand;
6 6
 use StingerSoft\EntitySearchBundle\Command\SyncCommand;
Please login to merge, or discard this patch.
Tests/Command/SyncCommandTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,8 +43,8 @@
 block discarded – undo
43 43
 			'get' 
44 44
 		))->disableOriginalConstructor()->getMock();
45 45
 		
46
-		$container->method('get')->willReturnCallback(function ($serviceId) use ($that) {
47
-			switch($serviceId) {
46
+		$container->method('get')->willReturnCallback(function($serviceId) use ($that) {
47
+			switch ($serviceId) {
48 48
 				case 'kernel':
49 49
 					return $that;
50 50
 				case 'doctrine.orm.entity_manager':
Please login to merge, or discard this patch.
Model/Query.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -90,10 +90,10 @@  discard block
 block discarded – undo
90 90
 	 * @return \Pec\Bundle\MtuDvpBundle\Entity\TestRiskValue
91 91
 	 */
92 92
 	public function __get($name) {
93
-		if(strrpos($name, 'facet_', -strlen($name)) !== false) {
93
+		if (strrpos($name, 'facet_', -strlen($name)) !== false) {
94 94
 			$facetname = substr($name, 6);
95 95
 			
96
-			if(isset($this->facets[$facetname])) {
96
+			if (isset($this->facets[$facetname])) {
97 97
 				return $this->facets[$facetname];
98 98
 			}
99 99
 			return array();
@@ -108,10 +108,10 @@  discard block
 block discarded – undo
108 108
 	 *        	The value of the property
109 109
 	 */
110 110
 	public function __set($name, $value) {
111
-		if(strrpos($name, 'facet_', -strlen($name)) !== false) {
111
+		if (strrpos($name, 'facet_', -strlen($name)) !== false) {
112 112
 			$facetname = substr($name, 6);
113 113
 			
114
-			if(!isset($this->facets[$facetname])) {
114
+			if (!isset($this->facets[$facetname])) {
115 115
 				$this->facets[$facetname] = array();
116 116
 			}
117 117
 			$this->facets[$facetname] = $value;
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	 * @return boolean
126 126
 	 */
127 127
 	public function __isset($name) {
128
-		if(strrpos($name, 'facet_', -strlen($name)) !== false) {
128
+		if (strrpos($name, 'facet_', -strlen($name)) !== false) {
129 129
 			return true;
130 130
 		}
131 131
 		
Please login to merge, or discard this patch.
Services/Mapping/EntityToDocumentMapper.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -47,18 +47,18 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 	public function __construct(SearchService $searchService, array $mapping = array()) {
49 49
 		$this->searchService = $searchService;
50
-		foreach($mapping as $key => $config) {
51
-			if(!isset($config['mappings'])) {
52
-				throw new \InvalidArgumentException($key . ' has no mapping defined!');
50
+		foreach ($mapping as $key => $config) {
51
+			if (!isset($config['mappings'])) {
52
+				throw new \InvalidArgumentException($key.' has no mapping defined!');
53 53
 			}
54
-			if(!isset($config['persistence'])) {
55
-				throw new \InvalidArgumentException($key . ' has no persistence defined!');
54
+			if (!isset($config['persistence'])) {
55
+				throw new \InvalidArgumentException($key.' has no persistence defined!');
56 56
 			}
57
-			if(!isset($config['persistence']['model'])) {
58
-				throw new \InvalidArgumentException($key . ' has no model defined!');
57
+			if (!isset($config['persistence']['model'])) {
58
+				throw new \InvalidArgumentException($key.' has no model defined!');
59 59
 			}
60 60
 			$map = array();
61
-			foreach($config['mappings'] as $fieldKey => $fieldConfig) {
61
+			foreach ($config['mappings'] as $fieldKey => $fieldConfig) {
62 62
 				$map[$fieldKey] = isset($fieldConfig['propertyPath']) && $fieldConfig['propertyPath'] ? $fieldConfig['propertyPath'] : $fieldKey;
63 63
 			}
64 64
 			
@@ -73,10 +73,10 @@  discard block
 block discarded – undo
73 73
 	 * @see \StingerSoft\EntitySearchBundle\Services\Mapping\EntityToDocumentMapperInterface::isIndexable()
74 74
 	 */
75 75
 	public function isIndexable($object) {
76
-		if($object instanceof SearchableEntity) {
76
+		if ($object instanceof SearchableEntity) {
77 77
 			return true;
78 78
 		}
79
-		if(count($this->getMapping(get_class($object))) > 0) {
79
+		if (count($this->getMapping(get_class($object))) > 0) {
80 80
 			return true;
81 81
 		}
82 82
 		return false;
@@ -90,10 +90,10 @@  discard block
 block discarded – undo
90 90
 	 */
91 91
 	public function isClassIndexable($clazz) {
92 92
 		$reflectionClass = new \ReflectionClass($clazz);
93
-		if(array_key_exists(SearchableEntity::class, $reflectionClass->getInterfaces())) {
93
+		if (array_key_exists(SearchableEntity::class, $reflectionClass->getInterfaces())) {
94 94
 			return true;
95 95
 		}
96
-		if(count($this->getMapping($clazz)) > 0) {
96
+		if (count($this->getMapping($clazz)) > 0) {
97 97
 			return true;
98 98
 		}
99 99
 		return false;
@@ -105,11 +105,11 @@  discard block
 block discarded – undo
105 105
 	 * @see \StingerSoft\EntitySearchBundle\Services\Mapping\EntityToDocumentMapperInterface::createDocument()
106 106
 	 */
107 107
 	public function createDocument(ObjectManager $manager, $object) {
108
-		if(!$this->isIndexable($object))
108
+		if (!$this->isIndexable($object))
109 109
 			return false;
110 110
 		$document = $this->getSearchService($manager)->createEmptyDocumentFromEntity($object);
111 111
 		$index = $this->fillDocument($document, $object);
112
-		if($index == false)
112
+		if ($index == false)
113 113
 			return false;
114 114
 		
115 115
 		return $document;
@@ -123,12 +123,12 @@  discard block
 block discarded – undo
123 123
 	 * @return boolean
124 124
 	 */
125 125
 	protected function fillDocument(Document &$document, $object) {
126
-		if($object instanceof SearchableEntity) {
126
+		if ($object instanceof SearchableEntity) {
127 127
 			return $object->indexEntity($document);
128 128
 		}
129 129
 		$mapping = $this->getMapping(get_class($object));
130 130
 		$accessor = PropertyAccess::createPropertyAccessor();
131
-		foreach($mapping as $fieldName => $propertyPath) {
131
+		foreach ($mapping as $fieldName => $propertyPath) {
132 132
 			$document->addField($fieldName, $accessor->getValue($object, $propertyPath));
133 133
 		}
134 134
 		return true;
@@ -141,15 +141,15 @@  discard block
 block discarded – undo
141 141
 	 * @return \StingerSoft\EntitySearchBundle\Services\string[string]
142 142
 	 */
143 143
 	protected function getMapping($clazz) {
144
-		if(isset($this->cachedMapping[$clazz])) {
144
+		if (isset($this->cachedMapping[$clazz])) {
145 145
 			return $this->cachedMapping[$clazz];
146 146
 		}
147 147
 		$ref = new \ReflectionClass($clazz);
148 148
 		
149 149
 		$mapping = array();
150 150
 		
151
-		foreach($this->mapping as $className => $config) {
152
-			if($clazz == $className || $ref->isSubclassOf($className)) {
151
+		foreach ($this->mapping as $className => $config) {
152
+			if ($clazz == $className || $ref->isSubclassOf($className)) {
153 153
 				$mapping = array_merge($mapping, $config);
154 154
 			}
155 155
 		}
Please login to merge, or discard this patch.
Command/SyncCommand.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -67,15 +67,15 @@  discard block
 block discarded – undo
67 67
 	 */
68 68
 	protected function execute(InputInterface $input, OutputInterface $output) {
69 69
 		// Detect upload path
70
-		if(!self::$defaultUploadPath) {
70
+		if (!self::$defaultUploadPath) {
71 71
 			$root = $this->getContainer()->get('kernel')->getRootDir();
72
-			self::$defaultUploadPath = $root . '/../web/uploads';
72
+			self::$defaultUploadPath = $root.'/../web/uploads';
73 73
 		}
74 74
 		
75 75
 		// Get the entity argument
76 76
 		$entity = $input->getArgument('entity');
77 77
 		
78
-		if($entity == 'all') {
78
+		if ($entity == 'all') {
79 79
 			/**
80 80
 			 * @var EntityManager $entityManager
81 81
 			 */
@@ -91,12 +91,12 @@  discard block
 block discarded – undo
91 91
 			/**
92 92
 			 * @var ClassMetadata $m
93 93
 			 */
94
-			foreach($meta as $m) {
94
+			foreach ($meta as $m) {
95 95
 				
96
-				if($m->getReflectionClass()->isAbstract() || $m->getReflectionClass()->isInterface()) {
96
+				if ($m->getReflectionClass()->isAbstract() || $m->getReflectionClass()->isInterface()) {
97 97
 					continue;
98 98
 				}
99
-				if(!$mapper->isClassIndexable($m->getReflectionClass()->getName())) {
99
+				if (!$mapper->isClassIndexable($m->getReflectionClass()->getName())) {
100 100
 					continue;
101 101
 				}
102 102
 				$this->indexEntity($input, $output, $m->getReflectionClass()->getName());
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 		try {
118 118
 			// Get repository for the given entity type
119 119
 			$repository = $entityManager->getRepository($entity);
120
-		} catch(\Exception $e) {
120
+		} catch (\Exception $e) {
121 121
 			$output->writeln(sprintf('<error>No repository found for "%s", check your input</error>', $entity));
122 122
 			return;
123 123
 		}
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 		$useBatch = !($entityManager->getConnection()->getDatabasePlatform() instanceof SQLServerPlatform);
131 131
 		
132 132
 		$iterableResult = $useBatch ? $queryBuilder->getQuery()->iterate() : $queryBuilder->getQuery()->getResult();
133
-		if($entityCount == 0) {
133
+		if ($entityCount == 0) {
134 134
 			$output->writeln('<comment>No entities found for indexing</comment>');
135 135
 			return;
136 136
 		}
@@ -140,12 +140,12 @@  discard block
 block discarded – undo
140 140
 		// Index each entity separate
141 141
 		foreach ($iterableResult as $row) {
142 142
 			$entity = $useBatch ? $row[0] : $row;
143
-			if($this->getEntityToDocumentMapper()->isIndexable($entity)) {
143
+			if ($this->getEntityToDocumentMapper()->isIndexable($entity)) {
144 144
 				$document = $this->getEntityToDocumentMapper()->createDocument($entityManager, $entity);
145
-				if($document === false) continue;
145
+				if ($document === false) continue;
146 146
 				$this->getSearchService($entityManager)->saveDocument($document);
147 147
 				$entitiesIndexed++;
148
-				if($entitiesIndexed % 50 == 0) {
148
+				if ($entitiesIndexed % 50 == 0) {
149 149
 					$entityManager->flush();
150 150
 				}
151 151
 			}
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 		}
154 154
 		$entityManager->flush();
155 155
 		$entityManager->clear();
156
-		$output->writeln('<comment>Indexed ' . $entitiesIndexed . ' entities</comment>');
156
+		$output->writeln('<comment>Indexed '.$entitiesIndexed.' entities</comment>');
157 157
 	}
158 158
 
159 159
 	/**
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	 * @return EntityToDocumentMapperInterface
162 162
 	 */
163 163
 	protected function getEntityToDocumentMapper() {
164
-		if(!$this->entityToDocumentMapper) {
164
+		if (!$this->entityToDocumentMapper) {
165 165
 			$this->entityToDocumentMapper = $this->getContainer()->get(EntityToDocumentMapperInterface::SERVICE_ID);
166 166
 		}
167 167
 		return $this->entityToDocumentMapper;
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 	 * @return SearchService
173 173
 	 */
174 174
 	protected function getSearchService(ObjectManager $manager) {
175
-		if(!$this->searchService) {
175
+		if (!$this->searchService) {
176 176
 			$this->searchService = $this->getContainer()->get(SearchService::SERVICE_ID);
177 177
 		}
178 178
 		$this->searchService->setObjectManager($manager);
Please login to merge, or discard this patch.