@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $entityPrimaryKeyField = $this->schema->getEntityPrimaryKeyField(); |
| 60 | 60 | $primaryKeyValues = []; |
| 61 | 61 | $orderValue = count($documentsArray); |
| 62 | - foreach($documentsArray as $documentRow) { |
|
| 62 | + foreach ($documentsArray as $documentRow) { |
|
| 63 | 63 | if (!array_key_exists($discriminatorField->getDocumentFieldName(), $documentRow)) { |
| 64 | 64 | throw new DiscriminatorFieldException( |
| 65 | 65 | sprintf('Discriminator field "%s" must be presented in dataset', $discriminatorField->getDocumentFieldName()) |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | $entities = $this->entityRepository |
| 91 | 91 | ->createQueryBuilder('entity') |
| 92 | - ->addSelect(sprintf('(CASE %s ELSE 0 END) AS HIDDEN score', join(' ' ,$scoreStatements))) |
|
| 92 | + ->addSelect(sprintf('(CASE %s ELSE 0 END) AS HIDDEN score', join(' ', $scoreStatements))) |
|
| 93 | 93 | ->where( |
| 94 | 94 | sprintf('entity.%s in (:ids)', $entityPrimaryKeyField->getEntityFieldName()) |
| 95 | 95 | ) |
@@ -177,7 +177,7 @@ |
||
| 177 | 177 | throw new UpdateQueryException('It seems you did not end the entity'); |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - foreach($this->deleteConditions as $documentFieldName => $value) { |
|
| 180 | + foreach ($this->deleteConditions as $documentFieldName => $value) { |
|
| 181 | 181 | $this->solrQuery->addDeleteQuery( |
| 182 | 182 | sprintf('%s:"%s"', $documentFieldName, $value) |
| 183 | 183 | ); |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | $this->config = $config; |
| 40 | 40 | $this->clientRegistry = $clientRegistry; |
| 41 | 41 | |
| 42 | - foreach($config->getIndexedEntities() as $entityConfig) { |
|
| 42 | + foreach ($config->getIndexedEntities() as $entityConfig) { |
|
| 43 | 43 | $this->hydrators[$entityConfig['class']] = $hydratorBuilder->buildSelectQueryHydratorByClass($entityConfig['class']); |
| 44 | 44 | } |
| 45 | 45 | } |
@@ -74,7 +74,7 @@ |
||
| 74 | 74 | protected function initDiscriminatorConditions() |
| 75 | 75 | { |
| 76 | 76 | $discriminatorConfigField = $this->getSchema()->getDiscriminatorConfigField(); |
| 77 | - foreach($this->entityConfigs as $entityConfig) { |
|
| 77 | + foreach ($this->entityConfigs as $entityConfig) { |
|
| 78 | 78 | $this->discriminatorConditions[] = sprintf( |
| 79 | 79 | '%s:"%s"', |
| 80 | 80 | $discriminatorConfigField->getDocumentFieldName(), |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | $entityFieldNames = [$entityFieldNames]; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - foreach($entityFieldNames as $entityFieldName) { |
|
| 144 | + foreach ($entityFieldNames as $entityFieldName) { |
|
| 145 | 145 | $this->getField($entityFieldName); |
| 146 | 146 | } |
| 147 | 147 | |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | */ |
| 335 | 335 | public function groupConditionsAsOr() |
| 336 | 336 | { |
| 337 | - $this->addOrCondition = [ $this->buildGroupCondition() ]; |
|
| 337 | + $this->addOrCondition = [$this->buildGroupCondition()]; |
|
| 338 | 338 | $this->addAndCondition = []; |
| 339 | 339 | |
| 340 | 340 | return $this; |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | */ |
| 346 | 346 | public function groupConditionsAsAnd() |
| 347 | 347 | { |
| 348 | - $this->addAndCondition = [ $this->buildGroupCondition() ]; |
|
| 348 | + $this->addAndCondition = [$this->buildGroupCondition()]; |
|
| 349 | 349 | $this->addOrCondition = []; |
| 350 | 350 | |
| 351 | 351 | return $this; |
@@ -486,7 +486,7 @@ discard block |
||
| 486 | 486 | $format = $fieldPartFormat . sprintf('(%s)^%%s', $valuePartFormat); |
| 487 | 487 | $condition = sprintf($format, $field->getDocumentFieldName(), $searchTerm, $field->getPriority()); |
| 488 | 488 | } else { |
| 489 | - $condition = sprintf($fieldPartFormat . $valuePartFormat , $field->getDocumentFieldName(), $searchTerm); |
|
| 489 | + $condition = sprintf($fieldPartFormat . $valuePartFormat, $field->getDocumentFieldName(), $searchTerm); |
|
| 490 | 490 | } |
| 491 | 491 | |
| 492 | 492 | $condition = $isNegative ? $this->buildNegativeCondition($condition) : $condition; |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | $condition = $fieldPartFormat . $valuePartFormat; |
| 513 | 513 | |
| 514 | 514 | |
| 515 | - $condition = $isNegative ? $this->buildNegativeCondition($condition) : $condition; |
|
| 515 | + $condition = $isNegative ? $this->buildNegativeCondition($condition) : $condition; |
|
| 516 | 516 | |
| 517 | 517 | return sprintf( |
| 518 | 518 | $condition, |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | if (strpos($searchTerm, ' ') > 0) { |
| 545 | 545 | $parts = explode(' ', $searchTerm); |
| 546 | 546 | $formattedParts = []; |
| 547 | - foreach ($parts as $part) { |
|
| 547 | + foreach ($parts as $part) { |
|
| 548 | 548 | $formattedParts[] = sprintf('%s~%u', $part, $distance); |
| 549 | 549 | } |
| 550 | 550 | $valuePartFormat = '"%s"'; |
@@ -556,7 +556,7 @@ discard block |
||
| 556 | 556 | } |
| 557 | 557 | |
| 558 | 558 | $condition = $fieldPartFormat . $valuePartFormat; |
| 559 | - $condition = $isNegative ? $this->buildNegativeCondition($condition) : $condition; |
|
| 559 | + $condition = $isNegative ? $this->buildNegativeCondition($condition) : $condition; |
|
| 560 | 560 | |
| 561 | 561 | return sprintf( |
| 562 | 562 | $condition, |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | if ($currentOrConditions && $currentAndConditions) { |
| 574 | 574 | $groupedCondition = sprintf('(%s AND %s)', $currentOrConditions, $currentAndConditions); |
| 575 | 575 | } else { |
| 576 | - $conditions = $currentOrConditions ?: $currentAndConditions; |
|
| 576 | + $conditions = $currentOrConditions ?: $currentAndConditions; |
|
| 577 | 577 | $groupedCondition = sprintf('(%s)', $conditions); |
| 578 | 578 | } |
| 579 | 579 | |
@@ -650,12 +650,12 @@ discard block |
||
| 650 | 650 | throw new QueryException('SearchTerm argument must be a scalar'); |
| 651 | 651 | } |
| 652 | 652 | |
| 653 | - $specialSymbols = ['+','-','&&','||','!','(',')','{','}','[',']','^','"','~',':','/']; |
|
| 654 | - $escapedSpecialSymbols = ['\+','\-','\&&','\||','\!','\(','\)','\{','\}','\[','\]','\^','\"','\~','\:','\/']; |
|
| 653 | + $specialSymbols = ['+', '-', '&&', '||', '!', '(', ')', '{', '}', '[', ']', '^', '"', '~', ':', '/']; |
|
| 654 | + $escapedSpecialSymbols = ['\+', '\-', '\&&', '\||', '\!', '\(', '\)', '\{', '\}', '\[', '\]', '\^', '\"', '\~', '\:', '\/']; |
|
| 655 | 655 | |
| 656 | 656 | if (!$wildcard) { |
| 657 | - $specialSymbols = array_merge($specialSymbols, ['*','?']); |
|
| 658 | - $escapedSpecialSymbols = array_merge($escapedSpecialSymbols, ['\*','\?']); |
|
| 657 | + $specialSymbols = array_merge($specialSymbols, ['*', '?']); |
|
| 658 | + $escapedSpecialSymbols = array_merge($escapedSpecialSymbols, ['\*', '\?']); |
|
| 659 | 659 | } |
| 660 | 660 | |
| 661 | 661 | $searchTerm = preg_replace('/[^a-zA-Z\s0-9-_=+.?*!:)(\]\[ ]/', '', $searchTerm); |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | $entityValue = $this->getEntityFieldValue($entity); |
| 17 | 17 | if (!is_null($entityValue)) { |
| 18 | 18 | if (is_scalar($entityValue)) { |
| 19 | - $entityValue = [ $entityValue ]; |
|
| 19 | + $entityValue = [$entityValue]; |
|
| 20 | 20 | } elseif ( |
| 21 | 21 | !is_array($entityValue) && |
| 22 | 22 | ((!$entityValue instanceof \Iterator) && (!$entityValue instanceof \IteratorAggregate)) |
@@ -217,7 +217,7 @@ |
||
| 217 | 217 | } |
| 218 | 218 | } else { |
| 219 | 219 | throw new RequiredFieldException( |
| 220 | - sprintf( |
|
| 220 | + sprintf( |
|
| 221 | 221 | 'Either getter method "%s" or isser method "%s" is not found in %s.', |
| 222 | 222 | $getterMethodName, |
| 223 | 223 | $isserMethodName, |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | ) |
| 104 | 104 | ); |
| 105 | 105 | } |
| 106 | - $this->discriminatorValues[] = $discriminatorValue; |
|
| 106 | + $this->discriminatorValues[] = $discriminatorValue; |
|
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | } |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | true |
| 139 | 139 | ); |
| 140 | 140 | |
| 141 | - foreach($entityConfig['filters'] as $filterName) { |
|
| 141 | + foreach ($entityConfig['filters'] as $filterName) { |
|
| 142 | 142 | if (!array_key_exists($filterName, $filtersKeys)) { |
| 143 | 143 | throw new FilterConfigException( |
| 144 | 144 | sprintf('Filter "%s" is not defined in "filters" section', $filterName) |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | */ |
| 167 | 167 | private function checkDocumentFieldNamesAreUnique($schemaConfig) |
| 168 | 168 | { |
| 169 | - $schemaFields = [ $schemaConfig['config_entity_fields'], $schemaConfig['fields'] ]; |
|
| 169 | + $schemaFields = [$schemaConfig['config_entity_fields'], $schemaConfig['fields']]; |
|
| 170 | 170 | $documentFieldsNames = []; |
| 171 | 171 | |
| 172 | 172 | while ($fieldsConfig = array_shift($schemaFields)) { |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | } |
| 94 | 94 | } else { |
| 95 | 95 | $entitiesClasses = $this->getAssocEntitiesClasses(); |
| 96 | - if (!array_key_exists($entityType, $entitiesClasses )) { |
|
| 96 | + if (!array_key_exists($entityType, $entitiesClasses)) { |
|
| 97 | 97 | throw new \Exception('There is no such possible entity-type. Check help section for possible values'); |
| 98 | 98 | } |
| 99 | 99 | $entityClass = $entitiesClasses[$entityType]; |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | private function processRepository(EntityRepository $repository) |
| 129 | 129 | { |
| 130 | 130 | $offset = 0; |
| 131 | - while ($entities = $repository->findBy([],['id'=> 'asc'], self::BUNCH_COUNT, $offset)) { |
|
| 131 | + while ($entities = $repository->findBy([], ['id'=> 'asc'], self::BUNCH_COUNT, $offset)) { |
|
| 132 | 132 | foreach ($entities as $entity) { |
| 133 | 133 | $this->processEntity($entity); |
| 134 | 134 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | $entity = new \stdClass(); |
| 89 | 89 | $entity->$primaryKeyFieldName = 32; |
| 90 | 90 | |
| 91 | - $query = new Query([ $entity ]); |
|
| 91 | + $query = new Query([$entity]); |
|
| 92 | 92 | |
| 93 | 93 | $this->entityRepository->expects($this->at(0)) |
| 94 | 94 | ->method('createQueryBuilder') |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | $entityConfig = [ |
| 125 | 125 | 'class' => $entityConfigClass, |
| 126 | 126 | 'config' => [ |
| 127 | - [ 'name' => $configFieldName, 'value' => $configFieldValue] |
|
| 127 | + ['name' => $configFieldName, 'value' => $configFieldValue] |
|
| 128 | 128 | ] |
| 129 | 129 | ]; |
| 130 | 130 | $discriminatorField = new ConfigEntityField($configFieldName, $configDocumentFieldName, true, 10); |