@@ -116,7 +116,7 @@ |
||
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 |
@@ -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); |
@@ -69,13 +69,13 @@ discard block |
||
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)); |
@@ -1,6 +1,6 @@ |
||
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; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | private $facetFormatter; |
33 | 33 | |
34 | 34 | public function searchAction(Request $request, DocumentToEntityMapperInterface $mapper) { |
35 | - if($request->query->get('term', false) !== false) { |
|
35 | + if ($request->query->get('term', false) !== false) { |
|
36 | 36 | $this->setSearchTerm($request->getSession(), $request->query->get('term')); |
37 | 37 | return $this->redirectToRoute('stinger_soft_entity_search_search'); |
38 | 38 | } |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | )); |
49 | 49 | |
50 | 50 | $facetForm->handleRequest($request); |
51 | - if($facetForm->isSubmitted()) { |
|
52 | - if($facetForm->get('clear')->isClicked()) { |
|
51 | + if ($facetForm->isSubmitted()) { |
|
52 | + if ($facetForm->get('clear')->isClicked()) { |
|
53 | 53 | $query->setFacets($this->getDefaultFacets()); |
54 | 54 | } |
55 | 55 | $this->setSearchTerm($request->getSession(), $query->getSearchTerm()); |
@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | |
68 | 68 | $page = (int)$request->query->get('page', 1); |
69 | 69 | $results = null; |
70 | - if($result instanceof PaginatableResultSet) { |
|
70 | + if ($result instanceof PaginatableResultSet) { |
|
71 | 71 | $results = $result->paginate($page, $this->getResultsPerPage()); |
72 | - } elseif($results !== null) { |
|
72 | + } elseif ($results !== null) { |
|
73 | 73 | $results = $result->getResults(($page - 1) * $this->getResultsPerPage(), $this->getResultsPerPage()); |
74 | 74 | } |
75 | 75 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | 'mapper' => $mapper, |
81 | 81 | 'facetForm' => $facetForm->createView() |
82 | 82 | )); |
83 | - } catch(\Exception $exception) { |
|
83 | + } catch (\Exception $exception) { |
|
84 | 84 | $response = $this->render($this->getErrorTemplate(), array( |
85 | 85 | 'error' => $exception->getMessage(), |
86 | 86 | 'term' => $query->getSearchTerm() |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | protected function getConfiguredUsedFacets(array $queryUsedFacets) { |
125 | 125 | $availableFacets = $this->getAvailableFacets(); |
126 | 126 | $usedFacets = array(); |
127 | - foreach($queryUsedFacets as $queryUsedFacet) { |
|
127 | + foreach ($queryUsedFacets as $queryUsedFacet) { |
|
128 | 128 | $usedFacets[$queryUsedFacet] = $availableFacets[$queryUsedFacet]; |
129 | 129 | } |
130 | 130 | return $usedFacets; |
@@ -191,15 +191,15 @@ discard block |
||
191 | 191 | } |
192 | 192 | |
193 | 193 | protected function initFacets() { |
194 | - if(!$this->availableFacets) { |
|
194 | + if (!$this->availableFacets) { |
|
195 | 195 | $this->availableFacets = array(); |
196 | 196 | $this->facetFormatter = array(); |
197 | 197 | |
198 | 198 | $facetServices = $this->getParameter('stinger_soft.entity_search.available_facets'); |
199 | - foreach($facetServices as $facetServiceId) { |
|
199 | + foreach ($facetServices as $facetServiceId) { |
|
200 | 200 | $facetService = $this->searchService->getFacet($facetServiceId); |
201 | 201 | $this->availableFacets[$facetService->getField()] = $facetService->getFormOptions(); |
202 | - if($facetService->getFacetFormatter()) { |
|
202 | + if ($facetService->getFacetFormatter()) { |
|
203 | 203 | $this->facetFormatter[$facetService->getField()] = $facetService->getFacetFormatter(); |
204 | 204 | } |
205 | 205 | } |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * @return string[string][] |
214 | 214 | */ |
215 | 215 | protected function getSearchFacets(SessionInterface $session) { |
216 | - $facets = $session->get($this->getSessionPrefix() . '_facets', false); |
|
216 | + $facets = $session->get($this->getSessionPrefix().'_facets', false); |
|
217 | 217 | return $facets ? \json_decode($facets, true) : $this->getDefaultFacets(); |
218 | 218 | } |
219 | 219 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | * @param string[string][] $facets |
225 | 225 | */ |
226 | 226 | protected function setSearchFacets(SessionInterface $session, $facets) { |
227 | - $session->set($this->getSessionPrefix() . '_facets', \json_encode($facets)); |
|
227 | + $session->set($this->getSessionPrefix().'_facets', \json_encode($facets)); |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | /** |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | * @return mixed |
235 | 235 | */ |
236 | 236 | protected function getSearchTerm(SessionInterface $session) { |
237 | - return $session->get($this->getSessionPrefix() . '_term', false); |
|
237 | + return $session->get($this->getSessionPrefix().'_term', false); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | /** |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | * @param string $term |
245 | 245 | */ |
246 | 246 | protected function setSearchTerm(SessionInterface $session, $term) { |
247 | - $session->set($this->getSessionPrefix() . '_term', $term); |
|
247 | + $session->set($this->getSessionPrefix().'_term', $term); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | } |
251 | 251 | \ No newline at end of file |
@@ -97,7 +97,7 @@ discard block |
||
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 |
||
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 | }); |
@@ -16,7 +16,7 @@ discard block |
||
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 |
||
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')); |
@@ -37,7 +37,7 @@ |
||
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); |
@@ -16,13 +16,13 @@ discard block |
||
16 | 16 | * @param ContainerBuilder $container |
17 | 17 | */ |
18 | 18 | public function process(ContainerBuilder $container) { |
19 | - if(!$container->hasAlias(SearchService::class)) { |
|
19 | + if (!$container->hasAlias(SearchService::class)) { |
|
20 | 20 | return; |
21 | 21 | } |
22 | 22 | |
23 | 23 | $serviceId = (string)$container->getAlias(SearchService::class); |
24 | 24 | |
25 | - if(!$container->hasDefinition($serviceId)) { |
|
25 | + if (!$container->hasDefinition($serviceId)) { |
|
26 | 26 | return; |
27 | 27 | } |
28 | 28 | |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | $servicesMap = array(); |
32 | 32 | // Builds an array with fully-qualified type class names as keys and service IDs as values |
33 | - foreach($container->findTaggedServiceIds(FacetServiceInterface::TAG_NAME, true) as $serviceId => $tag) { |
|
33 | + foreach ($container->findTaggedServiceIds(FacetServiceInterface::TAG_NAME, true) as $serviceId => $tag) { |
|
34 | 34 | // Add form type service to the service locator |
35 | 35 | $serviceDefinition = $container->getDefinition($serviceId); |
36 | 36 | $servicesMap[$serviceDefinition->getClass()] = new Reference($serviceId); |
@@ -31,7 +31,7 @@ |
||
31 | 31 | */ |
32 | 32 | public function getConfigTreeBuilder() { |
33 | 33 | $treeBuilder = new TreeBuilder('stinger_soft_entity_search'); |
34 | - if(Kernel::VERSION_ID < 40200) { |
|
34 | + if (Kernel::VERSION_ID < 40200) { |
|
35 | 35 | $root = $treeBuilder->root('stinger_soft_entity_search'); |
36 | 36 | } else { |
37 | 37 | $root = $treeBuilder->getRootNode(); |