Completed
Push — master ( 3e8b02...37f80c )
by Florian
16:58
created
Services/AbstractSearchService.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
 	 * @see \StingerSoft\EntitySearchBundle\Services\SearchService::setObjectManager()
32 32
 	 */
33 33
 	public function setObjectManager(ObjectManager $om) {
34
-		if($this->objectManager)
34
+		if ($this->objectManager)
35 35
 			return;
36 36
 		$this->objectManager = $om;
37 37
 	}
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,8 +31,9 @@
 block discarded – undo
31 31
 	 * @see \StingerSoft\EntitySearchBundle\Services\SearchService::setObjectManager()
32 32
 	 */
33 33
 	public function setObjectManager(ObjectManager $om) {
34
-		if($this->objectManager)
35
-			return;
34
+		if($this->objectManager) {
35
+					return;
36
+		}
36 37
 		$this->objectManager = $om;
37 38
 	}
38 39
 
Please login to merge, or discard this patch.
Tests/Services/DoctrineListenerTest.php 1 patch
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
 
26 26
 	/**
27 27
 	 *
28
-	 * @param number $save
28
+	 * @param integer $save
29 29
 	 *        	Number of expected saves
30
-	 * @param number $delete
30
+	 * @param integer $delete
31 31
 	 *        	Number of expected deletions
32 32
 	 */
33 33
 	protected function registerDoctrineListener($save = 0, $delete = 0) {
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
 
51 51
 	/**
52 52
 	 *
53
-	 * @param number $save
53
+	 * @param integer $save
54 54
 	 *        	Number of expected saves
55
-	 * @param number $delete
55
+	 * @param integer $delete
56 56
 	 *        	Number of expected deletions
57 57
 	 */
58 58
 	protected function registerSearchService($save = 0, $delete = 0) {
Please login to merge, or discard this patch.
Services/Mapping/DocumentToEntityMapperInterface.php 1 patch
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,6 @@
 block discarded – undo
23 23
 	/**
24 24
 	 * Tries to create a document from the given object
25 25
 	 *
26
-	 * @param object $object        	
27 26
 	 * @return boolean|Document Returns false if no document could be created
28 27
 	 */
29 28
 	public function getEntity(Document $document);
Please login to merge, or discard this patch.
Services/Mapping/EntityToDocumentMapper.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -137,7 +137,7 @@
 block discarded – undo
137 137
 	/**
138 138
 	 * Fetches the mapping for the given object including the mapping of superclasses
139 139
 	 *
140
-	 * @param object $object        	
140
+	 * @param string $clazz
141 141
 	 * @return \StingerSoft\EntitySearchBundle\Services\string[string]
142 142
 	 */
143 143
 	protected function getMapping($clazz) {
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -105,12 +105,14 @@
 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))
109
-			return false;
108
+		if(!$this->isIndexable($object)) {
109
+					return false;
110
+		}
110 111
 		$document = $this->getSearchService($manager)->createEmptyDocumentFromEntity($object);
111 112
 		$index = $this->fillDocument($document, $object);
112
-		if($index == false)
113
-			return false;
113
+		if($index == false) {
114
+					return false;
115
+		}
114 116
 		
115 117
 		return $document;
116 118
 	}
Please login to merge, or discard this 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.
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.
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.
Model/Document.php 1 patch
Doc Comments   +7 added lines, -1 removed lines patch added patch discarded remove patch
@@ -92,6 +92,7 @@  discard block
 block discarded – undo
92 92
 	 *        	The name of the field
93 93
 	 * @param mixed $value
94 94
 	 *        	The value of this field
95
+	 * @return void
95 96
 	 */
96 97
 	public function addField($fieldname, $value);
97 98
 
@@ -120,6 +121,7 @@  discard block
 block discarded – undo
120 121
 	 *        	The name of the field
121 122
 	 * @param mixed $value
122 123
 	 *        	The additional value of this field
124
+	 * @return void
123 125
 	 */
124 126
 	public function addMultiValueField($field, $value);
125 127
 
@@ -131,6 +133,7 @@  discard block
 block discarded – undo
131 133
 	 *
132 134
 	 * @param string $clazz
133 135
 	 *        	The classname
136
+	 * @return void
134 137
 	 */
135 138
 	public function setEntityClass($clazz);
136 139
 
@@ -150,6 +153,7 @@  discard block
 block discarded – undo
150 153
 	 *
151 154
 	 * @param mixed $id
152 155
 	 *        	The ID of the corresponding entity
156
+	 * @return void
153 157
 	 */
154 158
 	public function setEntityId($id);
155 159
 
@@ -166,6 +170,7 @@  discard block
 block discarded – undo
166 170
 	 * hiding some programatically needed complexity from the user
167 171
 	 *
168 172
 	 * @param string $type        	
173
+	 * @return void
169 174
 	 */
170 175
 	public function setEntityType($type);
171 176
 
@@ -176,7 +181,7 @@  discard block
 block discarded – undo
176 181
 	 *
177 182
 	 * If no entity type is set, the class will be used instead
178 183
 	 *
179
-	 * @param return $type        	
184
+	 * @return string
180 185
 	 */
181 186
 	public function getEntityType();
182 187
 
@@ -186,6 +191,7 @@  discard block
 block discarded – undo
186 191
 	 * <strong>note:</strong> This may not supported by the underlying implementation
187 192
 	 *
188 193
 	 * @param string $path        	
194
+	 * @return void
189 195
 	 */
190 196
 	public function setFile($path);
191 197
 
Please login to merge, or discard this patch.