@@ -9,12 +9,12 @@ |
||
| 9 | 9 | define('TESTS_TEMP_DIR', __DIR__.'/temp'); |
| 10 | 10 | define('VENDOR_PATH', realpath(__DIR__.'/../vendor')); |
| 11 | 11 | if (!class_exists('PHPUnit_Framework_TestCase') || |
| 12 | - version_compare(PHPUnit_Runner_Version::id(), '3.5') < 0 |
|
| 12 | + version_compare(PHPUnit_Runner_Version::id(), '3.5') < 0 |
|
| 13 | 13 | ) { |
| 14 | - die('PHPUnit framework is required, at least 3.5 version'); |
|
| 14 | + die('PHPUnit framework is required, at least 3.5 version'); |
|
| 15 | 15 | } |
| 16 | 16 | if (!class_exists('PHPUnit_Framework_MockObject_MockBuilder')) { |
| 17 | - die('PHPUnit MockObject plugin is required, at least 1.0.8 version'); |
|
| 17 | + die('PHPUnit MockObject plugin is required, at least 1.0.8 version'); |
|
| 18 | 18 | } |
| 19 | 19 | /** @var $loader ClassLoader */ |
| 20 | 20 | $loader = require __DIR__.'/../vendor/autoload.php'; |
@@ -73,7 +73,9 @@ discard block |
||
| 73 | 73 | * @param LifecycleEventArgs $args |
| 74 | 74 | */ |
| 75 | 75 | public function postPersist(LifecycleEventArgs $args) { |
| 76 | - if(!$this->enableIndexing) return; |
|
| 76 | + if(!$this->enableIndexing) { |
|
| 77 | + return; |
|
| 78 | + } |
|
| 77 | 79 | $this->updateEntity($args->getObject(), $args->getObjectManager()); |
| 78 | 80 | } |
| 79 | 81 | |
@@ -90,7 +92,9 @@ discard block |
||
| 90 | 92 | * @param LifecycleEventArgs $args |
| 91 | 93 | */ |
| 92 | 94 | public function preRemove(LifecycleEventArgs $args) { |
| 93 | - if(!$this->enableIndexing) return; |
|
| 95 | + if(!$this->enableIndexing) { |
|
| 96 | + return; |
|
| 97 | + } |
|
| 94 | 98 | $this->removeEntity($args->getObject(), $args->getObjectManager()); |
| 95 | 99 | } |
| 96 | 100 | |
@@ -100,7 +104,9 @@ discard block |
||
| 100 | 104 | * @param LifecycleEventArgs $args |
| 101 | 105 | */ |
| 102 | 106 | public function postUpdate(LifecycleEventArgs $args) { |
| 103 | - if(!$this->enableIndexing) return; |
|
| 107 | + if(!$this->enableIndexing) { |
|
| 108 | + return; |
|
| 109 | + } |
|
| 104 | 110 | $this->updateEntity($args->getObject(), $args->getObjectManager()); |
| 105 | 111 | } |
| 106 | 112 | |
@@ -31,8 +31,9 @@ |
||
| 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 | |
@@ -134,12 +134,15 @@ |
||
| 134 | 134 | protected function generateFacetChoices($facetType, array $facets, array $selectedFacets = array(), $formatter) { |
| 135 | 135 | $choices = array(); |
| 136 | 136 | foreach($facets as $facet => $count) { |
| 137 | - if($count == 0 && !in_array($facet, $selectedFacets)) |
|
| 138 | - continue; |
|
| 137 | + if($count == 0 && !in_array($facet, $selectedFacets)) { |
|
| 138 | + continue; |
|
| 139 | + } |
|
| 139 | 140 | $choices[$this->formatFacet($formatter, $facetType, $facet, $count)] = $facet; |
| 140 | 141 | } |
| 141 | 142 | foreach($selectedFacets as $facet) { |
| 142 | - if(isset($facets[$facet])) continue; |
|
| 143 | + if(isset($facets[$facet])) { |
|
| 144 | + continue; |
|
| 145 | + } |
|
| 143 | 146 | $count = 0; |
| 144 | 147 | $choices[$this->formatFacet($formatter, $facetType, $facet, $count)] = $facet; |
| 145 | 148 | } |
@@ -105,12 +105,14 @@ |
||
| 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 | } |
@@ -135,7 +135,9 @@ |
||
| 135 | 135 | foreach($entities as $entity) { |
| 136 | 136 | if($this->getEntityToDocumentMapper()->isIndexable($entity)) { |
| 137 | 137 | $document = $this->getEntityToDocumentMapper()->createDocument($entityManager, $entity); |
| 138 | - if($document === false) continue; |
|
| 138 | + if($document === false) { |
|
| 139 | + continue; |
|
| 140 | + } |
|
| 139 | 141 | $this->getSearchService($entityManager)->saveDocument($document); |
| 140 | 142 | $entitiesIndexed++; |
| 141 | 143 | if($entitiesIndexed % 50 == 0) { |