Completed
Push — master ( b35119...1e4e2d )
by Florian
56s queued 29s
created
Tests/Form/QueryTypeTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@
 block discarded – undo
116 116
 		$view = $form->createView();
117 117
 		$children = $view->children;
118 118
 		
119
-		foreach(array_keys($formData) as $key) {
119
+		foreach (array_keys($formData) as $key) {
120 120
 			$this->assertArrayHasKey($key, $children);
121 121
 		}
122 122
 		
Please login to merge, or discard this patch.
Tests/AbstractORMTestCase.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 		);
45 45
 		$config = null === $config ? $this->getMockAnnotatedConfig() : $config;
46 46
 		$em = EntityManager::create($conn, $config, $evm ?: $this->getEventManager());
47
-		$schema = array_map(function ($class) use ($em) {
47
+		$schema = array_map(function($class) use ($em) {
48 48
 			return $em->getClassMetadata($class);
49 49
 		}, (array)$this->getUsedEntityFixtures());
50 50
 		$schemaTool = new SchemaTool($em);
@@ -69,13 +69,13 @@  discard block
 block discarded – undo
69 69
 		$refl = new \ReflectionClass($configurationClass);
70 70
 		$methods = $refl->getMethods();
71 71
 		$mockMethods = array();
72
-		foreach($methods as $method) {
73
-			if($method->name !== 'addFilter' && $method->name !== 'getFilterClassName') {
72
+		foreach ($methods as $method) {
73
+			if ($method->name !== 'addFilter' && $method->name !== 'getFilterClassName') {
74 74
 				$mockMethods[] = $method->name;
75 75
 			}
76 76
 		}
77 77
 		$config = $this->getMockBuilder($configurationClass)->setMethods($mockMethods)->getMock();
78
-		$config->expects($this->once())->method('getProxyDir')->will($this->returnValue(__DIR__ . '/../../temp'));
78
+		$config->expects($this->once())->method('getProxyDir')->will($this->returnValue(__DIR__.'/../../temp'));
79 79
 		$config->expects($this->once())->method('getProxyNamespace')->will($this->returnValue('Proxy'));
80 80
 		$config->expects($this->any())->method('getDefaultQueryHints')->will($this->returnValue(array()));
81 81
 		$config->expects($this->once())->method('getAutoGenerateProxyClasses')->will($this->returnValue(true));
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/Controller/SearchControllerTest.php 1 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.
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.
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 1 patch
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.
Services/Mapping/EntityToDocumentMapper.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -48,18 +48,18 @@  discard block
 block discarded – undo
48 48
 	 */
49 49
 	public function __construct(SearchService $searchService, array $mapping = array()) {
50 50
 		$this->searchService = $searchService;
51
-		foreach($mapping as $key => $config) {
52
-			if(!isset($config['mappings'])) {
53
-				throw new \InvalidArgumentException($key . ' has no mapping defined!');
51
+		foreach ($mapping as $key => $config) {
52
+			if (!isset($config['mappings'])) {
53
+				throw new \InvalidArgumentException($key.' has no mapping defined!');
54 54
 			}
55
-			if(!isset($config['persistence'])) {
56
-				throw new \InvalidArgumentException($key . ' has no persistence defined!');
55
+			if (!isset($config['persistence'])) {
56
+				throw new \InvalidArgumentException($key.' has no persistence defined!');
57 57
 			}
58
-			if(!isset($config['persistence']['model'])) {
59
-				throw new \InvalidArgumentException($key . ' has no model defined!');
58
+			if (!isset($config['persistence']['model'])) {
59
+				throw new \InvalidArgumentException($key.' has no model defined!');
60 60
 			}
61 61
 			$map = array();
62
-			foreach($config['mappings'] as $fieldKey => $fieldConfig) {
62
+			foreach ($config['mappings'] as $fieldKey => $fieldConfig) {
63 63
 				$map[$fieldKey] = isset($fieldConfig['propertyPath']) && $fieldConfig['propertyPath'] ? $fieldConfig['propertyPath'] : $fieldKey;
64 64
 			}
65 65
 			
@@ -74,10 +74,10 @@  discard block
 block discarded – undo
74 74
 	 * @see \StingerSoft\EntitySearchBundle\Services\Mapping\EntityToDocumentMapperInterface::isIndexable()
75 75
 	 */
76 76
 	public function isIndexable(object $object) : bool {
77
-		if($object instanceof SearchableEntity) {
77
+		if ($object instanceof SearchableEntity) {
78 78
 			return true;
79 79
 		}
80
-		if(count($this->getMapping(get_class($object))) > 0) {
80
+		if (count($this->getMapping(get_class($object))) > 0) {
81 81
 			return true;
82 82
 		}
83 83
 		return false;
@@ -92,10 +92,10 @@  discard block
 block discarded – undo
92 92
 	 */
93 93
 	public function isClassIndexable(string $clazz) : bool {
94 94
 		$reflectionClass = new \ReflectionClass($clazz);
95
-		if(array_key_exists(SearchableEntity::class, $reflectionClass->getInterfaces())) {
95
+		if (array_key_exists(SearchableEntity::class, $reflectionClass->getInterfaces())) {
96 96
 			return true;
97 97
 		}
98
-		if(count($this->getMapping($clazz)) > 0) {
98
+		if (count($this->getMapping($clazz)) > 0) {
99 99
 			return true;
100 100
 		}
101 101
 		return false;
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
 	 * @see \StingerSoft\EntitySearchBundle\Services\Mapping\EntityToDocumentMapperInterface::createDocument()
108 108
 	 */
109 109
 	public function createDocument(ObjectManager $manager, object $object) : ?Document {
110
-		if(!$this->isIndexable($object))
110
+		if (!$this->isIndexable($object))
111 111
 			return null;
112 112
 		$document = $this->searchService->createEmptyDocumentFromEntity($object);
113 113
 		$index = $this->fillDocument($document, $object);
114
-		if($index === false)
114
+		if ($index === false)
115 115
 			return null;
116 116
 		
117 117
 		return $document;
@@ -125,12 +125,12 @@  discard block
 block discarded – undo
125 125
 	 * @return boolean
126 126
 	 */
127 127
 	protected function fillDocument(Document $document, object $object) : bool {
128
-		if($object instanceof SearchableEntity) {
128
+		if ($object instanceof SearchableEntity) {
129 129
 			return $object->indexEntity($document);
130 130
 		}
131 131
 		$mapping = $this->getMapping(\get_class($object));
132 132
 		$accessor = PropertyAccess::createPropertyAccessor();
133
-		foreach($mapping as $fieldName => $propertyPath) {
133
+		foreach ($mapping as $fieldName => $propertyPath) {
134 134
 			$document->addField($fieldName, $accessor->getValue($object, $propertyPath));
135 135
 		}
136 136
 		return true;
@@ -143,15 +143,15 @@  discard block
 block discarded – undo
143 143
 	 * @throws \ReflectionException
144 144
 	 */
145 145
 	protected function getMapping(string $clazz) : array {
146
-		if(isset($this->cachedMapping[$clazz])) {
146
+		if (isset($this->cachedMapping[$clazz])) {
147 147
 			return $this->cachedMapping[$clazz];
148 148
 		}
149 149
 		$ref = new \ReflectionClass($clazz);
150 150
 		
151 151
 		$mapping = array();
152 152
 		
153
-		foreach($this->mapping as $className => $config) {
154
-			if($clazz === $className || $ref->isSubclassOf($className)) {
153
+		foreach ($this->mapping as $className => $config) {
154
+			if ($clazz === $className || $ref->isSubclassOf($className)) {
155 155
 				$mapping = \array_merge($mapping, $config);
156 156
 			}
157 157
 		}
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -107,12 +107,14 @@
 block discarded – undo
107 107
 	 * @see \StingerSoft\EntitySearchBundle\Services\Mapping\EntityToDocumentMapperInterface::createDocument()
108 108
 	 */
109 109
 	public function createDocument(ObjectManager $manager, object $object) : ?Document {
110
-		if(!$this->isIndexable($object))
111
-			return null;
110
+		if(!$this->isIndexable($object)) {
111
+					return null;
112
+		}
112 113
 		$document = $this->searchService->createEmptyDocumentFromEntity($object);
113 114
 		$index = $this->fillDocument($document, $object);
114
-		if($index === false)
115
-			return null;
115
+		if($index === false) {
116
+					return null;
117
+		}
116 118
 		
117 119
 		return $document;
118 120
 	}
Please login to merge, or discard this patch.