Completed
Push — master ( 904bc9...a0bca2 )
by Florian
03:02
created
Tests/Fixtures/ORM/Beer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
 	 *
52 52
 	 * @see \StingerSoft\EntitySearchBundle\Model\SearchableEntity::indexEntity()
53 53
 	 */
54
-	public function indexEntity(Document &$document) {
54
+	public function indexEntity(Document&$document) {
55 55
 		$document->addField(Document::FIELD_TITLE, $this->getTitle());
56 56
 		return true;
57 57
 	}
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);
@@ -65,13 +65,13 @@  discard block
 block discarded – undo
65 65
 		$refl = new \ReflectionClass($configurationClass);
66 66
 		$methods = $refl->getMethods();
67 67
 		$mockMethods = array();
68
-		foreach($methods as $method) {
69
-			if($method->name !== 'addFilter' && $method->name !== 'getFilterClassName') {
68
+		foreach ($methods as $method) {
69
+			if ($method->name !== 'addFilter' && $method->name !== 'getFilterClassName') {
70 70
 				$mockMethods[] = $method->name;
71 71
 			}
72 72
 		}
73 73
 		$config = $this->getMock($configurationClass, $mockMethods);
74
-		$config->expects($this->once())->method('getProxyDir')->will($this->returnValue(__DIR__ . '/../../temp'));
74
+		$config->expects($this->once())->method('getProxyDir')->will($this->returnValue(__DIR__.'/../../temp'));
75 75
 		$config->expects($this->once())->method('getProxyNamespace')->will($this->returnValue('Proxy'));
76 76
 		$config->expects($this->any())->method('getDefaultQueryHints')->will($this->returnValue(array()));
77 77
 		$config->expects($this->once())->method('getAutoGenerateProxyClasses')->will($this->returnValue(true));
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
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
 		$configuration = new Configuration();
32 32
 		$this->processConfiguration($configuration, $configs);
33 33
 		
34
-		$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
34
+		$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
35 35
 		$loader->load('services.yml');
36 36
 	}
37 37
 }
Please login to merge, or discard this patch.
Model/SearchableEntity.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,5 +24,5 @@
 block discarded – undo
24 24
 	 *        	The document object to be filled with information
25 25
 	 * @return bool If this entity returns <code>false</code> no information will be indexed
26 26
 	 */
27
-	public function indexEntity(Document &$document);
27
+	public function indexEntity(Document&$document);
28 28
 }
29 29
\ No newline at end of file
Please login to merge, or discard this patch.
Model/DocumentAdapter.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,11 +55,11 @@
 block discarded – undo
55 55
 	 * @see \StingerSoft\EntitySearchBundle\Model\Document::addMultiValueField()
56 56
 	 */
57 57
 	public function addMultiValueField($field, $value) {
58
-		if(!array_key_exists($field, $this->fields)) {
58
+		if (!array_key_exists($field, $this->fields)) {
59 59
 			$this->fields[$field] = array(
60 60
 				$value 
61 61
 			);
62
-		} else if(!in_array($value, $this->fields[$field])) {
62
+		} else if (!in_array($value, $this->fields[$field])) {
63 63
 			$this->fields[$field][] = $value;
64 64
 		}
65 65
 	}
Please login to merge, or discard this patch.
Tests/Fixtures/ORM/Car.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
 	 *
52 52
 	 * @see \StingerSoft\EntitySearchBundle\Model\SearchableEntity::indexEntity()
53 53
 	 */
54
-	public function indexEntity(Document &$document) {
54
+	public function indexEntity(Document&$document) {
55 55
 		$document->addField(Document::FIELD_TITLE, $this->getTitle());
56 56
 		return true;
57 57
 	}
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
@@ -30,10 +30,10 @@  discard block
 block discarded – undo
30 30
 	}
31 31
 
32 32
 	public function addFacetValue($key, $value, $increaseCounterBy = 1) {
33
-		if(!isset($this->facets[$key])){
33
+		if (!isset($this->facets[$key])) {
34 34
 			$this->facets[$key] = array();
35 35
 		}
36
-		if(!isset($this->facets[$key][$value])){
36
+		if (!isset($this->facets[$key][$value])) {
37 37
 			$this->facets[$key][$value] = 0;
38 38
 		}
39 39
 		$this->facets[$key][$value] = $this->facets[$key][$value] + $increaseCounterBy;
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 * @see \StingerSoft\EntitySearchBundle\Model\Result\FacetSet::getFacet()
47 47
 	 */
48 48
 	public function getFacet($key) {
49
-		if(isset($this->facets[$key])) {
49
+		if (isset($this->facets[$key])) {
50 50
 			return $this->facets[$key];
51 51
 		} else {
52 52
 			return;
Please login to merge, or discard this patch.
Services/Mapping/EntityToDocumentMapper.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -46,18 +46,18 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	public function __construct(SearchService $searchService, array $mapping = array()) {
48 48
 		$this->searchService = $searchService;
49
-		foreach($mapping as $key => $config) {
50
-			if(!isset($config['mappings'])) {
51
-				throw new \InvalidArgumentException($key . ' has no mapping defined!');
49
+		foreach ($mapping as $key => $config) {
50
+			if (!isset($config['mappings'])) {
51
+				throw new \InvalidArgumentException($key.' has no mapping defined!');
52 52
 			}
53
-			if(!isset($config['persistence'])) {
54
-				throw new \InvalidArgumentException($key . ' has no persistence defined!');
53
+			if (!isset($config['persistence'])) {
54
+				throw new \InvalidArgumentException($key.' has no persistence defined!');
55 55
 			}
56
-			if(!isset($config['persistence']['model'])) {
57
-				throw new \InvalidArgumentException($key . ' has no model defined!');
56
+			if (!isset($config['persistence']['model'])) {
57
+				throw new \InvalidArgumentException($key.' has no model defined!');
58 58
 			}
59 59
 			$map = array();
60
-			foreach($config['mappings'] as $fieldKey => $fieldConfig) {
60
+			foreach ($config['mappings'] as $fieldKey => $fieldConfig) {
61 61
 				$map[$fieldKey] = isset($fieldConfig['propertyPath']) && $fieldConfig['propertyPath'] ? $fieldConfig['propertyPath'] : $fieldKey;
62 62
 			}
63 63
 			
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
 	 * @return boolean
73 73
 	 */
74 74
 	public function isIndexable($object) {
75
-		if($object instanceof SearchableEntity) {
75
+		if ($object instanceof SearchableEntity) {
76 76
 			return true;
77 77
 		}
78
-		if(count($this->getMapping($object)) > 0) {
78
+		if (count($this->getMapping($object)) > 0) {
79 79
 			return true;
80 80
 		}
81 81
 		return false;
@@ -89,11 +89,11 @@  discard block
 block discarded – undo
89 89
 	 * @return boolean|Document Returns false if no document could be created
90 90
 	 */
91 91
 	public function createDocument(ObjectManager $manager, $object) {
92
-		if(!$this->isIndexable($object))
92
+		if (!$this->isIndexable($object))
93 93
 			return false;
94 94
 		$document = $this->getSearchService($manager)->createEmptyDocumentFromEntity($object);
95 95
 		$index = $this->fillDocument($document, $object);
96
-		if($index == false)
96
+		if ($index == false)
97 97
 			return false;
98 98
 		
99 99
 		return $document;
@@ -106,13 +106,13 @@  discard block
 block discarded – undo
106 106
 	 * @param object $object        	
107 107
 	 * @return boolean
108 108
 	 */
109
-	protected function fillDocument(Document &$document, $object) {
110
-		if($object instanceof SearchableEntity) {
109
+	protected function fillDocument(Document&$document, $object) {
110
+		if ($object instanceof SearchableEntity) {
111 111
 			return $object->indexEntity($document);
112 112
 		}
113 113
 		$mapping = $this->getMapping($object);
114 114
 		$accessor = PropertyAccess::createPropertyAccessor();
115
-		foreach($mapping as $fieldName => $propertyPath) {
115
+		foreach ($mapping as $fieldName => $propertyPath) {
116 116
 			$document->addField($fieldName, $accessor->getValue($object, $propertyPath));
117 117
 		}
118 118
 		return true;
@@ -126,15 +126,15 @@  discard block
 block discarded – undo
126 126
 	 */
127 127
 	protected function getMapping($object) {
128 128
 		$clazz = get_class($object);
129
-		if(isset($this->cachedMapping[$clazz])) {
129
+		if (isset($this->cachedMapping[$clazz])) {
130 130
 			return $this->cachedMapping[$clazz];
131 131
 		}
132 132
 		$ref = new \ReflectionClass($clazz);
133 133
 		
134 134
 		$mapping = array();
135 135
 		
136
-		foreach($this->mapping as $className => $config) {
137
-			if($clazz == $className || $ref->isSubclassOf($className)) {
136
+		foreach ($this->mapping as $className => $config) {
137
+			if ($clazz == $className || $ref->isSubclassOf($className)) {
138 138
 				$mapping = array_merge($mapping, $config);
139 139
 			}
140 140
 		}
Please login to merge, or discard this patch.
Command/SyncCommand.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -65,15 +65,15 @@  discard block
 block discarded – undo
65 65
 	 */
66 66
 	protected function execute(InputInterface $input, OutputInterface $output) {
67 67
 		// Detect upload path
68
-		if(!self::$defaultUploadPath) {
68
+		if (!self::$defaultUploadPath) {
69 69
 			$root = $this->getContainer()->get('kernel')->getRootDir();
70
-			self::$defaultUploadPath = $root . '/../web/uploads';
70
+			self::$defaultUploadPath = $root.'/../web/uploads';
71 71
 		}
72 72
 		
73 73
 		// Get the entity argument
74 74
 		$entity = $input->getArgument('entity');
75 75
 		
76
-		if($entity == 'all') {
76
+		if ($entity == 'all') {
77 77
 			// $indexHandler = $this->getIndexHandler();
78 78
 			// $entities = $indexHandler->getSearchableEntities();
79 79
 			// foreach($entities as $bundle => $searchableEntities) {
@@ -98,14 +98,14 @@  discard block
 block discarded – undo
98 98
 		try {
99 99
 			// Get repository for the given entity type
100 100
 			$repository = $entityManager->getRepository($entity);
101
-		} catch(\Exception $e) {
101
+		} catch (\Exception $e) {
102 102
 			$output->writeln(sprintf('<error>No repository found for "%s", check your input</error>', $entity));
103 103
 			return;
104 104
 		}
105 105
 		
106 106
 		// Get all entities
107 107
 		$entities = $repository->findAll();
108
-		if(count($entities) == 0) {
108
+		if (count($entities) == 0) {
109 109
 			$output->writeln('<comment>No entities found for indexing</comment>');
110 110
 			return;
111 111
 		}
@@ -113,14 +113,14 @@  discard block
 block discarded – undo
113 113
 		$entitiesIndexed = 0;
114 114
 		
115 115
 		// Index each entity seperate
116
-		foreach($entities as $entity) {
117
-			if($this->getEntityToDocumentMapper()->isIndexable($entity)){
116
+		foreach ($entities as $entity) {
117
+			if ($this->getEntityToDocumentMapper()->isIndexable($entity)) {
118 118
 				$document = $this->getEntityToDocumentMapper()->createDocument($entityManager, $entity);
119 119
 				$this->getSearchService($entityManager)->saveDocument($document);
120 120
 				$entitiesIndexed++;
121 121
 			}
122 122
 		}
123
-		$output->writeln('<comment>Indexed ' . $entitiesIndexed . ' entities</comment>');
123
+		$output->writeln('<comment>Indexed '.$entitiesIndexed.' entities</comment>');
124 124
 	}
125 125
 
126 126
 	/**
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 * @return EntityToDocumentMapperInterface
129 129
 	 */
130 130
 	protected function getEntityToDocumentMapper() {
131
-		if(!$this->entityToDocumentMapper) {
131
+		if (!$this->entityToDocumentMapper) {
132 132
 			$this->entityToDocumentMapper = $this->getContainer()->get(EntityToDocumentMapperInterface::SERVICE_ID);
133 133
 		}
134 134
 		return $this->entityToDocumentMapper;
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	 * @return SearchService
140 140
 	 */
141 141
 	protected function getSearchService(ObjectManager $manager) {
142
-		if(!$this->searchService) {
142
+		if (!$this->searchService) {
143 143
 			$this->searchService = $this->getContainer()->get(SearchService::SERVICE_ID);
144 144
 		}
145 145
 		$this->searchService->setObjectManager($manager);
Please login to merge, or discard this patch.