@@ -32,7 +32,7 @@ |
||
32 | 32 | * @see \StingerSoft\EntitySearchBundle\Services\SearchService::setObjectManager() |
33 | 33 | */ |
34 | 34 | public function setObjectManager(ObjectManager $om) { |
35 | - if($this->objectManager) return; |
|
35 | + if ($this->objectManager) return; |
|
36 | 36 | $this->objectManager = $om; |
37 | 37 | } |
38 | 38 |
@@ -51,7 +51,7 @@ |
||
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 | } |
@@ -44,7 +44,7 @@ discard block |
||
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 |
||
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)); |
@@ -31,7 +31,7 @@ |
||
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 | } |
@@ -24,5 +24,5 @@ |
||
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 |
@@ -55,11 +55,11 @@ |
||
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 | } |
@@ -51,7 +51,7 @@ |
||
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 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $id = $document->getEntityClass(); |
31 | 31 | $id .= '#'; |
32 | 32 | $entityId = $document->getEntityId(); |
33 | - if(is_scalar($entityId)) { |
|
33 | + if (is_scalar($entityId)) { |
|
34 | 34 | $id .= $entityId; |
35 | 35 | } else { |
36 | 36 | $id .= md5(serialize($entityId)); |
@@ -76,15 +76,15 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function autocomplete($search, $maxResults = 10) { |
78 | 78 | $words = array(); |
79 | - foreach($this->index as $doc) { |
|
80 | - foreach($doc->getFields() as $content) { |
|
81 | - if(is_string($content)) { |
|
79 | + foreach ($this->index as $doc) { |
|
80 | + foreach ($doc->getFields() as $content) { |
|
81 | + if (is_string($content)) { |
|
82 | 82 | $words = array_merge($words, explode(' ', $content)); |
83 | 83 | } |
84 | 84 | } |
85 | 85 | } |
86 | 86 | |
87 | - return array_filter($words, function ($word) use ($search) { |
|
87 | + return array_filter($words, function($word) use ($search) { |
|
88 | 88 | return stripos($word, $search) === 0; |
89 | 89 | }); |
90 | 90 | } |
@@ -103,10 +103,10 @@ discard block |
||
103 | 103 | |
104 | 104 | |
105 | 105 | $hits = array(); |
106 | - foreach($this->index as $key => $doc) { |
|
107 | - foreach($doc->getFields() as $content) { |
|
108 | - if(is_string($content) && stripos($content, $term) !== false) { |
|
109 | - if(!isset($hits[$key])) { |
|
106 | + foreach ($this->index as $key => $doc) { |
|
107 | + foreach ($doc->getFields() as $content) { |
|
108 | + if (is_string($content) && stripos($content, $term) !== false) { |
|
109 | + if (!isset($hits[$key])) { |
|
110 | 110 | $hits[$key] = 0; |
111 | 111 | } |
112 | 112 | $hits[$key] = $hits[$key] + 1; |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | } |
116 | 116 | arsort($hits); |
117 | 117 | $results = array(); |
118 | - foreach(array_keys($hits) as $docId){ |
|
118 | + foreach (array_keys($hits) as $docId) { |
|
119 | 119 | $doc = $this->index[$docId]; |
120 | 120 | $facets->addFacetValue(FacetSet::FACET_ENTITY_TYPE, $doc->getEntityClass()); |
121 | 121 | $facets->addFacetValue(FacetSet::FACET_AUTHOR, $doc->getFieldValue(Document::FIELD_AUTHOR)); |
@@ -53,7 +53,7 @@ |
||
53 | 53 | /** |
54 | 54 | * @param Document[] $results |
55 | 55 | */ |
56 | - public function setResults(array $results){ |
|
56 | + public function setResults(array $results) { |
|
57 | 57 | $this->results = $results; |
58 | 58 | } |
59 | 59 | } |
60 | 60 | \ No newline at end of file |