diff --git a/application/Espo/Classes/Acl/Attachment/AccessChecker.php b/application/Espo/Classes/Acl/Attachment/AccessChecker.php index 0a2c84dba2..0af8a7a861 100644 --- a/application/Espo/Classes/Acl/Attachment/AccessChecker.php +++ b/application/Espo/Classes/Acl/Attachment/AccessChecker.php @@ -75,8 +75,7 @@ class AccessChecker implements AccessEntityCREDChecker if ($parentId && $parentType) { $parent = $this->entityManager->getEntityById($parentType, $parentId); - } - else if ($relatedId && $relatedType) { + } else if ($relatedId && $relatedType) { $parent = $this->entityManager->getEntityById($relatedType, $relatedId); } @@ -95,8 +94,7 @@ class AccessChecker implements AccessEntityCREDChecker if ($result !== null) { return $result; } - } - else if ($this->aclManager->checkEntity($user, $parent)) { + } else if ($this->aclManager->checkEntity($user, $parent)) { if ( $entity->getTargetField() && !$this->aclManager->checkField($user, $parent->getEntityType(), $entity->getTargetField()) diff --git a/application/Espo/Classes/AclPortal/Attachment/AccessChecker.php b/application/Espo/Classes/AclPortal/Attachment/AccessChecker.php index 262bc20e53..4e94b45dfa 100644 --- a/application/Espo/Classes/AclPortal/Attachment/AccessChecker.php +++ b/application/Espo/Classes/AclPortal/Attachment/AccessChecker.php @@ -81,8 +81,7 @@ class AccessChecker implements AccessEntityCREDChecker if ($parentId && $parentType) { $parent = $this->entityManager->getEntityById($parentType, $parentId); - } - else if ($relatedId && $relatedType) { + } else if ($relatedId && $relatedType) { $parent = $this->entityManager->getEntityById($relatedType, $relatedId); } @@ -101,8 +100,7 @@ class AccessChecker implements AccessEntityCREDChecker if ($result !== null) { return $result; } - } - else if ($this->aclManager->checkEntity($user, $parent)) { + } else if ($this->aclManager->checkEntity($user, $parent)) { if ( $entity->getTargetField() && !$this->aclManager->checkField($user, $parent->getEntityType(), $entity->getTargetField()) diff --git a/application/Espo/Classes/AssignmentNotificators/Email.php b/application/Espo/Classes/AssignmentNotificators/Email.php index 632cff3053..4dcfe8d40a 100644 --- a/application/Espo/Classes/AssignmentNotificators/Email.php +++ b/application/Espo/Classes/AssignmentNotificators/Email.php @@ -96,8 +96,7 @@ class Email implements AssignmentNotificator if ($params->getOption('isJustSent')) { $previousUserIdList = []; - } - else { + } else { $previousUserIdList = $entity->getFetched('usersIds'); if (!is_array($previousUserIdList)) { diff --git a/application/Espo/Classes/FieldValidators/Email/Addresses/MaxCount.php b/application/Espo/Classes/FieldValidators/Email/Addresses/MaxCount.php index ff772ba799..2c7b66c3c2 100644 --- a/application/Espo/Classes/FieldValidators/Email/Addresses/MaxCount.php +++ b/application/Espo/Classes/FieldValidators/Email/Addresses/MaxCount.php @@ -54,14 +54,11 @@ class MaxCount implements Validator { if ($field === 'to') { $addresses = $entity->getToAddressList(); - } - else if ($field === 'cc') { + } else if ($field === 'cc') { $addresses = $entity->getCcAddressList(); - } - else if ($field === 'bcc') { + } else if ($field === 'bcc') { $addresses = $entity->getBccAddressList(); - } - else { + } else { throw new LogicException(); } diff --git a/application/Espo/Classes/FieldValidators/Email/Addresses/Valid.php b/application/Espo/Classes/FieldValidators/Email/Addresses/Valid.php index be6f275c1c..e14ab1292c 100644 --- a/application/Espo/Classes/FieldValidators/Email/Addresses/Valid.php +++ b/application/Espo/Classes/FieldValidators/Email/Addresses/Valid.php @@ -49,14 +49,11 @@ class Valid implements Validator { if ($field === 'to') { $addresses = $entity->getToAddressList(); - } - else if ($field === 'cc') { + } else if ($field === 'cc') { $addresses = $entity->getCcAddressList(); - } - else if ($field === 'bcc') { + } else if ($field === 'bcc') { $addresses = $entity->getBccAddressList(); - } - else { + } else { throw new LogicException(); } diff --git a/application/Espo/Classes/Jobs/Cleanup.php b/application/Espo/Classes/Jobs/Cleanup.php index 17365c7e41..bc40cc5828 100644 --- a/application/Espo/Classes/Jobs/Cleanup.php +++ b/application/Espo/Classes/Jobs/Cleanup.php @@ -772,8 +772,7 @@ class Cleanup implements JobDataLess if ($this->metadata->get(['entityDefs', $scope, 'fields', 'modifiedAt'])) { $whereClause['modifiedAt<'] = $datetime->format(DateTimeUtil::SYSTEM_DATE_TIME_FORMAT); - } - else if ($this->metadata->get(['entityDefs', $scope, 'fields', 'createdAt'])) { + } else if ($this->metadata->get(['entityDefs', $scope, 'fields', 'createdAt'])) { $whereClause['createdAt<'] = $datetime->format(DateTimeUtil::SYSTEM_DATE_TIME_FORMAT); } diff --git a/application/Espo/Classes/RecordHooks/Email/BeforeUpdate.php b/application/Espo/Classes/RecordHooks/Email/BeforeUpdate.php index e7627a6373..f461167477 100644 --- a/application/Espo/Classes/RecordHooks/Email/BeforeUpdate.php +++ b/application/Espo/Classes/RecordHooks/Email/BeforeUpdate.php @@ -66,8 +66,7 @@ class BeforeUpdate implements SaveHook if ($this->isEmailManuallyArchived($entity)) { $skipFilter = true; - } - else if ($entity->isAttributeChanged('dateSent')) { + } else if ($entity->isAttributeChanged('dateSent')) { $entity->set('dateSent', $entity->getFetched('dateSent')); } diff --git a/application/Espo/Classes/TemplateHelpers/GoogleMaps.php b/application/Espo/Classes/TemplateHelpers/GoogleMaps.php index 7bf8c63a1b..004d38f658 100644 --- a/application/Espo/Classes/TemplateHelpers/GoogleMaps.php +++ b/application/Espo/Classes/TemplateHelpers/GoogleMaps.php @@ -95,8 +95,7 @@ class GoogleMaps implements Helper $country = $rootContext[$field . 'Country'] ?? null; $state = $rootContext[$field . 'State'] ?? null; $postalCode = $rootContext[$field . 'postalCode'] ?? null; - } - else { + } else { $street = $data->getOption('street'); $city = $data->getOption('city'); $country = $data->getOption('country'); diff --git a/application/Espo/Core/Acl/DefaultAccessChecker.php b/application/Espo/Core/Acl/DefaultAccessChecker.php index dca1cec662..fb5d3b5b20 100644 --- a/application/Espo/Core/Acl/DefaultAccessChecker.php +++ b/application/Espo/Core/Acl/DefaultAccessChecker.php @@ -182,12 +182,10 @@ class DefaultAccessChecker implements if (!$entity->has(self::ATTR_ASSIGNED_USER_ID)) { $isDeletedAllowed = true; - } - else { + } else { if (!$entity->get(self::ATTR_ASSIGNED_USER_ID)) { $isDeletedAllowed = true; - } - else if ($entity->get(self::ATTR_ASSIGNED_USER_ID) === $entity->get(self::ATTR_CREATED_BY_ID)) { + } else if ($entity->get(self::ATTR_ASSIGNED_USER_ID) === $entity->get(self::ATTR_CREATED_BY_ID)) { $isDeletedAllowed = true; } } diff --git a/application/Espo/Core/Acl/DefaultAssignmentChecker.php b/application/Espo/Core/Acl/DefaultAssignmentChecker.php index 280bcd668d..65501e1be3 100644 --- a/application/Espo/Core/Acl/DefaultAssignmentChecker.php +++ b/application/Espo/Core/Acl/DefaultAssignmentChecker.php @@ -114,8 +114,7 @@ class DefaultAssignmentChecker implements AssignmentChecker if ($entity->isAttributeChanged(self::ATTR_ASSIGNED_USER_ID)) { $toProcess = true; } - } - else { + } else { $toProcess = true; } @@ -135,8 +134,7 @@ class DefaultAssignmentChecker implements AssignmentChecker if ($user->getId() !== $assignedUserId) { return false; } - } - else if ($assignmentPermission === Table::LEVEL_TEAM) { + } else if ($assignmentPermission === Table::LEVEL_TEAM) { $teamIdList = $user->getTeamIdList(); if ( @@ -197,8 +195,7 @@ class DefaultAssignmentChecker implements AssignmentChecker $newIdList[] = $id; } } - } - else { + } else { $newIdList = $teamIdList; } @@ -231,8 +228,7 @@ class DefaultAssignmentChecker implements AssignmentChecker if (empty($assignedUserIdList)) { return false; } - } - else if ($entity->hasAttribute(self::ATTR_ASSIGNED_USER_ID)) { + } else if ($entity->hasAttribute(self::ATTR_ASSIGNED_USER_ID)) { if (!$entity->get(self::ATTR_ASSIGNED_USER_ID)) { return false; } diff --git a/application/Espo/Core/Acl/DefaultOwnershipChecker.php b/application/Espo/Core/Acl/DefaultOwnershipChecker.php index e403e891ec..1eaaff29b7 100644 --- a/application/Espo/Core/Acl/DefaultOwnershipChecker.php +++ b/application/Espo/Core/Acl/DefaultOwnershipChecker.php @@ -56,8 +56,7 @@ class DefaultOwnershipChecker implements OwnershipOwnChecker, OwnershipTeamCheck ) { return true; } - } - else if ($entity->hasAttribute(self::ATTR_CREATED_BY_ID)) { + } else if ($entity->hasAttribute(self::ATTR_CREATED_BY_ID)) { if ( $entity->has(self::ATTR_CREATED_BY_ID) && $user->getId() === $entity->get(self::ATTR_CREATED_BY_ID) diff --git a/application/Espo/Core/Acl/Map/Map.php b/application/Espo/Core/Acl/Map/Map.php index 389cee09e0..26de084f46 100644 --- a/application/Espo/Core/Acl/Map/Map.php +++ b/application/Espo/Core/Acl/Map/Map.php @@ -69,8 +69,7 @@ class Map $cachedData = $this->dataCache->get($this->cacheKey); $this->data = $cachedData; - } - else { + } else { $this->data = $this->dataBuilder->build($table); if ($this->config->get('useCache')) { diff --git a/application/Espo/Core/Acl/ScopeData.php b/application/Espo/Core/Acl/ScopeData.php index 9532d3ae80..3c7d05a152 100644 --- a/application/Espo/Core/Acl/ScopeData.php +++ b/application/Espo/Core/Acl/ScopeData.php @@ -170,11 +170,9 @@ class ScopeData throw new RuntimeException("Bad raw scope data."); } } - } - else if (is_bool($raw)) { + } else if (is_bool($raw)) { $obj->isBoolean = true; - } - else { + } else { throw new InvalidArgumentException(); } diff --git a/application/Espo/Core/Acl/Table/DefaultTable.php b/application/Espo/Core/Acl/Table/DefaultTable.php index febee30792..a14ad3da3b 100644 --- a/application/Espo/Core/Acl/Table/DefaultTable.php +++ b/application/Espo/Core/Acl/Table/DefaultTable.php @@ -374,8 +374,7 @@ class DefaultTable implements Table if ($f === true) { $level = self::LEVEL_YES; - } - else { + } else { if (is_array($f) && isset($f[$action])) { $level = $f[$action]; } @@ -471,8 +470,7 @@ class DefaultTable implements Table if ($item === true) { $level = self::LEVEL_YES; - } - else { + } else { if (is_array($item) && isset($item[$action])) { $level = $item[$action]; } @@ -654,8 +652,7 @@ class DefaultTable implements Table if (!isset($data->$scope->$action)) { $data->$scope->$action = $level; - } - else if ( + } else if ( array_search($data->$scope->$action, $this->levelList) > array_search($level, $this->levelList) ) { @@ -674,8 +671,7 @@ class DefaultTable implements Table if (in_array($action, $this->booleanActionList)) { $data->$scope->$action = self::LEVEL_YES; - } - else if ($action === self::ACTION_STREAM && isset($data->$scope->$previousAction)) { + } else if ($action === self::ACTION_STREAM && isset($data->$scope->$previousAction)) { $data->$scope->$action = $data->$scope->$previousAction; } } @@ -728,8 +724,7 @@ class DefaultTable implements Table if (!isset($data->$scope->$field->$action)) { $data->$scope->$field->$action = $level; - } - else { + } else { if ( array_search( $data->$scope->$field->$action, diff --git a/application/Espo/Core/AclManager.php b/application/Espo/Core/AclManager.php index c9ba29ab4b..0bc2a6b676 100644 --- a/application/Espo/Core/AclManager.php +++ b/application/Espo/Core/AclManager.php @@ -579,8 +579,7 @@ class AclManager if (is_object($target)) { $userId = $target->getId(); - } - else { + } else { $userId = $target; } diff --git a/application/Espo/Core/Authentication/Ldap/LdapLogin.php b/application/Espo/Core/Authentication/Ldap/LdapLogin.php index 4e731af8fd..0ba4017b7b 100644 --- a/application/Espo/Core/Authentication/Ldap/LdapLogin.php +++ b/application/Espo/Core/Authentication/Ldap/LdapLogin.php @@ -362,8 +362,7 @@ class LdapLogin implements Login $userFields = $this->loadFields('portalUser'); $userFields['type'] = 'portal'; - } - else { + } else { $userFields = $this->loadFields('user'); } diff --git a/application/Espo/Core/Console/Command/Params.php b/application/Espo/Core/Console/Command/Params.php index 9249d01cfe..4eb5e9d596 100644 --- a/application/Espo/Core/Console/Command/Params.php +++ b/application/Espo/Core/Console/Command/Params.php @@ -129,14 +129,11 @@ class Params $name = Util::hyphenToCamelCase($name); $options[$name] = $value; - } - else if (str_starts_with($item, '--')) { + } else if (str_starts_with($item, '--')) { $flagList[] = Util::hyphenToCamelCase(substr($item, 2)); - } - else if (str_starts_with($item, '-')) { + } else if (str_starts_with($item, '-')) { $flagList[] = substr($item, 1); - } - else if ($i > 0) { + } else if ($i > 0) { $argumentList[] = $item; } } diff --git a/application/Espo/Core/Console/Commands/Extension.php b/application/Espo/Core/Console/Commands/Extension.php index e8ed6b4566..191d40043b 100644 --- a/application/Espo/Core/Console/Commands/Extension.php +++ b/application/Espo/Core/Console/Commands/Extension.php @@ -184,8 +184,7 @@ class Extension implements Command } $name = $record->get('name'); - } - else { + } else { if (!$name) { $io->writeLine("Can't uninstall. No --name or --id specified."); $io->setExitStatus(1); diff --git a/application/Espo/Core/Console/Commands/Upgrade.php b/application/Espo/Core/Console/Commands/Upgrade.php index 4f99cdf2fb..2c4c6e9990 100644 --- a/application/Espo/Core/Console/Commands/Upgrade.php +++ b/application/Espo/Core/Console/Commands/Upgrade.php @@ -473,8 +473,7 @@ class Upgrade implements Command if (is_file($url)) { copy($url, $localFilePath); - } - else { + } else { $options = [ CURLOPT_FILE => fopen($localFilePath, 'w'), CURLOPT_TIMEOUT => 3600, diff --git a/application/Espo/Core/Field/DateTimeOptional.php b/application/Espo/Core/Field/DateTimeOptional.php index dc3f53b6a9..da014edd61 100644 --- a/application/Espo/Core/Field/DateTimeOptional.php +++ b/application/Espo/Core/Field/DateTimeOptional.php @@ -54,8 +54,7 @@ class DateTimeOptional implements DateTimeable { if (self::isStringDateTime($value)) { $this->dateTimeValue = new DateTime($value); - } - else { + } else { $this->dateValue = new Date($value); } } diff --git a/application/Espo/Core/FieldProcessing/EmailAddress/Saver.php b/application/Espo/Core/FieldProcessing/EmailAddress/Saver.php index ce1391b526..ad7a3c5724 100644 --- a/application/Espo/Core/FieldProcessing/EmailAddress/Saver.php +++ b/application/Espo/Core/FieldProcessing/EmailAddress/Saver.php @@ -278,8 +278,7 @@ class Saver implements SaverInterface ]); $this->entityManager->saveEntity($emailAddress); - } - else { + } else { $revertData[$address] = [ 'optOut' => $emailAddress->get('optOut'), 'invalid' => $emailAddress->get('invalid'), @@ -301,8 +300,7 @@ class Saver implements SaverInterface ]); $this->entityManager->saveEntity($emailAddress); - } - else { + } else { $skipSave = $this->checkChangeIsForbidden($emailAddress, $entity); if (!$skipSave) { @@ -319,8 +317,7 @@ class Saver implements SaverInterface $this->entityManager->saveEntity($emailAddress); } - } - else { + } else { $revertData[$address] = [ 'optOut' => $emailAddress->isOptedOut(), 'invalid' => $emailAddress->isInvalid(), diff --git a/application/Espo/Core/FieldProcessing/PhoneNumber/Saver.php b/application/Espo/Core/FieldProcessing/PhoneNumber/Saver.php index 12b1f3bb75..3ff74a69b1 100644 --- a/application/Espo/Core/FieldProcessing/PhoneNumber/Saver.php +++ b/application/Espo/Core/FieldProcessing/PhoneNumber/Saver.php @@ -280,8 +280,7 @@ class Saver implements SaverInterface ]); $this->entityManager->saveEntity($phoneNumber); - } - else { + } else { $revertData[$number] = [ 'type' => $phoneNumber->get('type'), 'optOut' => $phoneNumber->get('optOut'), @@ -322,8 +321,7 @@ class Saver implements SaverInterface $this->entityManager->saveEntity($phoneNumber); } - } - else { + } else { $revertData[$number] = [ 'type' => $phoneNumber->getType(), 'optOut' => $phoneNumber->isOptedOut(), diff --git a/application/Espo/Core/FieldProcessing/Relation/LinkMultipleSaver.php b/application/Espo/Core/FieldProcessing/Relation/LinkMultipleSaver.php index 2ef0102068..9e186e4c49 100644 --- a/application/Espo/Core/FieldProcessing/Relation/LinkMultipleSaver.php +++ b/application/Espo/Core/FieldProcessing/Relation/LinkMultipleSaver.php @@ -69,8 +69,7 @@ class LinkMultipleSaver if ($entity->has($idListAttribute)) { $specifiedIdList = $entity->get($idListAttribute); - } - else if ($entity->has($columnsAttribute)) { + } else if ($entity->has($columnsAttribute)) { $skipRemove = true; $specifiedIdList = array_keys( @@ -78,8 +77,7 @@ class LinkMultipleSaver $entity->get($columnsAttribute) ?? (object) [] ) ); - } - else { + } else { return; } diff --git a/application/Espo/Core/Formula/FunctionFactory.php b/application/Espo/Core/Formula/FunctionFactory.php index e10b80495d..67da19a099 100644 --- a/application/Espo/Core/Formula/FunctionFactory.php +++ b/application/Espo/Core/Formula/FunctionFactory.php @@ -66,8 +66,7 @@ class FunctionFactory if ($this->classNameMap && array_key_exists($name, $this->classNameMap)) { $className = $this->classNameMap[$name]; - } - else { + } else { $arr = explode('\\', $name); foreach ($arr as $i => $part) { diff --git a/application/Espo/Core/Formula/Functions/DatetimeGroup/AddIntervalType.php b/application/Espo/Core/Formula/Functions/DatetimeGroup/AddIntervalType.php index fdd08b2fe4..6bcd17b540 100644 --- a/application/Espo/Core/Formula/Functions/DatetimeGroup/AddIntervalType.php +++ b/application/Espo/Core/Formula/Functions/DatetimeGroup/AddIntervalType.php @@ -88,8 +88,7 @@ abstract class AddIntervalType extends BaseFunction implements Di\DateTimeAware try { $dateTime = new DateTime($dateTimeString); - } - catch (Exception $e) { + } catch (Exception) { $this->log('bad date-time value passed', 'warning'); return null; @@ -101,8 +100,7 @@ abstract class AddIntervalType extends BaseFunction implements Di\DateTimeAware if ($isTime) { return $dateTime->format(DateTimeUtil::SYSTEM_DATE_TIME_FORMAT); - } - else { + } else { return $dateTime->format(DateTimeUtil::SYSTEM_DATE_FORMAT); } } diff --git a/application/Espo/Core/Formula/Functions/DatetimeGroup/ClosestType.php b/application/Espo/Core/Formula/Functions/DatetimeGroup/ClosestType.php index 3f649bdf5f..44b16fbbce 100644 --- a/application/Espo/Core/Formula/Functions/DatetimeGroup/ClosestType.php +++ b/application/Espo/Core/Formula/Functions/DatetimeGroup/ClosestType.php @@ -127,8 +127,7 @@ class ClosestType extends BaseFunction implements Di\ConfigAware $dt->modify('+1 day'); } } - } - else if ($type === 'hour') { + } else if ($type === 'hour') { $target = intval($target); $dt->setTime($target, 0, 0); @@ -136,14 +135,12 @@ class ClosestType extends BaseFunction implements Di\ConfigAware if ($inPast) { $dt->modify('-1 day'); } - } - else if ($valueTimestamp > $dt->getTimestamp()) { + } else if ($valueTimestamp > $dt->getTimestamp()) { if (!$inPast) { $dt->modify('+1 day'); } } - } - else if ($type === 'minute') { + } else if ($type === 'minute') { $target = intval($target); $dt->setTime(intval($dt->format('G')), intval($target), 0); @@ -152,14 +149,12 @@ class ClosestType extends BaseFunction implements Di\ConfigAware if ($inPast) { $dt->modify('-1 hour'); } - } - else if ($valueTimestamp > $dt->getTimestamp()) { + } else if ($valueTimestamp > $dt->getTimestamp()) { if (!$inPast) { $dt->modify('+1 hour'); } } - } - else if ($type === 'dayOfWeek') { + } else if ($type === 'dayOfWeek') { $target = intval($target); $dt->setTime(0, 0, 0); @@ -171,14 +166,12 @@ class ClosestType extends BaseFunction implements Di\ConfigAware if ($inPast) { $dt->modify('-1 week'); } - } - else if ($valueTimestamp > $dt->getTimestamp()) { + } else if ($valueTimestamp > $dt->getTimestamp()) { if (!$inPast) { $dt->modify('+1 week'); } } - } - else if ($type === 'date') { + } else if ($type === 'date') { $target = intval($target); $dt->setTime(0, 0, 0); @@ -192,8 +185,7 @@ class ClosestType extends BaseFunction implements Di\ConfigAware $dt->modify('-1 day'); } - } - else { + } else { if ($valueTimestamp > $dt->getTimestamp()) { $dt->modify('+1 day'); } @@ -208,8 +200,7 @@ class ClosestType extends BaseFunction implements Di\ConfigAware $dt->modify('+1 day'); } } - } - else if ($type === 'month') { + } else if ($type === 'month') { $target = intval($target); $dt->setTime(0, 0, 0); @@ -226,8 +217,7 @@ class ClosestType extends BaseFunction implements Di\ConfigAware $dt->modify('-1 month'); } - } - else { + } else { if ($valueTimestamp > $dt->getTimestamp()) { $dt->modify('+1 month'); } diff --git a/application/Espo/Core/Formula/Functions/EntityGroup/SumRelatedType.php b/application/Espo/Core/Formula/Functions/EntityGroup/SumRelatedType.php index 8c6b010062..b03347ef3b 100644 --- a/application/Espo/Core/Formula/Functions/EntityGroup/SumRelatedType.php +++ b/application/Espo/Core/Formula/Functions/EntityGroup/SumRelatedType.php @@ -118,8 +118,7 @@ class SumRelatedType extends \Espo\Core\Formula\Functions\Base implements ->where([ $foreignLink . 'Type' => $entity->getEntityType(), ]); - } - else { + } else { $queryBuilder->join($foreignLink, $foreignLinkAlias); } diff --git a/application/Espo/Core/Formula/Functions/OutputGroup/PrintLineType.php b/application/Espo/Core/Formula/Functions/OutputGroup/PrintLineType.php index bdf61e036e..3cce8c231b 100644 --- a/application/Espo/Core/Formula/Functions/OutputGroup/PrintLineType.php +++ b/application/Espo/Core/Formula/Functions/OutputGroup/PrintLineType.php @@ -46,17 +46,13 @@ class PrintLineType extends BaseFunction if (is_int($value) || is_float($value)) { $value = strval($value); - } - else if (is_bool($value)) { + } else if (is_bool($value)) { $value = $value ? 'true' : 'false'; - } - else if (is_array($value)) { + } else if (is_array($value)) { $value = json_encode($value); - } - else if ($value instanceof stdClass) { + } else if ($value instanceof stdClass) { $value = json_encode($value); - } - else if ($value === null) { + } else if ($value === null) { $value = 'null'; } diff --git a/application/Espo/Core/Formula/Functions/OutputGroup/PrintType.php b/application/Espo/Core/Formula/Functions/OutputGroup/PrintType.php index 6009d74674..cc387c1b35 100644 --- a/application/Espo/Core/Formula/Functions/OutputGroup/PrintType.php +++ b/application/Espo/Core/Formula/Functions/OutputGroup/PrintType.php @@ -46,17 +46,13 @@ class PrintType extends BaseFunction if (is_int($value) || is_float($value)) { $value = strval($value); - } - else if (is_bool($value)) { + } else if (is_bool($value)) { $value = $value ? 'true' : 'false'; - } - else if (is_array($value)) { + } else if (is_array($value)) { $value = json_encode($value); - } - else if ($value instanceof stdClass) { + } else if ($value instanceof stdClass) { $value = json_encode($value); - } - else if ($value === null) { + } else if ($value === null) { $value = 'null'; } diff --git a/application/Espo/Core/Formula/Functions/RecordGroup/FindManyType.php b/application/Espo/Core/Formula/Functions/RecordGroup/FindManyType.php index 9ea7a39f51..b7a9eba11b 100644 --- a/application/Espo/Core/Formula/Functions/RecordGroup/FindManyType.php +++ b/application/Espo/Core/Formula/Functions/RecordGroup/FindManyType.php @@ -99,8 +99,7 @@ class FindManyType implements Func if ($filter) { $builder->withPrimaryFilter($filter); } - } - else { + } else { $i = 4; while ($i < count($arguments) - 1) { @@ -115,8 +114,7 @@ class FindManyType implements Func try { $queryBuilder = $builder->buildQueryBuilder(); - } - catch (BadRequest|Forbidden $e) { + } catch (BadRequest|Forbidden $e) { throw new FormulaError($e->getMessage(), $e->getCode(), $e); } diff --git a/application/Espo/Core/Formula/Functions/RecordGroup/FindOneType.php b/application/Espo/Core/Formula/Functions/RecordGroup/FindOneType.php index 5338dcf05a..fe9ff61da1 100644 --- a/application/Espo/Core/Formula/Functions/RecordGroup/FindOneType.php +++ b/application/Espo/Core/Formula/Functions/RecordGroup/FindOneType.php @@ -73,8 +73,7 @@ class FindOneType extends BaseFunction implements if ($filter) { $builder->withPrimaryFilter($filter); } - } - else { + } else { $i = 3; while ($i < count($args) - 1) { @@ -89,8 +88,7 @@ class FindOneType extends BaseFunction implements try { $queryBuilder = $builder->buildQueryBuilder(); - } - catch (BadRequest|Forbidden $e) { + } catch (BadRequest|Forbidden $e) { throw new FormulaError($e->getMessage(), $e->getCode(), $e); } diff --git a/application/Espo/Core/Formula/Functions/RecordGroup/FindRelatedManyType.php b/application/Espo/Core/Formula/Functions/RecordGroup/FindRelatedManyType.php index 2ad0f6f2aa..3150893bd0 100644 --- a/application/Espo/Core/Formula/Functions/RecordGroup/FindRelatedManyType.php +++ b/application/Espo/Core/Formula/Functions/RecordGroup/FindRelatedManyType.php @@ -110,8 +110,7 @@ class FindRelatedManyType extends BaseFunction implements if (is_null($order)) { $order = $metadata->get(['entityDefs', $entityType, 'collection', 'order']) ?? 'asc'; } - } - else { + } else { $order = $order ?? 'asc'; } @@ -156,8 +155,7 @@ class FindRelatedManyType extends BaseFunction implements if ($filter) { $builder->withPrimaryFilter($filter); } - } - else { + } else { $i = 6; while ($i < count($args) - 1) { @@ -181,8 +179,7 @@ class FindRelatedManyType extends BaseFunction implements $foreignLink . 'Id' => $entity->getId(), $foreignLink . 'Type' => $entity->getEntityType(), ]); - } - else { + } else { $alias = $foreignLink . $this->generateRandomString(); $queryBuilder diff --git a/application/Espo/Core/Formula/Functions/RecordGroup/FindRelatedOneType.php b/application/Espo/Core/Formula/Functions/RecordGroup/FindRelatedOneType.php index 4e6a667f2d..6be8433735 100644 --- a/application/Espo/Core/Formula/Functions/RecordGroup/FindRelatedOneType.php +++ b/application/Espo/Core/Formula/Functions/RecordGroup/FindRelatedOneType.php @@ -116,8 +116,7 @@ class FindRelatedOneType extends BaseFunction implements if (is_null($order)) { $order = $metadata->get(['entityDefs', $entityType, 'collection', 'order']) ?? 'ASC'; } - } - else { + } else { $order = $order ?? 'ASC'; } @@ -177,8 +176,7 @@ class FindRelatedOneType extends BaseFunction implements $foreignLink . 'Id' => $entity->getId(), $foreignLink . 'Type' => $entity->getEntityType(), ]); - } - else { + } else { $queryBuilder ->join($foreignLink) ->where([ diff --git a/application/Espo/Core/Formula/Parser.php b/application/Espo/Core/Formula/Parser.php index 652656012a..65ed7814ae 100644 --- a/application/Espo/Core/Formula/Parser.php +++ b/application/Espo/Core/Formula/Parser.php @@ -180,18 +180,15 @@ class Parser $isString = true; $isStringStart = true; $isSingleQuote = true; - } - else if ($isSingleQuote) { + } else if ($isSingleQuote) { $isString = false; } - } - else if ($string[$i] === "\"" && self::isNotAfterBackslash($string, $i)) { + } else if ($string[$i] === "\"" && self::isNotAfterBackslash($string, $i)) { if (!$isString) { $isString = true; $isStringStart = true; $isSingleQuote = false; - } - else if (!$isSingleQuote) { + } else if (!$isSingleQuote) { $isString = false; } } @@ -200,8 +197,7 @@ class Parser if ($isString) { if (in_array($char, ['(', ')', '{', '}'])) { $modifiedString[$i] = '_'; - } - else if (!$isStringStart) { + } else if (!$isStringStart) { $modifiedString[$i] = ' '; } @@ -809,14 +805,11 @@ class Parser if ($value === '(') { $parenthesisCounter++; - } - else if ($value === ')') { + } else if ($value === ')') { $parenthesisCounter--; - } - else if ($value === '{') { + } else if ($value === '{') { $braceCounter++; - } - else if ($value === '}') { + } else if ($value === '}') { $braceCounter--; } @@ -1115,8 +1108,7 @@ class Parser $part = self::sliceByStartEnd($expression, $start, $end); $parsedPart = $this->split($part); - } - else if ($statement instanceof IfRef) { + } else if ($statement instanceof IfRef) { if (!$isRoot || !$statement->isReady()) { throw SyntaxError::create( 'Incorrect if statement usage in expression ' . $expression . '.', @@ -1155,8 +1147,7 @@ class Parser $this->split($conditionPart), $this->split($thenPart, true) ]); - } - else if ($statement instanceof WhileRef) { + } else if ($statement instanceof WhileRef) { if (!$isRoot || !$statement->isReady()) { throw SyntaxError::create( 'Incorrect while statement usage in expression ' . $expression . '.', @@ -1237,19 +1228,16 @@ class Parser if (!$isString) { $isString = true; $isSingleQuote = true; - } - else { + } else { if ($isSingleQuote) { $isString = false; } } - } - else if ($functionContent[$i] === "\"" && self::isNotAfterBackslash($functionContent, $i)) { + } else if ($functionContent[$i] === "\"" && self::isNotAfterBackslash($functionContent, $i)) { if (!$isString) { $isString = true; $isSingleQuote = false; - } - else { + } else { if (!$isSingleQuote) { $isString = false; } @@ -1259,8 +1247,7 @@ class Parser if (!$isString) { if ($functionContent[$i] === '(') { $braceCounter++; - } - else if ($functionContent[$i] === ')') { + } else if ($functionContent[$i] === ')') { $braceCounter--; } } @@ -1277,8 +1264,7 @@ class Parser for ($i = 0; $i < count($commaIndexList); $i++) { if ($i > 0) { $previousCommaIndex = $commaIndexList[$i - 1] + 1; - } - else { + } else { $previousCommaIndex = 0; } diff --git a/application/Espo/Core/Htmlizer/Htmlizer.php b/application/Espo/Core/Htmlizer/Htmlizer.php index 524b567c4a..f4209e8dec 100644 --- a/application/Espo/Core/Htmlizer/Htmlizer.php +++ b/application/Espo/Core/Htmlizer/Htmlizer.php @@ -304,14 +304,12 @@ class Htmlizer $data[$attribute . '_RAW'] = $data[$attribute]; $data[$attribute] = $this->dateTime->convertSystemDateTime($data[$attribute]); } - } - else if ($type == Entity::DATE) { + } else if ($type == Entity::DATE) { if (!empty($data[$attribute])) { $data[$attribute . '_RAW'] = $data[$attribute]; $data[$attribute] = $this->dateTime->convertSystemDate($data[$attribute]); } - } - else if ($type == Entity::JSON_ARRAY) { + } else if ($type == Entity::JSON_ARRAY) { if (!empty($data[$attribute])) { $list = $data[$attribute]; @@ -339,8 +337,7 @@ class Htmlizer } $data[$attribute] = $newList; } - } - else if ($type == Entity::JSON_OBJECT) { + } else if ($type == Entity::JSON_OBJECT) { if (!empty($data[$attribute])) { $value = $data[$attribute]; @@ -358,8 +355,7 @@ class Htmlizer $data[$attribute][$k] = $this->format($data[$attribute][$k]); } } - } - else if ($type === Entity::PASSWORD) { + } else if ($type === Entity::PASSWORD) { unset($data[$attribute]); } @@ -619,8 +615,7 @@ class Htmlizer if ($field) { $id = $context['_this'][$field . 'Id'] ?? null; - } - else if (count($args) > 1) { + } else if (count($args) > 1) { $id = $args[0]; } diff --git a/application/Espo/Core/Job/JobRunner.php b/application/Espo/Core/Job/JobRunner.php index 6f1e57cd4e..add20aee10 100644 --- a/application/Espo/Core/Job/JobRunner.php +++ b/application/Espo/Core/Job/JobRunner.php @@ -115,23 +115,18 @@ class JobRunner try { if ($jobEntity->getScheduledJobId()) { $this->runScheduledJob($jobEntity); - } - else if ($jobEntity->getJob()) { + } else if ($jobEntity->getJob()) { $this->runJobNamed($jobEntity); - } - else if ($jobEntity->getClassName()) { + } else if ($jobEntity->getClassName()) { $this->runJobWithClassName($jobEntity); - } - else if ($jobEntity->getServiceName()) { + } else if ($jobEntity->getServiceName()) { $this->runService($jobEntity); - } - else { + } else { $id = $jobEntity->getId(); throw new RuntimeException("Not runnable job '$id'."); } - } - catch (Throwable $e) { + } catch (Throwable $e) { $isSuccess = false; $jobId = $jobEntity->hasId() ? $jobEntity->getId() : null; diff --git a/application/Espo/Core/Log/DefaultHandlerLoader.php b/application/Espo/Core/Log/DefaultHandlerLoader.php index 6bf4fe8fe8..6ce75bb2c8 100644 --- a/application/Espo/Core/Log/DefaultHandlerLoader.php +++ b/application/Espo/Core/Log/DefaultHandlerLoader.php @@ -129,8 +129,7 @@ class DefaultHandlerLoader if (array_key_exists($name, $params)) { $value = $params[$name]; - } - else if ($parameter->isDefaultValueAvailable()) { + } else if ($parameter->isDefaultValueAvailable()) { $value = $parameter->getDefaultValue(); } else { continue; diff --git a/application/Espo/Core/Log/LogLoader.php b/application/Espo/Core/Log/LogLoader.php index 281d9c0378..dc9b33ea10 100644 --- a/application/Espo/Core/Log/LogLoader.php +++ b/application/Espo/Core/Log/LogLoader.php @@ -65,8 +65,7 @@ class LogLoader $level = $this->config->get('logger.level'); $handlerList = $this->handlerListLoader->load($handlerDataList, $level); - } - else { + } else { $handlerList = [$this->createDefaultHandler()]; } @@ -98,8 +97,7 @@ class LogLoader $maxFileNumber = $this->config->get('logger.maxFileNumber') ?? self::MAX_FILE_NUMBER; $handler = new EspoRotatingFileHandler($this->config, $path, $maxFileNumber, $levelCode, true); - } - else { + } else { $handler = new EspoFileHandler($this->config, $path, $levelCode, true); } diff --git a/application/Espo/Core/Mail/Account/GroupAccount/Hooks/AfterFetch.php b/application/Espo/Core/Mail/Account/GroupAccount/Hooks/AfterFetch.php index 59b51b2014..52398b9530 100644 --- a/application/Espo/Core/Mail/Account/GroupAccount/Hooks/AfterFetch.php +++ b/application/Espo/Core/Mail/Account/GroupAccount/Hooks/AfterFetch.php @@ -103,8 +103,7 @@ class AfterFetch implements AfterFetchInterface if ($email->isFetched()) { $emailToProcess = $this->entityManager->getEntity(Email::ENTITY_TYPE, $email->getId()); - } - else { + } else { $emailToProcess->updateFetchedValues(); } @@ -410,8 +409,7 @@ class AfterFetch implements AfterFetchInterface if ($case->hasLinkMultipleField('assignedUsers')) { $userIdList = $case->getLinkMultipleIdList('assignedUsers'); - } - else { + } else { $assignedUserLink = $case->getAssignedUser(); if ($assignedUserLink) { @@ -569,8 +567,7 @@ class AfterFetch implements AfterFetchInterface if ($contact) { $case->set('contactId', $contact->getId()); - } - else { + } else { if (!$case->get('accountId')) { $lead = $this->entityManager ->getRDBRepository(Lead::ENTITY_TYPE) diff --git a/application/Espo/Core/Mail/Importer/DefaultImporter.php b/application/Espo/Core/Mail/Importer/DefaultImporter.php index 0e1c29f2a3..26625b7ee5 100644 --- a/application/Espo/Core/Mail/Importer/DefaultImporter.php +++ b/application/Espo/Core/Mail/Importer/DefaultImporter.php @@ -266,8 +266,7 @@ class DefaultImporter implements Importer $email->setGroupFolderId($groupEmailFolderId); } - } - else { + } else { $email->setBody('Not fetched. The email size exceeds the limit.'); $email->setIsHtml(false); } diff --git a/application/Espo/Core/Mail/MessageWrapper.php b/application/Espo/Core/Mail/MessageWrapper.php index 2b6c4a7f14..d8664086f3 100644 --- a/application/Espo/Core/Mail/MessageWrapper.php +++ b/application/Espo/Core/Mail/MessageWrapper.php @@ -64,8 +64,7 @@ class MessageWrapper implements Message if (str_contains($this->fullRawContent, "\r\n\r\n")) { [$rawHeader, $rawBody] = explode("\r\n\r\n", $this->fullRawContent, 2); - } - else if (str_contains($this->fullRawContent, "\n\n")) { + } else if (str_contains($this->fullRawContent, "\n\n")) { [$rawHeader, $rawBody] = explode("\n\n", $this->fullRawContent, 2); } diff --git a/application/Espo/Core/Mail/Parsers/MailMimeParser.php b/application/Espo/Core/Mail/Parsers/MailMimeParser.php index 26ea9febf9..b1eb668949 100644 --- a/application/Espo/Core/Mail/Parsers/MailMimeParser.php +++ b/application/Espo/Core/Mail/Parsers/MailMimeParser.php @@ -275,8 +275,7 @@ class MailMimeParser implements Parser if ($bodyPlain) { $email->setBodyPlain($bodyPlain); } - } - else { + } else { $email->setIsHtml(false); $email->setBody($bodyPlain); $email->setBodyPlain($bodyPlain); @@ -334,8 +333,7 @@ class MailMimeParser implements Parser if ($disposition === self::DISPOSITION_INLINE) { $attachment->setRole(Attachment::ROLE_INLINE_ATTACHMENT); $attachment->setTargetField(self::FIELD_BODY); - } - else { + } else { $attachment->setRole(Attachment::ROLE_ATTACHMENT); $attachment->setTargetField(self::FIELD_ATTACHMENTS); } diff --git a/application/Espo/Core/Mail/Sender.php b/application/Espo/Core/Mail/Sender.php index 9afe7f80bd..dc6dc655d4 100644 --- a/application/Espo/Core/Mail/Sender.php +++ b/application/Espo/Core/Mail/Sender.php @@ -113,8 +113,7 @@ class Sender { if ($params instanceof SenderParams) { $params = $params->toArray(); - } - else if (!is_array($params)) { + } else if (!is_array($params)) { throw new InvalidArgumentException(); } @@ -145,8 +144,7 @@ class Sender { if ($params instanceof SmtpParams) { $params = $params->toArray(); - } - else if (!is_array($params)) { + } else if (!is_array($params)) { throw new InvalidArgumentException(); } @@ -260,12 +258,10 @@ class Sender /** @noinspection SpellCheckingInspection */ if (in_array($authMechanism, ['login', 'crammd5', 'plain'])) { $options['connectionClass'] = $authMechanism; - } - else { + } else { $options['connectionClass'] = 'login'; } - } - else { + } else { $options['connectionClass'] = 'login'; } @@ -373,8 +369,7 @@ class Sender if ($fromAddress) { $fromAddress = trim($fromAddress); - } - else { + } else { if (empty($params['fromAddress']) && !$config->get('outboundEmailFromAddress')) { throw new NoSmtp('outboundEmailFromAddress is not specified in config.'); } @@ -531,14 +526,12 @@ class Sender foreach ($attachmentPartList as $attachmentPart) { $body->addPart($attachmentPart); } - } - else { + } else { if ($email->isHtml()) { $body->setParts([$textPart, $htmlPart]); $messageType = 'multipart/alternative'; - } - else { + } else { $body = $email->getBodyPlainForSending(); $messageType = 'text/plain'; @@ -553,8 +546,7 @@ class Sender } $message->getHeaders()->addHeaderLine('Content-Type', 'text/plain; charset=UTF-8'); - } - else { + } else { if (!$message->getHeaders()->has('content-type')) { $contentTypeHeader = new ContentTypeHeader(); @@ -583,8 +575,7 @@ class Sender if ($email->hasId()) { $this->entityManager->saveEntity($email, [SaveOption::SILENT => true]); } - } - else { + } else { $messageId = substr($messageId, 1, strlen($messageId) - 2); } diff --git a/application/Espo/Core/MassAction/Params.php b/application/Espo/Core/MassAction/Params.php index 72e8d7cdce..562d4ba22b 100644 --- a/application/Espo/Core/MassAction/Params.php +++ b/application/Espo/Core/MassAction/Params.php @@ -150,15 +150,13 @@ class Params if ($ids !== null) { throw new RuntimeException("Can't combine 'ids' and search params."); } - } - else if ($ids !== null) { + } else if ($ids !== null) { if (!is_array($ids)) { throw new RuntimeException("Bad 'ids'."); } $obj->ids = $ids; - } - else { + } else { throw new RuntimeException("Bad mass action params."); } diff --git a/application/Espo/Core/Record/SearchParamsFetcher.php b/application/Espo/Core/Record/SearchParamsFetcher.php index 84564c60fe..8a66e9dc7e 100644 --- a/application/Espo/Core/Record/SearchParamsFetcher.php +++ b/application/Espo/Core/Record/SearchParamsFetcher.php @@ -129,16 +129,14 @@ class SearchParamsFetcher if ($request->getQueryParam('orderBy')) { $params['orderBy'] = $request->getQueryParam('orderBy'); - } - else if ($request->getQueryParam('sortBy')) { + } else if ($request->getQueryParam('sortBy')) { // legacy $params['orderBy'] = $request->getQueryParam('sortBy'); } if ($request->getQueryParam('order')) { $params['order'] = strtoupper($request->getQueryParam('order')); - } - else if ($request->getQueryParam('asc')) { + } else if ($request->getQueryParam('asc')) { // legacy $params['order'] = $request->getQueryParam('asc') === 'true' ? SearchParams::ORDER_ASC : SearchParams::ORDER_DESC; diff --git a/application/Espo/Core/Record/Service.php b/application/Espo/Core/Record/Service.php index 265eaf4d9a..e368953a31 100644 --- a/application/Espo/Core/Record/Service.php +++ b/application/Espo/Core/Record/Service.php @@ -1225,8 +1225,7 @@ class Service implements Crud, if (!$skipAcl) { $selectBuilder->withStrictAccessControl(); - } - else { + } else { $selectBuilder->withComplexExpressionsForbidden(); $selectBuilder->withWherePermissionCheck(); } diff --git a/application/Espo/Core/Repositories/Database.php b/application/Espo/Core/Repositories/Database.php index b840119585..bb9d421136 100644 --- a/application/Espo/Core/Repositories/Database.php +++ b/application/Espo/Core/Repositories/Database.php @@ -389,8 +389,7 @@ class Database extends RDBRepository if ($modifiedById) { $entity->set(self::ATTR_MODIFIED_BY_ID, $modifiedById); - } - else if ($this->applicationState->hasUser()) { + } else if ($this->applicationState->hasUser()) { $user = $this->applicationState->getUser(); $entity->set(self::ATTR_MODIFIED_BY_ID, $user->getId()); @@ -428,8 +427,7 @@ class Database extends RDBRepository } $entity->set(self::ATTR_CREATED_BY_ID, $createdById); - } - else if ( + } else if ( empty($options[SaveOption::SKIP_CREATED_BY]) && (empty($options[SaveOption::IMPORT]) || !$entity->has(self::ATTR_CREATED_BY_ID)) && $this->applicationState->hasUser() diff --git a/application/Espo/Core/Repositories/Event.php b/application/Espo/Core/Repositories/Event.php index ad4aae5821..ea638d44da 100644 --- a/application/Espo/Core/Repositories/Event.php +++ b/application/Espo/Core/Repositories/Event.php @@ -73,8 +73,7 @@ class Event extends Database implements $dateStart = $this->convertDateTimeToDefaultTimezone($dateStart); $entity->set('dateStart', $dateStart); - } - else { + } else { /** @noinspection PhpRedundantOptionalArgumentInspection */ $entity->set('dateStartDate', null); } @@ -96,8 +95,7 @@ class Event extends Database implements $dateEnd = $dt->format(DateTimeUtil::SYSTEM_DATE_TIME_FORMAT); $entity->set('dateEnd', $dateEnd); - } - else { + } else { /** @noinspection PhpRedundantOptionalArgumentInspection */ $entity->set('dateEndDate', null); } diff --git a/application/Espo/Core/Select/AccessControl/Filters/OnlyTeam.php b/application/Espo/Core/Select/AccessControl/Filters/OnlyTeam.php index 142ec330d7..1598ceb89d 100644 --- a/application/Espo/Core/Select/AccessControl/Filters/OnlyTeam.php +++ b/application/Espo/Core/Select/AccessControl/Filters/OnlyTeam.php @@ -80,11 +80,9 @@ class OnlyTeam implements Filter ]); $orGroup["assignedUsersMiddle.$key2"] = $this->user->getId(); - } - else if ($this->fieldHelper->hasAssignedUserField()) { + } else if ($this->fieldHelper->hasAssignedUserField()) { $orGroup['assignedUserId'] = $this->user->getId(); - } - else if ($this->fieldHelper->hasCreatedByField()) { + } else if ($this->fieldHelper->hasCreatedByField()) { $orGroup['createdById'] = $this->user->getId(); } diff --git a/application/Espo/Core/Select/Order/Applier.php b/application/Espo/Core/Select/Order/Applier.php index 8ffb52f4f0..b918853776 100644 --- a/application/Espo/Core/Select/Order/Applier.php +++ b/application/Espo/Core/Select/Order/Applier.php @@ -106,11 +106,9 @@ class Applier if ($order && strtolower($order) === 'desc') { $order = SearchParams::ORDER_DESC; - } - else if ($order && strtolower($order) === 'asc') { + } else if ($order && strtolower($order) === 'asc') { $order = SearchParams::ORDER_ASC; - } - else if ($order !== null) { + } else if ($order !== null) { throw new RuntimeException("Bad default order."); } } @@ -165,14 +163,11 @@ class Applier OrderItem::create($orderBy, $order) ) ); - } - else if (in_array($type, ['link', 'file', 'image', 'linkOne'])) { + } else if (in_array($type, ['link', 'file', 'image', 'linkOne'])) { $resultOrderBy .= 'Name'; - } - else if ($type === 'linkParent') { + } else if ($type === 'linkParent') { $resultOrderBy .= 'Type'; - } - else if ( + } else if ( /*!str_contains($orderBy, '.') && !str_contains($orderBy, ':') &&*/ !$this->metadataProvider->hasAttribute($this->entityType, $orderBy) diff --git a/application/Espo/Core/Select/SearchParams.php b/application/Espo/Core/Select/SearchParams.php index ba2f10b64b..196653f4f4 100644 --- a/application/Espo/Core/Select/SearchParams.php +++ b/application/Espo/Core/Select/SearchParams.php @@ -515,13 +515,11 @@ class SearchParams $params['boolFilterList'] = $value; unset($where[$i]); - } - else if ($type === 'textFilter') { + } else if ($type === 'textFilter') { $params['textFilter'] = $value; unset($where[$i]); - } - else if ($type == 'primary' && $value) { + } else if ($type == 'primary' && $value) { $params['primaryFilter'] = $value; unset($where[$i]); diff --git a/application/Espo/Core/Select/SelectBuilder.php b/application/Espo/Core/Select/SelectBuilder.php index 19b503e6c5..2653f3d326 100644 --- a/application/Espo/Core/Select/SelectBuilder.php +++ b/application/Espo/Core/Select/SelectBuilder.php @@ -137,8 +137,7 @@ class SelectBuilder if ($this->sourceQuery) { $this->queryBuilder->clone($this->sourceQuery); - } - else { + } else { $this->queryBuilder->from($this->entityType); } diff --git a/application/Espo/Core/Select/SelectManagerFactory.php b/application/Espo/Core/Select/SelectManagerFactory.php index d75ee6373c..5a82409bea 100644 --- a/application/Espo/Core/Select/SelectManagerFactory.php +++ b/application/Espo/Core/Select/SelectManagerFactory.php @@ -86,8 +86,7 @@ class SelectManagerFactory if ($user) { $acl = $this->aclManagerProvider->get($user)->createUserAcl($user); - } - else { + } else { $acl = $this->acl; $user = $this->user; } diff --git a/application/Espo/Core/Select/Text/Applier.php b/application/Espo/Core/Select/Text/Applier.php index 9e6bd0aa70..d4994ec006 100644 --- a/application/Espo/Core/Select/Text/Applier.php +++ b/application/Espo/Core/Select/Text/Applier.php @@ -123,8 +123,7 @@ class Applier $queryBuilder->order([ OrderExpr::create($expression)->withDesc() ]); - } - else if ($orderType === self::FT_ORDER_COMBINED) { + } else if ($orderType === self::FT_ORDER_COMBINED) { $orderExpression = Expr::round( Expr::divide($expression, $this->fullTextOrderRelevanceDivider) diff --git a/application/Espo/Core/Select/Where/DefaultDateTimeItemTransformer.php b/application/Espo/Core/Select/Where/DefaultDateTimeItemTransformer.php index 14d8bb7aca..b77235a2be 100644 --- a/application/Espo/Core/Select/Where/DefaultDateTimeItemTransformer.php +++ b/application/Espo/Core/Select/Where/DefaultDateTimeItemTransformer.php @@ -326,8 +326,7 @@ class DefaultDateTimeItemTransformer implements DateTimeItemTransformer if ($type == Type::LAST_MONTH) { $dtFrom->modify('-1 month'); - } - else if ($type == Type::NEXT_MONTH) { + } else if ($type == Type::NEXT_MONTH) { $dtFrom->modify('+1 month'); } diff --git a/application/Espo/Core/Select/Where/Item.php b/application/Espo/Core/Select/Where/Item.php index 97aa91ba9f..1c1dade6fc 100644 --- a/application/Espo/Core/Select/Where/Item.php +++ b/application/Espo/Core/Select/Where/Item.php @@ -87,8 +87,7 @@ class Item $obj->data = Data\DateTime ::create() ->withTimeZone($params['timeZone'] ?? null); - } - else if ($params['date'] ?? null) { + } else if ($params['date'] ?? null) { $obj->data = Data\Date ::create() ->withTimeZone($params['timeZone'] ?? null); diff --git a/application/Espo/Core/Utils/ClientManager.php b/application/Espo/Core/Utils/ClientManager.php index 96b598ac26..18cdfa3d19 100644 --- a/application/Espo/Core/Utils/ClientManager.php +++ b/application/Espo/Core/Utils/ClientManager.php @@ -162,8 +162,7 @@ class ClientManager if ($this->isDeveloperMode()) { $useCache = $this->useCacheInDeveloperMode(); $loaderCacheTimestamp = null; - } - else { + } else { $useCache = $this->useCache(); $loaderCacheTimestamp = $appTimestamp; } diff --git a/application/Espo/Core/Utils/Config/ConfigWriterFileManager.php b/application/Espo/Core/Utils/Config/ConfigWriterFileManager.php index 867ae30fa3..6057c860a6 100644 --- a/application/Espo/Core/Utils/Config/ConfigWriterFileManager.php +++ b/application/Espo/Core/Utils/Config/ConfigWriterFileManager.php @@ -52,8 +52,7 @@ class ConfigWriterFileManager if ($defaultPermissions) { $defaultPermissionsToSet = $defaultPermissions; - } - else if ($config) { + } else if ($config) { $defaultPermissionsToSet = $config->get('defaultPermissions'); } diff --git a/application/Espo/Core/Utils/DataUtil.php b/application/Espo/Core/Utils/DataUtil.php index 1a8219cbb5..c6185046dd 100644 --- a/application/Espo/Core/Utils/DataUtil.php +++ b/application/Espo/Core/Utils/DataUtil.php @@ -48,19 +48,16 @@ class DataUtil if (is_string($unsetList)) { $unsetList = [$unsetList]; - } - else if (!is_array($unsetList)) { + } else if (!is_array($unsetList)) { throw new InvalidArgumentException(); } foreach ($unsetList as $unsetItem) { if (is_array($unsetItem)) { $arr = $unsetItem; - } - else if (is_string($unsetItem)) { + } else if (is_string($unsetItem)) { $arr = explode('.', $unsetItem); - } - else { + } else { throw new LogicException('Bad unset parameter'); } @@ -107,8 +104,7 @@ class DataUtil if (is_array($pointer)) { $pointer = &$pointer[$key]; - } - else if (is_object($pointer)) { + } else if (is_object($pointer)) { $pointer = &$pointer->$key; } @@ -134,8 +130,7 @@ class DataUtil unset($data->$key); } } - } - else if (is_array($data)) { + } else if (is_array($data)) { $doReindex = false; foreach ($data as $key => $value) { @@ -184,8 +179,7 @@ class DataUtil foreach (get_object_vars($overrideData) as $key => $value) { if (isset($data->$key)) { $data->$key = self::merge($data->$key, $overrideData->$key); - } - else { + } else { $data->$key = $overrideData->$key; self::unsetByValue($data->$key, $appendIdentifier); } diff --git a/application/Espo/Core/Utils/Database/Orm/Converter.php b/application/Espo/Core/Utils/Database/Orm/Converter.php index ff127d4655..6cc9e869eb 100644 --- a/application/Espo/Core/Utils/Database/Orm/Converter.php +++ b/application/Espo/Core/Utils/Database/Orm/Converter.php @@ -218,8 +218,7 @@ class Converter if (array_key_exists('orderByColumn', $collectionDefs)) { $ormMetadata[$entityType]['collection']['orderBy'] = $collectionDefs['orderByColumn']; - } - else if (array_key_exists('orderBy', $collectionDefs)) { + } else if (array_key_exists('orderBy', $collectionDefs)) { if (array_key_exists($collectionDefs['orderBy'], $ormMetadata[$entityType]['attributes'])) { $ormMetadata[$entityType]['collection']['orderBy'] = $collectionDefs['orderBy']; } @@ -401,8 +400,7 @@ class Converter if ($fieldDefs !== false) { if (isset($output[$attribute]) && !in_array($attribute, $unmergedFields)) { $output[$attribute] = array_merge($output[$attribute], $fieldDefs); - } - else { + } else { $output[$attribute] = $fieldDefs; } @@ -718,14 +716,12 @@ class Converter foreach ($partList as $part) { $fullTextSearchColumnList[] = $part . ucfirst($field); } - } - else { + } else { foreach ($partList as $part) { $fullTextSearchColumnList[] = $field . ucfirst($part); } } - } - else { + } else { $fullTextSearchColumnList[] = $field; } } @@ -983,8 +979,7 @@ class Converter if ($keyValue === true) { $indexList[$indexName]['type'] = $indexType; $indexList[$indexName]['columns'] = [$attributeName]; - } - else if (is_string($keyValue)) { + } else if (is_string($keyValue)) { $indexList[$indexName]['type'] = $indexType; $indexList[$indexName]['columns'][] = $attributeName; } diff --git a/application/Espo/Core/Utils/FieldUtil.php b/application/Espo/Core/Utils/FieldUtil.php index c0cb043bd5..0a68aef552 100644 --- a/application/Espo/Core/Utils/FieldUtil.php +++ b/application/Espo/Core/Utils/FieldUtil.php @@ -86,14 +86,12 @@ class FieldUtil $fieldList[] = $f . ucfirst($name); } } - } - else { + } else { foreach ($list as $f) { $fieldList[] = $name . ucfirst($f); } } - } - else { + } else { if ($type == 'actual') { $fieldList[] = $name; } diff --git a/application/Espo/Core/Utils/File/Manager.php b/application/Espo/Core/Utils/File/Manager.php index 3db1779c60..130e78ab1d 100644 --- a/application/Espo/Core/Utils/File/Manager.php +++ b/application/Espo/Core/Utils/File/Manager.php @@ -140,12 +140,10 @@ class Manager $filter, $onlyFileType ); - } - else if (!isset($onlyFileType) || !$onlyFileType) { /* save only directories */ + } else if (!isset($onlyFileType) || !$onlyFileType) { /* save only directories */ $add = true; } - } - else if (!isset($onlyFileType) || $onlyFileType) { /* save only files */ + } else if (!isset($onlyFileType) || $onlyFileType) { /* save only files */ $add = true; } @@ -203,8 +201,7 @@ class Manager $singleFileList = array_merge( $singleFileList, $this->getSingleFileList($fileName, $onlyFileType, $basePath, $currentDir) ); - } - else { + } else { $currentFileName = Util::concatPath($parentDirName, $fileName); if ( @@ -238,8 +235,7 @@ class Manager ); $path = $this->concatPaths($path); - } - else if (!is_string($path)) { + } else if (!is_string($path)) { throw new InvalidArgumentException(); } @@ -625,8 +621,7 @@ class Manager if ($this->checkCreateFile($destFile) === false) { $permissionDeniedList[] = $destFile; - } - else if (!$isFileExists) { + } else if (!$isFileExists) { $this->removeFile($destFile); } } @@ -811,8 +806,7 @@ class Manager if (is_dir($fullPath)) { $result &= $this->removeInDir($fullPath, true); - } - else if (file_exists($fullPath)) { + } else if (file_exists($fullPath)) { $this->opcacheInvalidate($fullPath, true); $result &= unlink($fullPath); @@ -855,8 +849,7 @@ class Manager if (!is_writable($item)) { $permissionDeniedList[] = $item; - } - else if (!is_writable(dirname($item))) { + } else if (!is_writable(dirname($item))) { $permissionDeniedList[] = dirname($item); } } @@ -872,8 +865,7 @@ class Manager foreach ($removeList as $item) { if (is_dir($item)) { $result &= $this->removeInDir($item, true); - } - else { + } else { $result &= $this->removeFile($item); } @@ -996,8 +988,7 @@ class Manager } $fileName = substr($fileName, 0, $dotIndex); - } - else { + } else { if (substr($extension, 0, 1) != '.') { $extension = '.' . $extension; } diff --git a/application/Espo/Core/Utils/File/Permission.php b/application/Espo/Core/Utils/File/Permission.php index 0d9d14b158..c5bdcc88f8 100644 --- a/application/Espo/Core/Utils/File/Permission.php +++ b/application/Espo/Core/Utils/File/Permission.php @@ -246,8 +246,7 @@ class Permission $count++; } - } - else if (is_int((int) $octal)) { // Always true. @todo Fix. + } else if (is_int((int) $octal)) { // Always true. @todo Fix. $permission = [ 'file' => $octal, 'dir' => $octal, diff --git a/application/Espo/Core/Utils/Metadata/AdditionalBuilder/Fields.php b/application/Espo/Core/Utils/Metadata/AdditionalBuilder/Fields.php index b3086e9a29..9d275a51c8 100644 --- a/application/Espo/Core/Utils/Metadata/AdditionalBuilder/Fields.php +++ b/application/Espo/Core/Utils/Metadata/AdditionalBuilder/Fields.php @@ -59,15 +59,13 @@ class Fields implements AdditionalBuilder if (isset($collectionItem->orderBy)) { $collectionItem->sortBy = $collectionItem->orderBy; - } - else if (isset($collectionItem->sortBy)) { + } else if (isset($collectionItem->sortBy)) { $collectionItem->orderBy = $collectionItem->sortBy; } if (isset($collectionItem->order)) { $collectionItem->asc = $collectionItem->order === 'asc'; - } - else if (isset($collectionItem->asc)) { + } else if (isset($collectionItem->asc)) { $collectionItem->order = $collectionItem->asc === true ? 'asc' : 'desc'; } } diff --git a/application/Espo/Core/Utils/Metadata/Helper.php b/application/Espo/Core/Utils/Metadata/Helper.php index 7bc9479377..b80d1fd1d5 100644 --- a/application/Espo/Core/Utils/Metadata/Helper.php +++ b/application/Espo/Core/Utils/Metadata/Helper.php @@ -89,8 +89,7 @@ class Helper if (preg_match('/{(.*?)}/', $paramValue, $matches)) { if (in_array($matches[1], array_keys($defs))) { $value = $defs[$matches[1]]; - } - else if (strtolower($matches[1]) == 'entity') { + } else if (strtolower($matches[1]) == 'entity') { $value = $entityType; } diff --git a/application/Espo/Core/Utils/Util.php b/application/Espo/Core/Utils/Util.php index a9a900a148..4111b23e0c 100644 --- a/application/Espo/Core/Utils/Util.php +++ b/application/Espo/Core/Utils/Util.php @@ -177,11 +177,9 @@ class Util if (is_array($currentArray) && !is_array($newArray)) { return $currentArray; - } - else if (!is_array($currentArray) && is_array($newArray)) { + } else if (!is_array($currentArray) && is_array($newArray)) { return $newArray; - } - else if ( + } else if ( (!is_array($currentArray) || empty($currentArray)) && (!is_array($newArray) || empty($newArray)) ) { @@ -202,8 +200,7 @@ class Util unset($newValue[$appendKey]); $newValue = array_merge($currentArray[$newName], $newValue); - } - else if ( + } else if ( !static::isSingleArray($newValue) || !static::isSingleArray($currentArray[$newName]) ) { @@ -237,8 +234,7 @@ class Util foreach ($haystack as $key => $value) { if (is_array($value)) { $haystack[$key] = static::unsetInArrayByValue($needle, $value); - } - else if ($needle === $value) { + } else if ($needle === $value) { unset($haystack[$key]); if ($reIndex) { @@ -546,8 +542,7 @@ class Util if (is_array($key)) { $keys = $key; - } - else { + } else { $keys = explode('.', $key); } @@ -557,16 +552,13 @@ class Util if (is_array($item)) { if (isset($item[$keyName])) { $item = $item[$keyName]; - } - else { + } else { return $default; } - } - else if (is_object($item)) { + } else if (is_object($item)) { if (isset($item->$keyName)) { $item = $item->$keyName; - } - else { + } else { return $default; } } diff --git a/application/Espo/Core/Webhook/Queue.php b/application/Espo/Core/Webhook/Queue.php index 32dcc47903..dd5925b231 100644 --- a/application/Espo/Core/Webhook/Queue.php +++ b/application/Espo/Core/Webhook/Queue.php @@ -278,17 +278,13 @@ class Queue if ($code >= 200 && $code < 400) { $this->succeedQueueItemList($itemList); - } - else if ($code === 410) { + } else if ($code === 410) { $this->dropWebhook($webhook); - } - else if (in_array($code, [0, 401, 403, 404, 405, 408, 500, 503])) { + } else if (in_array($code, [0, 401, 403, 404, 405, 408, 500, 503])) { $this->failQueueItemList($itemList); - } - else if ($code >= 400 && $code < 500) { + } else if ($code >= 400 && $code < 500) { $this->failQueueItemList($itemList, true); - } - else { + } else { $this->failQueueItemList($itemList, true); } diff --git a/application/Espo/Entities/Integration.php b/application/Espo/Entities/Integration.php index b5def12719..58fac3987d 100644 --- a/application/Espo/Entities/Integration.php +++ b/application/Espo/Entities/Integration.php @@ -50,8 +50,7 @@ class Integration extends Entity } else { if ($this->get('data')) { $data = $this->get('data'); - } - else { + } else { $data = new stdClass(); } @@ -105,8 +104,7 @@ class Integration extends Entity if ($this->hasAttribute($name)) { $this->setInContainer($name, $value); - } - else { + } else { $data = $this->get('data') ?? (object) []; $data->$name = $value; diff --git a/application/Espo/Entities/Note.php b/application/Espo/Entities/Note.php index 2827afc6f9..02e91619af 100644 --- a/application/Espo/Entities/Note.php +++ b/application/Espo/Entities/Note.php @@ -317,8 +317,7 @@ class Note extends Entity ) { if (!$targetType || $targetType === self::TARGET_TEAMS) { $this->loadLinkMultipleField('teams'); - } - else if ($targetType === self::TARGET_PORTALS) { + } else if ($targetType === self::TARGET_PORTALS) { $this->loadLinkMultipleField('portals'); } } diff --git a/application/Espo/EntryPoints/Image.php b/application/Espo/EntryPoints/Image.php index 0679db2804..6d37e67d41 100644 --- a/application/Espo/EntryPoints/Image.php +++ b/application/Espo/EntryPoints/Image.php @@ -239,8 +239,7 @@ class Image implements EntryPoint if ($originalWidth <= $width && $originalHeight <= $height) { $targetWidth = $originalWidth; $targetHeight = $originalHeight; - } - else { + } else { if ($originalWidth > $originalHeight) { $targetWidth = $width; $targetHeight = (int) ($originalHeight / ($originalWidth / $width)); diff --git a/application/Espo/Hooks/Common/CurrencyConverted.php b/application/Espo/Hooks/Common/CurrencyConverted.php index 557db0a83f..e4fecbca59 100644 --- a/application/Espo/Hooks/Common/CurrencyConverted.php +++ b/application/Espo/Hooks/Common/CurrencyConverted.php @@ -82,8 +82,7 @@ class CurrencyConverted implements Di\MetadataAware, Di\ConfigAware if ($defaultCurrency === $currency) { $targetValue = $value; - } - else { + } else { $targetValue = $value; $targetValue = $targetValue / (isset($rates[$baseCurrency]) ? $rates[$baseCurrency] : 1.0); $targetValue = $targetValue * (isset($rates[$currency]) ? $rates[$currency] : 1.0); diff --git a/application/Espo/Hooks/Common/Webhook.php b/application/Espo/Hooks/Common/Webhook.php index 163aee3b7c..a0a84c8e6e 100644 --- a/application/Espo/Hooks/Common/Webhook.php +++ b/application/Espo/Hooks/Common/Webhook.php @@ -62,8 +62,7 @@ class Webhook if ($entity->isNew()) { $this->webhookManager->processCreate($entity); - } - else { + } else { $this->webhookManager->processUpdate($entity); } } diff --git a/application/Espo/Modules/Crm/Business/Distribution/Lead/LeastBusy.php b/application/Espo/Modules/Crm/Business/Distribution/Lead/LeastBusy.php index 210379dda9..20dd348154 100644 --- a/application/Espo/Modules/Crm/Business/Distribution/Lead/LeastBusy.php +++ b/application/Espo/Modules/Crm/Business/Distribution/Lead/LeastBusy.php @@ -103,8 +103,7 @@ class LeastBusy if ($min === false) { $min = $count; $foundUserId = $userId; - } - else { + } else { if ($count < $min) { $min = $count; $foundUserId = $userId; diff --git a/application/Espo/Modules/Crm/Business/Distribution/Lead/RoundRobin.php b/application/Espo/Modules/Crm/Business/Distribution/Lead/RoundRobin.php index 6cc0722d8c..948125459a 100644 --- a/application/Espo/Modules/Crm/Business/Distribution/Lead/RoundRobin.php +++ b/application/Espo/Modules/Crm/Business/Distribution/Lead/RoundRobin.php @@ -92,8 +92,7 @@ class RoundRobin if (empty($lead)) { $num = 0; - } - else { + } else { $num = array_search($lead->get('assignedUserId'), $userIdList); if ($num === false || $num == count($userIdList) - 1) { diff --git a/application/Espo/Modules/Crm/Classes/FormulaFunctions/ExtGroup/AccountGroup/FindByEmailAddressType.php b/application/Espo/Modules/Crm/Classes/FormulaFunctions/ExtGroup/AccountGroup/FindByEmailAddressType.php index 81e6fb2260..ccd19f7afa 100644 --- a/application/Espo/Modules/Crm/Classes/FormulaFunctions/ExtGroup/AccountGroup/FindByEmailAddressType.php +++ b/application/Espo/Modules/Crm/Classes/FormulaFunctions/ExtGroup/AccountGroup/FindByEmailAddressType.php @@ -118,8 +118,7 @@ class FindByEmailAddressType extends BaseFunction implements if ($account) { return $account->getId(); } - } - else { + } else { if ($contact->get('accountId')) { return $contact->get('accountId'); } diff --git a/application/Espo/Modules/Crm/Classes/Select/Meeting/Where/DateTimeItemTransformer.php b/application/Espo/Modules/Crm/Classes/Select/Meeting/Where/DateTimeItemTransformer.php index 169e26b043..74fdc18ed7 100644 --- a/application/Espo/Modules/Crm/Classes/Select/Meeting/Where/DateTimeItemTransformer.php +++ b/application/Espo/Modules/Crm/Classes/Select/Meeting/Where/DateTimeItemTransformer.php @@ -69,8 +69,7 @@ class DateTimeItemTransformer implements DateTimeItemTransformerInterface if (strlen($value) > 11) { return $transformedItem; } - } - else if (is_array($value)) { + } else if (is_array($value)) { foreach ($value as $valueItem) { if (is_string($valueItem) && strlen($valueItem) > 11) { return $transformedItem; diff --git a/application/Espo/Modules/Crm/EntryPoints/CampaignUrl.php b/application/Espo/Modules/Crm/EntryPoints/CampaignUrl.php index c13e520da1..3c7270dc49 100644 --- a/application/Espo/Modules/Crm/EntryPoints/CampaignUrl.php +++ b/application/Espo/Modules/Crm/EntryPoints/CampaignUrl.php @@ -85,11 +85,9 @@ class CampaignUrl implements EntryPoint if ($emailAddress && $hash) { $this->processWithHash($trackingUrl, $emailAddress, $hash); - } - else if ($uid && $hash) { + } else if ($uid && $hash) { $this->processWithUniqueId($trackingUrl, $uid, $hash); - } - else { + } else { if (!$queueItemId || !is_string($queueItemId)) { throw new BadRequest("No item ID."); } diff --git a/application/Espo/Modules/Crm/Hooks/Meeting/ParentLink.php b/application/Espo/Modules/Crm/Hooks/Meeting/ParentLink.php index 66d424575a..39aee26ed1 100644 --- a/application/Espo/Modules/Crm/Hooks/Meeting/ParentLink.php +++ b/application/Espo/Modules/Crm/Hooks/Meeting/ParentLink.php @@ -89,8 +89,7 @@ class ParentLink implements BeforeSave if ($parent instanceof Account) { $accountId = $parent->getId(); $accountName = $parent->get('name'); - } - else if ( + } else if ( $parent instanceof Lead && $parent->getStatus() === Lead::STATUS_CONVERTED && $parent->get('createdAccountId') diff --git a/application/Espo/Modules/Crm/Hooks/Meeting/Users.php b/application/Espo/Modules/Crm/Hooks/Meeting/Users.php index e4a7987116..4ea7c0ba2f 100644 --- a/application/Espo/Modules/Crm/Hooks/Meeting/Users.php +++ b/application/Espo/Modules/Crm/Hooks/Meeting/Users.php @@ -66,8 +66,7 @@ class Users implements BeforeSave $entity->getLinkMultipleName('assignedUsers', $assignedUserId) ); } - } - else { + } else { $assignedUserId = $entity->get('assignedUserId'); if ($assignedUserId) { diff --git a/application/Espo/Modules/Crm/Hooks/Task/ParentLink.php b/application/Espo/Modules/Crm/Hooks/Task/ParentLink.php index 3546a85b1f..be27f9f8ec 100644 --- a/application/Espo/Modules/Crm/Hooks/Task/ParentLink.php +++ b/application/Espo/Modules/Crm/Hooks/Task/ParentLink.php @@ -104,8 +104,7 @@ class ParentLink implements BeforeSave if ($parent instanceof Account) { $accountId = $parent->getId(); $accountName = $parent->get('name'); - } - else if ( + } else if ( $parent instanceof Lead && $parent->getStatus() == Lead::STATUS_CONVERTED ) { @@ -118,8 +117,7 @@ class ParentLink implements BeforeSave $contactId = $parent->get('createdContactId'); $contactName = $parent->get('createdContactName'); } - } - else if ($parent instanceof Contact) { + } else if ($parent instanceof Contact) { $contactId = $parent->getId(); $contactName = $parent->get('name'); } diff --git a/application/Espo/Modules/Crm/Tools/Activities/Api/GetListTyped.php b/application/Espo/Modules/Crm/Tools/Activities/Api/GetListTyped.php index 9ce6f1bf2d..f2aa32fce6 100644 --- a/application/Espo/Modules/Crm/Tools/Activities/Api/GetListTyped.php +++ b/application/Espo/Modules/Crm/Tools/Activities/Api/GetListTyped.php @@ -65,11 +65,9 @@ class GetListTyped implements Action if ($type === 'activities') { $isHistory = false; - } - else if ($type === 'history') { + } else if ($type === 'history') { $isHistory = true; - } - else { + } else { throw new BadRequest("Bad type."); } diff --git a/application/Espo/Modules/Crm/Tools/Activities/Service.php b/application/Espo/Modules/Crm/Tools/Activities/Service.php index e9a96c565c..f60edae9de 100644 --- a/application/Espo/Modules/Crm/Tools/Activities/Service.php +++ b/application/Espo/Modules/Crm/Tools/Activities/Service.php @@ -139,8 +139,7 @@ class Service 'usersLeftMiddle.meetingId:' => 'meeting.id', ] ); - } - catch (BadRequest|Forbidden $e) { + } catch (BadRequest|Forbidden $e) { throw new RuntimeException($e->getMessage()); } @@ -157,8 +156,7 @@ class Service ->where([ 'OR' => $where, ]); - } - else { + } else { $builder->where($where); } @@ -231,8 +229,7 @@ class Service ->where([ 'OR' => $where, ]); - } - else { + } else { $builder->where($where); } @@ -380,8 +377,7 @@ class Service ], ], ]); - } - else if ($entityType === Lead::ENTITY_TYPE && $entity->get('createdAccountId')) { + } else if ($entityType === Lead::ENTITY_TYPE && $entity->get('createdAccountId')) { $builder->where([ 'OR' => [ [ @@ -393,8 +389,7 @@ class Service ], ], ]); - } - else { + } else { $builder->where([ 'parentId' => $id, 'parentType' => $entityType, @@ -511,8 +506,7 @@ class Service ], ], ]); - } - else if ($entityType == Lead::ENTITY_TYPE && $entity->get('createdAccountId')) { + } else if ($entityType == Lead::ENTITY_TYPE && $entity->get('createdAccountId')) { $builder->where([ 'OR' => [ [ @@ -524,15 +518,13 @@ class Service ], ], ]); - } - else { + } else { $builder->where([ 'parentId' => $id, 'parentType' => $entityType, ]); } - if (!$this->isPerson($entityType) && !$this->isCompany($entityType)) { return $builder->build(); } @@ -794,8 +786,7 @@ class Service if (!$isHistory) { $statusList = $this->metadata->get(['scopes', $entityType, 'activityStatusList']) ?? [Meeting::STATUS_PLANNED]; - } - else { + } else { $statusList = $this->metadata->get(['scopes', $entityType, 'historyStatusList']) ?? [Meeting::STATUS_HELD, Meeting::STATUS_NOT_HELD]; } @@ -1097,8 +1088,7 @@ class Service $builder->where([ 'assignedUserId' => $entity->getId(), ]); - } - else { + } else { $builder->where([ 'parentId' => $entity->getId(), 'parentType' => $entity->getEntityType(), diff --git a/application/Espo/Modules/Crm/Tools/Calendar/Service.php b/application/Espo/Modules/Crm/Tools/Calendar/Service.php index 18f8ae3a91..db5c120225 100644 --- a/application/Espo/Modules/Crm/Tools/Calendar/Service.php +++ b/application/Espo/Modules/Crm/Tools/Calendar/Service.php @@ -534,8 +534,7 @@ class Service ->where([ 'assignedUsers.id' => $userId, ]); - } - else { + } else { $queryBuilder->where([ 'assignedUserId' => $userId, ]); diff --git a/application/Espo/Modules/Crm/Tools/Case/Distribution/LeastBusy.php b/application/Espo/Modules/Crm/Tools/Case/Distribution/LeastBusy.php index ee51261066..56c26ddfb3 100644 --- a/application/Espo/Modules/Crm/Tools/Case/Distribution/LeastBusy.php +++ b/application/Espo/Modules/Crm/Tools/Case/Distribution/LeastBusy.php @@ -92,8 +92,7 @@ class LeastBusy if ($min === false) { $min = $count; $foundUserId = $userId; - } - else if ($count < $min) { + } else if ($count < $min) { $min = $count; $foundUserId = $userId; } diff --git a/application/Espo/Modules/Crm/Tools/Case/Distribution/RoundRobin.php b/application/Espo/Modules/Crm/Tools/Case/Distribution/RoundRobin.php index b6fba29f1e..75b6860fcc 100644 --- a/application/Espo/Modules/Crm/Tools/Case/Distribution/RoundRobin.php +++ b/application/Espo/Modules/Crm/Tools/Case/Distribution/RoundRobin.php @@ -82,14 +82,12 @@ class RoundRobin if (empty($case)) { $num = 0; - } - else { + } else { $num = array_search($case->getAssignedUser()?->getId(), $userIdList); if ($num === false || $num == count($userIdList) - 1) { $num = 0; - } - else { + } else { $num++; } } diff --git a/application/Espo/Modules/Crm/Tools/Opportunity/Report/SalesByMonth.php b/application/Espo/Modules/Crm/Tools/Opportunity/Report/SalesByMonth.php index c7ff52a8f8..bb454c877a 100644 --- a/application/Espo/Modules/Crm/Tools/Opportunity/Report/SalesByMonth.php +++ b/application/Espo/Modules/Crm/Tools/Opportunity/Report/SalesByMonth.php @@ -121,8 +121,7 @@ class SalesByMonth $dtTo = $dtTo ->addDays(1 - $dtTo->getDay()) // First day of month. ->addMonths(1); - } - else { + } else { $dtTo = $dtTo->addDays(1 - $dtTo->getDay()); } diff --git a/application/Espo/ORM/BaseEntity.php b/application/Espo/ORM/BaseEntity.php index ba637e3030..44230d80d3 100644 --- a/application/Espo/ORM/BaseEntity.php +++ b/application/Espo/ORM/BaseEntity.php @@ -883,8 +883,7 @@ class BaseEntity implements Entity return true; } - } - else if ($type === self::JSON_OBJECT) { + } else if ($type === self::JSON_OBJECT) { if (is_object($v1) && is_object($v2)) { if ($v1 != $v2) { return false; diff --git a/application/Espo/ORM/EntityCollection.php b/application/Espo/ORM/EntityCollection.php index 6749ff6081..eb46a8fe99 100644 --- a/application/Espo/ORM/EntityCollection.php +++ b/application/Espo/ORM/EntityCollection.php @@ -320,8 +320,7 @@ class EntityCollection implements Collection, Iterator, Countable, ArrayAccess, if ($value['id'] == $v['id']) { return $index; } - } - else if ($v instanceof Entity) { + } else if ($v instanceof Entity) { if ($value['id'] == $v->getId()) { return $index; } @@ -329,15 +328,13 @@ class EntityCollection implements Collection, Iterator, Countable, ArrayAccess, $index ++; } - } - else if ($value instanceof Entity) { + } else if ($value instanceof Entity) { foreach ($this->dataList as $v) { if (is_array($v)) { if ($value->getId() == $v['id']) { return $index; } - } - else if ($v instanceof Entity) { + } else if ($v instanceof Entity) { if ($value === $v) { return $index; } diff --git a/application/Espo/ORM/Mapper/BaseMapper.php b/application/Espo/ORM/Mapper/BaseMapper.php index 704ba4ab82..111bf3cdf3 100644 --- a/application/Espo/ORM/Mapper/BaseMapper.php +++ b/application/Espo/ORM/Mapper/BaseMapper.php @@ -1477,11 +1477,9 @@ class BaseMapper implements RDBMapper { if ($type == Entity::JSON_ARRAY && is_array($value)) { $value = json_encode($value, JSON_UNESCAPED_UNICODE); - } - else if ($type == Entity::JSON_OBJECT && (is_array($value) || $value instanceof stdClass)) { + } else if ($type == Entity::JSON_OBJECT && (is_array($value) || $value instanceof stdClass)) { $value = json_encode($value, JSON_UNESCAPED_UNICODE); - } - else { + } else { if (is_array($value) || is_object($value)) { return null; } diff --git a/application/Espo/ORM/Query/Part/Where/Comparison.php b/application/Espo/ORM/Query/Part/Where/Comparison.php index 782f28380a..f001b8910f 100644 --- a/application/Espo/ORM/Query/Part/Where/Comparison.php +++ b/application/Espo/ORM/Query/Part/Where/Comparison.php @@ -353,8 +353,7 @@ class Comparison implements WhereItem if ($key === '') { throw new RuntimeException("Expression can't be empty."); } - } - else { + } else { $key = $argument1->getValue(); } @@ -368,8 +367,7 @@ class Comparison implements WhereItem $key .= ':'; $value = $argument2->getValue(); - } - else { + } else { $value = $argument2; } @@ -401,8 +399,7 @@ class Comparison implements WhereItem if (str_ends_with($key, ':')) { throw new RuntimeException("Expression can't end with `:`."); } - } - else { + } else { $key = $argument1->getValue(); } @@ -427,8 +424,7 @@ class Comparison implements WhereItem if (str_ends_with($key, ':')) { throw new RuntimeException("Expression can't end with `:`."); } - } - else { + } else { $key = $argument1->getValue(); } diff --git a/application/Espo/ORM/Query/SelectBuilder.php b/application/Espo/ORM/Query/SelectBuilder.php index 2486f543ab..fafe27d8cd 100644 --- a/application/Espo/ORM/Query/SelectBuilder.php +++ b/application/Espo/ORM/Query/SelectBuilder.php @@ -158,8 +158,7 @@ class SelectBuilder implements Builder if ($select instanceof Expression) { $select = $select->getValue(); - } - else if ($select instanceof Selection) { + } else if ($select instanceof Selection) { $alias = $alias ?? $select->getAlias(); $select = $select->getExpression()->getValue(); } diff --git a/application/Espo/ORM/Query/SelectingBuilderTrait.php b/application/Espo/ORM/Query/SelectingBuilderTrait.php index f19d47930b..a745242886 100644 --- a/application/Espo/ORM/Query/SelectingBuilderTrait.php +++ b/application/Espo/ORM/Query/SelectingBuilderTrait.php @@ -140,12 +140,10 @@ trait SelectingBuilderTrait if ($orderBy instanceof Expression) { $orderBy = $orderBy->getValue(); $direction = $direction ?? Order::ASC; - } - else if ($orderBy instanceof Order) { + } else if ($orderBy instanceof Order) { $direction = $direction ?? $orderBy->getDirection(); $orderBy = $orderBy->getExpression()->getValue(); - } - else { + } else { $direction = $direction ?? Order::ASC; } diff --git a/application/Espo/ORM/QueryComposer/BaseQueryComposer.php b/application/Espo/ORM/QueryComposer/BaseQueryComposer.php index 6755a8fce0..512b2fa7c3 100644 --- a/application/Espo/ORM/QueryComposer/BaseQueryComposer.php +++ b/application/Espo/ORM/QueryComposer/BaseQueryComposer.php @@ -1232,8 +1232,7 @@ abstract class BaseQueryComposer implements QueryComposer } $part = implode(', ', $argumentPartList); - } - else { + } else { $part = $this->getFunctionArgumentPart($entity, $attribute, $distinct, $params); } @@ -1289,8 +1288,7 @@ abstract class BaseQueryComposer implements QueryComposer if (Util::isArgumentNumeric($argument)) { if (filter_var($argument, FILTER_VALIDATE_INT) !== false) { $argument = intval($argument); - } - else if (filter_var($argument, FILTER_VALIDATE_FLOAT) !== false) { + } else if (filter_var($argument, FILTER_VALIDATE_FLOAT) !== false) { $argument = floatval($argument); } @@ -1332,8 +1330,7 @@ abstract class BaseQueryComposer implements QueryComposer $part = !$isAlias ? $this->toDb($attribute): $attribute; - } - else { + } else { $part = ''; } @@ -2067,8 +2064,7 @@ abstract class BaseQueryComposer implements QueryComposer $this->getAttributeParam($entity, $field, 'relation') ) { $relationsToJoin[] = $this->getAttributeParam($entity, $field, 'relation'); - } - else if ( + } else if ( $this->getAttributeParam($entity, $field, 'fieldType') == 'linkOne' && $this->getAttributeParam($entity, $field, 'relation') ) { @@ -2347,8 +2343,7 @@ abstract class BaseQueryComposer implements QueryComposer ) { if (array_key_exists($name, $occurrenceHash)) { $occurrenceHash[$name]++; - } - else { + } else { $occurrenceHash[$name] = 0; } @@ -2539,11 +2534,9 @@ abstract class BaseQueryComposer implements QueryComposer if ($field === self::EXISTS_OPERATOR) { if ($value instanceof Select) { $subQueryPart = $this->composeSelect($value); - } - else if (is_array($value)) { + } else if (is_array($value)) { $subQueryPart = $this->createSelectQueryInternal($value); - } - else { + } else { throw new RuntimeException("Bad EXISTS usage in where-clause."); } @@ -2757,8 +2750,7 @@ abstract class BaseQueryComposer implements QueryComposer if ($operatorOrm === '*') { $operatorKey = 'LIKE'; - } - else if ($operatorOrm === '!*') { + } else if ($operatorOrm === '!*') { $operatorKey = 'NOT LIKE'; } @@ -2770,25 +2762,20 @@ abstract class BaseQueryComposer implements QueryComposer if ($value) { $operatorKey = $operator === '=' ? '= TRUE' : '= FALSE'; - } - else { + } else { $operatorKey = $operator === '=' ? '= FALSE' : '= TRUE'; } - } - else if (is_array($value)) { + } else if (is_array($value)) { if ($operator == '=') { $operatorKey = 'IN'; - } - else if ($operator == '<>') { + } else if ($operator == '<>') { $operatorKey = 'NOT IN'; } - } - else if (is_null($value)) { + } else if (is_null($value)) { if ($operator == '=') { $operatorKey = 'IS NULL'; - } - else if ($operator == '<>') { + } else if ($operator == '<>') { $operatorKey = 'IS NOT NULL'; } } @@ -2814,14 +2801,11 @@ abstract class BaseQueryComposer implements QueryComposer if (is_string($whereDefs)) { $whereSqlPart = $whereDefs; $whereDefs = []; - } - else if (!empty($whereDefs['sql'])) { + } else if (!empty($whereDefs['sql'])) { $whereSqlPart = $whereDefs['sql']; - } - else if (!empty($whereDefs['whereClause'])) { + } else if (!empty($whereDefs['whereClause'])) { $whereClause = $this->applyValueToCustomWhereClause($whereDefs['whereClause'], $value); - } - else { + } else { return $this->quote(false); } @@ -2886,13 +2870,11 @@ abstract class BaseQueryComposer implements QueryComposer foreach ($whereClause as $left => $right) { if ($right === '{value}') { $right = $value; - } - else if (is_string($right)) { + } else if (is_string($right)) { if (!is_array($value)) { $right = str_replace('{value}', (string) $value, $right); } - } - else if (is_array($right)) { + } else if (is_array($right)) { $right = $this->applyValueToCustomWhereClause($right, $value); } @@ -2916,8 +2898,7 @@ abstract class BaseQueryComposer implements QueryComposer if (isset($j[0])) { if (isset($j[1]) && $j[1]) { $joinAlias = $j[1]; - } - else { + } else { $joinAlias = $j[0]; } } else { @@ -2943,8 +2924,7 @@ abstract class BaseQueryComposer implements QueryComposer } $stringValue = '(' . implode(', ', $arr) . ')'; - } - else { + } else { $stringValue = $this->quote($value); } @@ -3014,16 +2994,14 @@ abstract class BaseQueryComposer implements QueryComposer if (count($item) > 3) { $itemParams = $item[3] ?? []; } - } - else { + } else { $alias = $target; } if ($target instanceof Select && !is_string($alias)) { throw new LogicException("Sub-query join can't be w/o alias"); } - } - else { + } else { $target = $item; $alias = $target; } @@ -3120,8 +3098,7 @@ abstract class BaseQueryComposer implements QueryComposer $leftAlias = $this->sanitize($leftAlias); /** @noinspection PhpDeprecationInspection */ $column = $this->toDb($this->sanitize($attribute)); - } - else { + } else { /** @noinspection PhpDeprecationInspection */ $column = $this->toDb($this->sanitize($left)); @@ -3220,8 +3197,7 @@ abstract class BaseQueryComposer implements QueryComposer /** @noinspection PhpDeprecationInspection */ $alias = $this->sanitizeSelectAlias($alias); - } - else { + } else { /** @noinspection PhpDeprecationInspection */ $alias = $alias === null ? $this->sanitize($target) : @@ -3644,8 +3620,7 @@ abstract class BaseQueryComposer implements QueryComposer $column = $this->toDb($this->sanitize($attribute)); $left = $this->quoteColumn("$alias.$column"); - } - else { + } else { $table = $this->toDb($entity->getEntityType()); /** @noinspection PhpDeprecationInspection */ $column = $this->toDb($this->sanitize($attribute)); diff --git a/application/Espo/ORM/QueryComposer/PostgresqlQueryComposer.php b/application/Espo/ORM/QueryComposer/PostgresqlQueryComposer.php index 829bef7ef3..507cadb62b 100644 --- a/application/Espo/ORM/QueryComposer/PostgresqlQueryComposer.php +++ b/application/Espo/ORM/QueryComposer/PostgresqlQueryComposer.php @@ -520,8 +520,7 @@ class PostgresqlQueryComposer extends BaseQueryComposer $column = $this->toDb($this->sanitize($attribute)); $left = $this->quoteColumn("{$alias}.{$column}"); - } - else { + } else { $column = $this->toDb($this->sanitize($attribute)); $left = $this->quoteColumn("{$column}"); // Diff. diff --git a/application/Espo/ORM/Repository/Deprecation/RDBRepositoryDeprecationTrait.php b/application/Espo/ORM/Repository/Deprecation/RDBRepositoryDeprecationTrait.php index 8cc0cf3c6b..0500d5a4f8 100644 --- a/application/Espo/ORM/Repository/Deprecation/RDBRepositoryDeprecationTrait.php +++ b/application/Espo/ORM/Repository/Deprecation/RDBRepositoryDeprecationTrait.php @@ -311,11 +311,9 @@ trait RDBRepositoryDeprecationTrait } $id = $foreign->getId(); - } - else if (is_string($foreign)) { + } else if (is_string($foreign)) { $id = $foreign; - } - else { + } else { throw new \RuntimeException("Bad 'foreign' value."); } @@ -376,8 +374,7 @@ trait RDBRepositoryDeprecationTrait if (method_exists($this, $methodName)) { $result = $this->$methodName($entity, $foreign, $columnData, $options); - } - else { + } else { $data = $columnData; if ($columnData instanceof \stdClass) { @@ -386,8 +383,7 @@ trait RDBRepositoryDeprecationTrait if ($foreign instanceof Entity) { $result = $this->getMapper()->relate($entity, $relationName, $foreign, $data); - } - else { + } else { $id = $foreign; $result = $this->getMapper()->relateById($entity, $relationName, $id, $data); @@ -440,12 +436,10 @@ trait RDBRepositoryDeprecationTrait if (method_exists($this, $methodName)) { $this->$methodName($entity, $foreign); - } - else { + } else { if ($foreign instanceof Entity) { $this->getMapper()->unrelate($entity, $relationName, $foreign); - } - else { + } else { $id = $foreign; $this->getMapper()->unrelateById($entity, $relationName, $id); diff --git a/application/Espo/ORM/Repository/RDBRelation.php b/application/Espo/ORM/Repository/RDBRelation.php index cfb2e8e0ff..634d9609a4 100644 --- a/application/Espo/ORM/Repository/RDBRelation.php +++ b/application/Espo/ORM/Repository/RDBRelation.php @@ -80,8 +80,7 @@ class RDBRelation if ($entity instanceof BaseEntity) { $this->foreignEntityType = $entity->getRelationParam($relationName, 'entity'); - } - else { + } else { $this->foreignEntityType = $this->entityManager ->getDefs() ->getEntity($this->entityType) diff --git a/application/Espo/ORM/Repository/RDBRelationSelectBuilder.php b/application/Espo/ORM/Repository/RDBRelationSelectBuilder.php index 5614ffeaaf..93d7160025 100644 --- a/application/Espo/ORM/Repository/RDBRelationSelectBuilder.php +++ b/application/Espo/ORM/Repository/RDBRelationSelectBuilder.php @@ -72,8 +72,7 @@ class RDBRelationSelectBuilder if ($entity instanceof BaseEntity) { $this->foreignEntityType = $entity->getRelationParam($relationName, 'entity'); - } - else { + } else { $this->foreignEntityType = $this->entityManager ->getDefs() ->getEntity($entityType) @@ -323,11 +322,9 @@ class RDBRelationSelectBuilder if ($this->isManyMany()) { if ($clause instanceof WhereItem) { $clause = $this->applyRelationAliasToWhereClause($clause->getRaw()); - } - else if (is_string($clause)) { + } else if (is_string($clause)) { $clause = $this->applyRelationAliasToWhereClauseKey($clause); - } - else if (is_array($clause)) { + } else if (is_array($clause)) { $clause = $this->applyRelationAliasToWhereClause($clause); } } diff --git a/application/Espo/Repositories/Email.php b/application/Espo/Repositories/Email.php index c44dd66803..a36d71f4f2 100644 --- a/application/Espo/Repositories/Email.php +++ b/application/Espo/Repositories/Email.php @@ -462,8 +462,7 @@ class Email extends Database implements if ($filter->getAction() === EmailFilter::ACTION_SKIP) { $entity->setLinkMultipleColumn('users', EmailEntity::USERS_COLUMN_IN_TRASH, $userId, true); - } - else if ($filter->getAction() === EmailFilter::ACTION_MOVE_TO_FOLDER) { + } else if ($filter->getAction() === EmailFilter::ACTION_MOVE_TO_FOLDER) { $folderId = $filter->getEmailFolderId(); if ($folderId) { diff --git a/application/Espo/Repositories/EmailAddress.php b/application/Espo/Repositories/EmailAddress.php index 2406862c30..14c811e3a6 100644 --- a/application/Espo/Repositories/EmailAddress.php +++ b/application/Espo/Repositories/EmailAddress.php @@ -226,8 +226,7 @@ class EmailAddress extends Database implements ->select($select) ->where(['id' => $itemEntityId]) ->findOne(); - } - else { + } else { $entity = $this->entityManager->getEntity($itemEntityType, $itemEntityId); } @@ -295,8 +294,7 @@ class EmailAddress extends Database implements ->select($select) ->where(['id' => $itemEntityId]) ->findOne(); - } - else { + } else { $entity = $this->entityManager->getEntity($itemEntityType, $itemEntityId); } diff --git a/application/Espo/Repositories/PhoneNumber.php b/application/Espo/Repositories/PhoneNumber.php index 3aa1792f46..3010be8dc5 100644 --- a/application/Espo/Repositories/PhoneNumber.php +++ b/application/Espo/Repositories/PhoneNumber.php @@ -269,8 +269,7 @@ class PhoneNumber extends Database implements if (is_string($number) && !str_starts_with($number, self::ERASED_PREFIX)) { $numeric = preg_replace('/[^0-9]/', '', $number); - } - else { + } else { $numeric = null; } diff --git a/application/Espo/Repositories/Portal.php b/application/Espo/Repositories/Portal.php index 63d81ab507..8c6799d21c 100644 --- a/application/Espo/Repositories/Portal.php +++ b/application/Espo/Repositories/Portal.php @@ -57,8 +57,7 @@ class Portal extends Database implements if ($entity->getId() === $this->config->get('defaultPortalId')) { $entity->set('isDefault', true); $entity->setFetched('isDefault', true); - } - else { + } else { if ($entity->get('customId')) { $url .= $entity->get('customId') . '/'; } else { diff --git a/application/Espo/Repositories/Webhook.php b/application/Espo/Repositories/Webhook.php index c2594764d4..078a6797c4 100644 --- a/application/Espo/Repositories/Webhook.php +++ b/application/Espo/Repositories/Webhook.php @@ -88,8 +88,7 @@ class Webhook extends Database } $entity->set('field', $field); - } - else { + } else { $entity->set('field', null); } } diff --git a/application/Espo/Services/RecordTree.php b/application/Espo/Services/RecordTree.php index 3f21042112..26e19a1eb9 100644 --- a/application/Espo/Services/RecordTree.php +++ b/application/Espo/Services/RecordTree.php @@ -262,8 +262,7 @@ class RecordTree extends Record $parentId = $parent->get('parentId'); array_unshift($arr, $parent->getId()); - } - else { + } else { $parentId = null; } } diff --git a/application/Espo/Tools/App/AppService.php b/application/Espo/Tools/App/AppService.php index 2d5dca4019..bd521cb5b5 100644 --- a/application/Espo/Tools/App/AppService.php +++ b/application/Espo/Tools/App/AppService.php @@ -209,8 +209,7 @@ class AppService if (in_array($attribute, ['contactId', 'contactName', 'accountId', 'accountsIds'])) { continue; } - } - else { + } else { if (in_array($attribute, ['teamsIds', 'defaultTeamId', 'defaultTeamName'])) { continue; } diff --git a/application/Espo/Tools/App/LanguageService.php b/application/Espo/Tools/App/LanguageService.php index cd205e7e3d..12e59b723f 100644 --- a/application/Espo/Tools/App/LanguageService.php +++ b/application/Espo/Tools/App/LanguageService.php @@ -66,8 +66,7 @@ class LanguageService { if ($default) { $languageObj = $this->getDefaultLanguage(); - } - else { + } else { $languageObj = $this->getLanguage(); } @@ -105,8 +104,7 @@ class LanguageService unset($data['Campaign']['options']); unset($data['Campaign']['tooltips']); unset($data['Campaign']['presetFilters']); - } - else { + } else { /** @var string[] $scopeList */ $scopeList = array_keys($this->metadata->get(['scopes'], [])); @@ -123,8 +121,7 @@ class LanguageService unset($data[$scope]); unset($data['Global']['scopeNames'][$scope]); unset($data['Global']['scopeNamesPlural'][$scope]); - } - else { + } else { if (in_array($scope, ['EmailAccount', 'InboundEmail'])) { continue; } diff --git a/application/Espo/Tools/App/MetadataService.php b/application/Espo/Tools/App/MetadataService.php index 43fc708b8d..39b482166b 100644 --- a/application/Espo/Tools/App/MetadataService.php +++ b/application/Espo/Tools/App/MetadataService.php @@ -253,13 +253,11 @@ class MetadataService $k = $row[$j]; unset($o->$k); - } - else { + } else { break; } } - } - else { + } else { $p = &$p->$item; $path[] = &$p; } diff --git a/application/Espo/Tools/Dashboard/Service.php b/application/Espo/Tools/Dashboard/Service.php index 5df6f02997..6e6cb74347 100644 --- a/application/Espo/Tools/Dashboard/Service.php +++ b/application/Espo/Tools/Dashboard/Service.php @@ -133,8 +133,7 @@ class Service 'dashboardLayout' => $template->get('layout'), 'dashletsOptions' => $template->get('dashletsOptions'), ]); - } - else { + } else { $dashletsOptions = $preferences->get('dashletsOptions'); if (!$dashletsOptions) { diff --git a/application/Espo/Tools/DataPrivacy/Erasor.php b/application/Espo/Tools/DataPrivacy/Erasor.php index 80333aafef..e324fe7d2a 100644 --- a/application/Espo/Tools/DataPrivacy/Erasor.php +++ b/application/Espo/Tools/DataPrivacy/Erasor.php @@ -121,8 +121,7 @@ class Erasor implements $entity->clear($field . 'Data'); continue; - } - else if ($type === 'phone') { + } else if ($type === 'phone') { $phoneNumberList = $entity->get('phoneNumbers'); foreach ($phoneNumberList as $phoneNumber) { @@ -140,8 +139,7 @@ class Erasor implements $entity->clear($field . 'Data'); continue; - } - else if ($type === 'file' || $type === 'image') { + } else if ($type === 'file' || $type === 'image') { $attachmentId = $entity->get($field . 'Id'); if ($attachmentId) { @@ -151,8 +149,7 @@ class Erasor implements $this->entityManager->removeEntity($attachment); } } - } - else if ($type === 'attachmentMultiple') { + } else if ($type === 'attachmentMultiple') { $attachmentList = $entity->get($field); foreach ($attachmentList as $attachment) { @@ -166,8 +163,7 @@ class Erasor implements $entity->get($attribute) ) { $entity->set($attribute, null); - } - else { + } else { $entity->set($attribute, null); } } diff --git a/application/Espo/Tools/Email/AddressService.php b/application/Espo/Tools/Email/AddressService.php index 1a4ac3af89..f1d7c91204 100644 --- a/application/Espo/Tools/Email/AddressService.php +++ b/application/Espo/Tools/Email/AddressService.php @@ -215,8 +215,7 @@ class AddressService $whereClause = [ 'emailAddress*' => $filter . '%', ]; - } - else { + } else { $textFilter = $filter; } diff --git a/application/Espo/Tools/EmailNotification/Processor.php b/application/Espo/Tools/EmailNotification/Processor.php index a39916b33e..09f262c869 100644 --- a/application/Espo/Tools/EmailNotification/Processor.php +++ b/application/Espo/Tools/EmailNotification/Processor.php @@ -176,11 +176,9 @@ class Processor try { if ($type === Notification::TYPE_NOTE) { $this->processNotificationNote($notification); - } - else if ($type === Notification::TYPE_MENTION_IN_POST) { + } else if ($type === Notification::TYPE_MENTION_IN_POST) { $this->processNotificationMentionInPost($notification); - } - else { + } else { // For bc. $methodName = 'processNotification' . ucfirst($type ?? 'Dummy'); @@ -188,8 +186,7 @@ class Processor $this->$methodName($notification); } } - } - catch (Throwable $e) { + } catch (Throwable $e) { $this->log->error("Email Notification: " . $e->getMessage()); } @@ -229,8 +226,7 @@ class Processor $builder->where([ 'relatedParentType' => null, ]); - } - else { + } else { $builder->where([ 'OR' => [ [ @@ -250,8 +246,7 @@ class Processor $builder->where([ 'user.type!=' => User::TYPE_PORTAL, ]); - } - else if (!$forInternal && $forPortal) { + } else if (!$forInternal && $forPortal) { $builder->where([ 'user.type' => User::TYPE_PORTAL, ]); @@ -320,8 +315,7 @@ class Processor $data['parentName'] = $parent->get('name'); $data['parentType'] = $parentType; $data['parentId'] = $parentId; - } - else { + } else { $data['url'] = $this->getSiteUrl($user) . '/#Notification'; } @@ -543,8 +537,7 @@ class Processor $data, true ); - } - else { + } else { $data['url'] = $this->getSiteUrl($user) . '/#Notification'; $subjectTpl = $this->templateFileManager->getTemplate('notePostNoParent', 'subject'); @@ -615,8 +608,7 @@ class Processor if (in_array($defaultPortalId, $portalIdList)) { $portalId = $defaultPortalId; - } - else if (count($portalIdList)) { + } else if (count($portalIdList)) { $portalId = $portalIdList[0]; } @@ -630,8 +622,7 @@ class Processor $this->userIdPortalCacheMap[$user->getId()] = $portal; } - } - else { + } else { $portal = $this->userIdPortalCacheMap[$user->getId()]; } @@ -809,8 +800,7 @@ class Processor if (isset($noteData->personEntityName)) { $data['fromName'] = $noteData->personEntityName; - } - else if (isset($noteData->fromString)) { + } else if (isset($noteData->fromString)) { $data['fromName'] = $noteData->fromString; } diff --git a/application/Espo/Tools/EntityManager/EntityManager.php b/application/Espo/Tools/EntityManager/EntityManager.php index 8cae302987..6bb4255824 100644 --- a/application/Espo/Tools/EntityManager/EntityManager.php +++ b/application/Espo/Tools/EntityManager/EntityManager.php @@ -786,8 +786,7 @@ class EntityManager // @todo Remove. /** @var array> $params */ $params = array_merge($map1, $map2, $map3); - } - else { + } else { /** @var array> $params */ $params = [...$map1, ...$map2, ...$map3]; } diff --git a/application/Espo/Tools/Export/Api/PostProcess.php b/application/Espo/Tools/Export/Api/PostProcess.php index 9261692bde..c101826f9e 100644 --- a/application/Espo/Tools/Export/Api/PostProcess.php +++ b/application/Espo/Tools/Export/Api/PostProcess.php @@ -97,8 +97,7 @@ class PostProcess implements Action if (!is_null($searchParams)) { $params['searchParams'] = json_decode(Json::encode($searchParams), true); } - } - else if (!is_null($ids)) { + } else if (!is_null($ids)) { $params['ids'] = $ids; } diff --git a/application/Espo/Tools/Export/Format/Xlsx/AdditionalFieldsLoader.php b/application/Espo/Tools/Export/Format/Xlsx/AdditionalFieldsLoader.php index 89056b9cbb..af08f2a213 100644 --- a/application/Espo/Tools/Export/Format/Xlsx/AdditionalFieldsLoader.php +++ b/application/Espo/Tools/Export/Format/Xlsx/AdditionalFieldsLoader.php @@ -57,8 +57,7 @@ class AdditionalFieldsLoader implements AdditionalFieldsLoaderInterface if (!$entity->get($link . 'Name')) { $entity->loadParentNameField($link); } - } - else if ( + } else if ( ( ( $entity->getRelationType($link) === Entity::BELONGS_TO && diff --git a/application/Espo/Tools/Export/Format/Xlsx/FieldHelper.php b/application/Espo/Tools/Export/Format/Xlsx/FieldHelper.php index 3722f2fa14..fa5673c5b0 100644 --- a/application/Espo/Tools/Export/Format/Xlsx/FieldHelper.php +++ b/application/Espo/Tools/Export/Format/Xlsx/FieldHelper.php @@ -82,8 +82,7 @@ class FieldHelper $link = $fieldDefs->getParam('link'); $field = $fieldDefs->getParam('field'); - } - else if (str_contains($name, '_')) { + } else if (str_contains($name, '_')) { [$link, $field] = explode('_', $name); } diff --git a/application/Espo/Tools/Export/Format/Xlsx/PhpSpreadsheetProcessor.php b/application/Espo/Tools/Export/Format/Xlsx/PhpSpreadsheetProcessor.php index 0a737d10e6..a1f6f35025 100644 --- a/application/Espo/Tools/Export/Format/Xlsx/PhpSpreadsheetProcessor.php +++ b/application/Espo/Tools/Export/Format/Xlsx/PhpSpreadsheetProcessor.php @@ -411,30 +411,27 @@ class PhpSpreadsheetProcessor implements ProcessorInterface if (is_string($value)) { $sheet->setCellValueExplicit($coordinate, $value, DataType::TYPE_STRING); - } - else if (is_int($value) || is_float($value)) { + } else if (is_int($value) || is_float($value)) { $sheet->setCellValueExplicit($coordinate, $value, DataType::TYPE_NUMERIC); } + if (is_bool($value)) { $sheet->setCellValueExplicit($coordinate, $value, DataType::TYPE_BOOL); - } - else if ($value instanceof Date) { + } else if ($value instanceof Date) { $sheet->setCellValue( $coordinate, SharedDate::PHPToExcel( strtotime($value->toString()) ) ); - } - else if ($value instanceof DateTimeValue) { + } else if ($value instanceof DateTimeValue) { $sheet->setCellValue( $coordinate, SharedDate::PHPToExcel( strtotime($value->toDateTime()->format(DateTimeUtil::SYSTEM_DATE_TIME_FORMAT)) ) ); - } - else if ($value instanceof Currency) { + } else if ($value instanceof Currency) { $sheet->setCellValue($coordinate, $value->getAmount()); $sheet->getStyle($coordinate) @@ -518,22 +515,19 @@ class PhpSpreadsheetProcessor implements ProcessorInterface if ($entity->hasId()) { $link = $siteUrl . '/#' . $entityType . '/view/' . $entity->getId(); } - } - else if ($type === 'url') { + } else if ($type === 'url') { $value = $entity->get($name); if ($value && filter_var($value, FILTER_VALIDATE_URL)) { $link = $value; } - } - else if ($type === 'link') { + } else if ($type === 'link') { $idValue = $entity->get($name . 'Id'); if ($idValue && $foreignField) { if (!$foreignLink) { $foreignEntity = $this->metadata->get(['entityDefs', $entityType, 'links', $name, 'entity']); - } - else { + } else { $foreignEntity1 = $this->metadata ->get(['entityDefs', $entityType, 'links', $foreignLink, 'entity']); @@ -545,31 +539,26 @@ class PhpSpreadsheetProcessor implements ProcessorInterface $link = $siteUrl . '/#' . $foreignEntity . '/view/' . $idValue; } } - } - else if ($type === 'file') { + } else if ($type === 'file') { $idValue = $entity->get($name . 'Id'); if ($idValue) { $link = $siteUrl . '/?entryPoint=download&id=' . $idValue; } - } - else if ($type === 'linkParent') { + } else if ($type === 'linkParent') { $idValue = $entity->get($name . 'Id'); $typeValue = $entity->get($name . 'Type');; if ($idValue && $typeValue) { $link = $siteUrl . '/#' . $typeValue . '/view/' . $idValue; } - } - else if ($type === 'phone') { + } else if ($type === 'phone') { $value = $entity->get($name); if ($value) { $link = 'tel:' . $value; } - } - - else if ($type === 'email') { + } else if ($type === 'email') { $value = $entity->get($name); if ($value) { diff --git a/application/Espo/Tools/Export/Params.php b/application/Espo/Tools/Export/Params.php index 1c2d0dabfd..079e7fc292 100644 --- a/application/Espo/Tools/Export/Params.php +++ b/application/Espo/Tools/Export/Params.php @@ -105,8 +105,7 @@ class Params if ($ids) { throw new RuntimeException("Can't combine 'ids' and search params."); } - } - else if ($ids) { + } else if ($ids) { if (!is_array($ids)) { throw new RuntimeException("Bad 'ids'."); } diff --git a/application/Espo/Tools/FieldManager/FieldManager.php b/application/Espo/Tools/FieldManager/FieldManager.php index 8994c8b21d..69c480f2cd 100644 --- a/application/Espo/Tools/FieldManager/FieldManager.php +++ b/application/Espo/Tools/FieldManager/FieldManager.php @@ -300,8 +300,7 @@ class FieldManager if ($this->metadata->get(['fields', $type, 'fields', 'naming']) === 'prefix') { $subFieldName = $partField . ucfirst($name); $subFieldLabel = $partLabel . ' ' . $fieldDefs['label']; - } - else { + } else { $subFieldName = $name . ucfirst($partField); $subFieldLabel = $fieldDefs['label'] . ' ' . $partLabel; } @@ -336,8 +335,7 @@ class FieldManager $clientDefs['dynamicLogic']['fields'][$name]['visible'] = $fieldDefs['dynamicLogicVisible']; $clientDefsToBeSet = true; - } - else { + } else { if ( $this->metadata->get(['clientDefs', $scope, 'dynamicLogic', 'fields', $name, 'visible']) ) { @@ -355,8 +353,7 @@ class FieldManager $clientDefs['dynamicLogic']['fields'][$name]['readOnly'] = $fieldDefs['dynamicLogicReadOnly']; $clientDefsToBeSet = true; - } - else { + } else { if ( $this->metadata->get(['clientDefs', $scope, 'dynamicLogic', 'fields', $name, 'readOnly']) ) { @@ -395,8 +392,7 @@ class FieldManager $clientDefs['dynamicLogic']['options'][$name] = $fieldDefs['dynamicLogicOptions']; $clientDefsToBeSet = true; - } - else { + } else { if ($this->metadata->get(['clientDefs', $scope, 'dynamicLogic', 'options', $name])) { $this->prepareClientDefsOptionsDynamicLogic($clientDefs, $name); @@ -413,8 +409,7 @@ class FieldManager $clientDefs['dynamicLogic']['fields'][$name]['invalid'] = $fieldDefs['dynamicLogicInvalid']; $clientDefsToBeSet = true; - } - else { + } else { if ( $this->metadata->get(['clientDefs', $scope, 'dynamicLogic', 'fields', $name, 'invalid']) ) { @@ -632,8 +627,7 @@ class FieldManager if ($value && $value !== '') { $this->language->set($scope, 'tooltips', $name, $value); $this->baseLanguage->set($scope, 'tooltips', $name, $value); - } - else { + } else { $this->language->delete($scope, 'tooltips', $name); $this->baseLanguage->delete($scope, 'tooltips', $name); } diff --git a/application/Espo/Tools/GlobalSearch/Service.php b/application/Espo/Tools/GlobalSearch/Service.php index d40673e264..c1d1ff06ee 100644 --- a/application/Espo/Tools/GlobalSearch/Service.php +++ b/application/Espo/Tools/GlobalSearch/Service.php @@ -178,8 +178,7 @@ class Service if ($isPerson) { $selectList[] = 'firstName'; $selectList[] = 'lastName'; - } - else { + } else { $selectList[] = ['VALUE:', 'firstName']; $selectList[] = ['VALUE:', 'lastName']; } @@ -202,8 +201,7 @@ class Service $queryBuilder ->select($expression, 'relevance') ->order($expression, Order::DESC); - } - else { + } else { $queryBuilder->select(Expr::value(1.1), 'relevance'); } diff --git a/application/Espo/Tools/Import/Import.php b/application/Espo/Tools/Import/Import.php index 298977d060..afaf127c26 100644 --- a/application/Espo/Tools/Import/Import.php +++ b/application/Espo/Tools/Import/Import.php @@ -242,8 +242,7 @@ class Import } $import->set('status', ImportEntity::STATUS_IN_PROCESS); - } - else { + } else { /** @var ImportEntity $import */ $import = $this->entityManager->getNewEntity(ImportEntity::ENTITY_TYPE); @@ -258,8 +257,7 @@ class Import $params = $params->withIdleMode(false); $import->set('status', ImportEntity::STATUS_STANDBY); - } - else if ($params->isIdleMode()) { + } else if ($params->isIdleMode()) { $import->set('status', ImportEntity::STATUS_PENDING); } @@ -489,8 +487,7 @@ class Import $entity->set('id', $whereClause['id']); } } - } - else { + } else { $entity = $this->entityManager->getNewEntity($this->entityType); } diff --git a/application/Espo/Tools/Kanban/Kanban.php b/application/Espo/Tools/Kanban/Kanban.php index 03cf62877e..f88aa06c6c 100644 --- a/application/Espo/Tools/Kanban/Kanban.php +++ b/application/Espo/Tools/Kanban/Kanban.php @@ -208,8 +208,7 @@ class Kanban if (!$this->countDisabled) { $totalSub = $repository->clone($itemQuery)->count(); - } - else { + } else { $recordCollection = Collection::createNoCount($collectionSub, $maxSize); $collectionSub = $recordCollection->getCollection(); diff --git a/application/Espo/Tools/LabelManager/LabelManager.php b/application/Espo/Tools/LabelManager/LabelManager.php index 6ac8a8d134..b6cc65c09d 100644 --- a/application/Espo/Tools/LabelManager/LabelManager.php +++ b/application/Espo/Tools/LabelManager/LabelManager.php @@ -206,8 +206,7 @@ class LabelManager implements foreach ($categoryItem as $subKey => $subItem) { $finalData[$category][$category .'[.]' . $key .'[.]' . $subKey] = $subItem; } - } - else { + } else { $finalData[$category][$category .'[.]' . $key] = $categoryItem; } } @@ -245,8 +244,7 @@ class LabelManager implements if ($value !== '') { $languageObj->set($scope, $category, $name, $value); $setValue = $value; - } - else { + } else { $setValue = $languageOriginalObj->get(implode('.', [$scope, $category, $name])); if (is_null($setValue) && $scope !== 'Global') { $setValue = $languageOriginalObj->get(implode('.', ['Global', $category, $name])); @@ -254,8 +252,7 @@ class LabelManager implements $languageObj->delete($scope, $category, $name); } - } - else if (count($arr) == 3) { + } else if (count($arr) == 3) { $name = $arr[1]; $attribute = $arr[2]; @@ -267,8 +264,7 @@ class LabelManager implements if ($value !== '') { $data[$attribute] = $value; $setValue = $value; - } - else { + } else { $dataOriginal = $languageOriginalObj->get($scope . '.' . $category . '.' . $name); if (is_array($dataOriginal) && isset($dataOriginal[$attribute])) { diff --git a/application/Espo/Tools/LeadCapture/CaptureService.php b/application/Espo/Tools/LeadCapture/CaptureService.php index 69f0d8eb34..3d4a5ed715 100644 --- a/application/Espo/Tools/LeadCapture/CaptureService.php +++ b/application/Espo/Tools/LeadCapture/CaptureService.php @@ -211,8 +211,7 @@ class CaptureService if (!$lead) { throw new NotFound("Lead '$leadId' not found."); } - } - else { + } else { $lead = $this->getLeadWithPopulatedData($leadCapture, $data); } @@ -292,8 +291,7 @@ class CaptureService if (!$isAlreadyOptedIn) { if ($targetLead->isNew()) { $toRelateLead = true; - } - else { + } else { $isAlreadyOptedIn = $this->isTargetOptedIn($targetLead, $targetListId); if (!$isAlreadyOptedIn) { diff --git a/application/Espo/Tools/LeadCapture/ConfirmationSender.php b/application/Espo/Tools/LeadCapture/ConfirmationSender.php index e59f6c5adf..fbf5f898b6 100644 --- a/application/Espo/Tools/LeadCapture/ConfirmationSender.php +++ b/application/Espo/Tools/LeadCapture/ConfirmationSender.php @@ -140,8 +140,7 @@ class ConfirmationSender if ($leadId) { /** @var ?Lead $lead */ $lead = $this->entityManager->getEntityById(Lead::ENTITY_TYPE, $leadId); - } - else { + } else { $lead = $this->entityManager->getNewEntity(Lead::ENTITY_TYPE); $lead->set($data); diff --git a/application/Espo/Tools/LinkManager/LinkManager.php b/application/Espo/Tools/LinkManager/LinkManager.php index 6098af4032..edfa367bd7 100644 --- a/application/Espo/Tools/LinkManager/LinkManager.php +++ b/application/Espo/Tools/LinkManager/LinkManager.php @@ -329,8 +329,7 @@ class LinkManager ], ], ]; - } - else { + } else { $dataLeft = [ 'fields' => [ $link => [ @@ -924,17 +923,13 @@ class LinkManager if ($linkType === Entity::HAS_MANY && $foreignLinkType === Entity::HAS_MANY) { $type = LinkType::MANY_TO_MANY; - } - else if ($linkType === Entity::HAS_MANY && $foreignLinkType === Entity::BELONGS_TO) { + } else if ($linkType === Entity::HAS_MANY && $foreignLinkType === Entity::BELONGS_TO) { $type = LinkType::ONE_TO_MANY; - } - else if ($linkType === Entity::BELONGS_TO && $foreignLinkType === Entity::HAS_MANY) { + } else if ($linkType === Entity::BELONGS_TO && $foreignLinkType === Entity::HAS_MANY) { $type = LinkType::MANY_TO_ONE; - } - else if ($linkType === Entity::HAS_ONE && $foreignLinkType === Entity::BELONGS_TO) { + } else if ($linkType === Entity::HAS_ONE && $foreignLinkType === Entity::BELONGS_TO) { $type = LinkType::ONE_TO_ONE_LEFT; - } - else if ($linkType === Entity::BELONGS_TO && $foreignLinkType === Entity::HAS_ONE) { + } else if ($linkType === Entity::BELONGS_TO && $foreignLinkType === Entity::HAS_ONE) { $type = LinkType::ONE_TO_ONE_RIGHT; } diff --git a/application/Espo/Tools/Notification/NoteMentionHookProcessor.php b/application/Espo/Tools/Notification/NoteMentionHookProcessor.php index 1d5788f909..9ca7707f6c 100644 --- a/application/Espo/Tools/Notification/NoteMentionHookProcessor.php +++ b/application/Espo/Tools/Notification/NoteMentionHookProcessor.php @@ -85,8 +85,7 @@ class NoteMentionHookProcessor if ($mentionCount) { $data->mentions = $mentionData; - } - else { + } else { unset($data->mentions); } diff --git a/application/Espo/Tools/Notification/RecordService.php b/application/Espo/Tools/Notification/RecordService.php index 0408085f30..3c734c8326 100644 --- a/application/Espo/Tools/Notification/RecordService.php +++ b/application/Espo/Tools/Notification/RecordService.php @@ -210,8 +210,7 @@ class RecordService if ($parent) { $note->set('parentName', $parent->get('name')); } - } - else if (!$note->isGlobal()) { + } else if (!$note->isGlobal()) { $targetType = $note->getTargetType(); if (!$targetType || $targetType === Note::TARGET_USERS) { @@ -221,8 +220,7 @@ class RecordService if ($targetType !== Note::TARGET_USERS) { if (!$targetType || $targetType === Note::TARGET_TEAMS) { $note->loadLinkMultipleField('teams'); - } - else if ($targetType === Note::TARGET_PORTALS) { + } else if ($targetType === Note::TARGET_PORTALS) { $note->loadLinkMultipleField('portals'); } } diff --git a/application/Espo/Tools/Stream/NoteAcl/Processor.php b/application/Espo/Tools/Stream/NoteAcl/Processor.php index cd47964b07..0f186d0b8a 100644 --- a/application/Espo/Tools/Stream/NoteAcl/Processor.php +++ b/application/Espo/Tools/Stream/NoteAcl/Processor.php @@ -89,11 +89,9 @@ class Processor if ($fieldDefs->getType() === FieldType::LINK_MULTIPLE) { $ownerUserIdAttribute = $ownerUserField . 'Ids'; - } - else if ($fieldDefs->getType() === FieldType::LINK) { + } else if ($fieldDefs->getType() === FieldType::LINK) { $ownerUserIdAttribute = $ownerUserField . 'Id'; - } - else { + } else { throw new LogicException("Bad read-owner user field type."); } @@ -104,8 +102,7 @@ class Processor if ($usersAttributeIsChanged || $notify) { if ($fieldDefs->getType() === FieldType::LINK_MULTIPLE) { $userIdList = $entity->getLinkMultipleIdList($ownerUserField); - } - else { + } else { $userId = $entity->get($ownerUserIdAttribute); $userIdList = $userId ? [$userId] : []; diff --git a/application/Espo/Tools/Stream/Service.php b/application/Espo/Tools/Stream/Service.php index d5810fab88..a561c184f0 100644 --- a/application/Espo/Tools/Stream/Service.php +++ b/application/Espo/Tools/Stream/Service.php @@ -408,11 +408,9 @@ class Service if ($fieldDefs->getType() === FieldType::LINK_MULTIPLE) { $ownerUserIdAttribute = $ownerUserField . 'Ids'; - } - else if ($fieldDefs->getType() === FieldType::LINK) { + } else if ($fieldDefs->getType() === FieldType::LINK) { $ownerUserIdAttribute = $ownerUserField . 'Id'; - } - else { + } else { return; } @@ -422,8 +420,7 @@ class Service if ($fieldDefs->getType() === FieldType::LINK_MULTIPLE) { $userIdList = $entity->getLinkMultipleIdList($ownerUserField); - } - else { + } else { $userId = $entity->get($ownerUserIdAttribute); if (!$userId) { @@ -545,8 +542,7 @@ class Service if (!$user->isSystem()) { $person = $user; - } - else { + } else { $from = $email->get('from'); if ($from) { diff --git a/install/cli.php b/install/cli.php index 937673fef7..3ae65063d8 100644 --- a/install/cli.php +++ b/install/cli.php @@ -82,8 +82,7 @@ if (session_status() != \PHP_SESSION_ACTIVE) { $installerConfig->set('cliSessionId', session_id()); $installerConfig->save(); - } - else { + } else { session_id($installerConfig->get('cliSessionId')); } } @@ -92,8 +91,7 @@ ob_start(); try { require('entry.php'); -} -catch (\Throwable $e) { +} catch (\Throwable $e) { fwrite(\STDOUT, "Error: ". $e->getMessage() .".\n"); exit; diff --git a/install/core/Installer.php b/install/core/Installer.php index 5855eda18d..335e42d0a6 100644 --- a/install/core/Installer.php +++ b/install/core/Installer.php @@ -658,8 +658,7 @@ class Installer !isset($paramDefs['options']) ) { $normalizedParams[$name] = $value; - } - else if (array_key_exists('default', $paramDefs)) { + } else if (array_key_exists('default', $paramDefs)) { $normalizedParams[$name] = $paramDefs['default']; $GLOBALS['log']->warning( diff --git a/install/core/actions/createUser.php b/install/core/actions/createUser.php index e086207049..932cf3e84e 100644 --- a/install/core/actions/createUser.php +++ b/install/core/actions/createUser.php @@ -36,13 +36,11 @@ if (!empty($_SESSION['install']['user-name']) && !empty($_SESSION['install']['us if (!empty($userId)) { $result['success'] = true; - } - else { + } else { $result['success'] = false; $result['errorMsg'] = 'Cannot create user'; } -} -else { +} else { $result['success'] = false; $result['errorMsg'] = 'Cannot create user'; } diff --git a/install/core/actions/saveEmailSettings.php b/install/core/actions/saveEmailSettings.php index 5c3d783efc..9b65f4d530 100644 --- a/install/core/actions/saveEmailSettings.php +++ b/install/core/actions/saveEmailSettings.php @@ -68,13 +68,11 @@ if (!empty($_SESSION['install'])) { $res = $installer->savePreferences($preferences); if (!empty($res)) { $result['success'] = true; - } - else { + } else { $result['success'] = false; $result['errorMsg'] = 'Cannot save preferences'; } -} -else { +} else { $result['success'] = false; $result['errorMsg'] = 'Cannot save preferences'; } diff --git a/install/core/actions/savePreferences.php b/install/core/actions/savePreferences.php index de7df38972..ee1090beb6 100644 --- a/install/core/actions/savePreferences.php +++ b/install/core/actions/savePreferences.php @@ -52,8 +52,7 @@ if (!empty($_SESSION['install'])) { $res = $installer->savePreferences($preferences); if (!empty($res)) { $result['success'] = true; - } - else { + } else { $result['success'] = false; $result['errorMsg'] = 'Cannot save preferences'; } diff --git a/install/core/actions/step1.php b/install/core/actions/step1.php index 67f73b9663..b1ee65110f 100644 --- a/install/core/actions/step1.php +++ b/install/core/actions/step1.php @@ -36,8 +36,7 @@ $fields = array( foreach ($fields as $fieldName => $field) { if (isset($_SESSION['install'][$fieldName])) { $fields[$fieldName]['value'] = $_SESSION['install'][$fieldName]; - } - else { + } else { $fields[$fieldName]['value'] = (isset($fields[$fieldName]['default']))? $fields[$fieldName]['default'] : ''; } } diff --git a/install/core/actions/step3.php b/install/core/actions/step3.php index 03c6340f59..3fabe06b35 100644 --- a/install/core/actions/step3.php +++ b/install/core/actions/step3.php @@ -38,8 +38,7 @@ $fields = array( foreach ($fields as $fieldName => $field) { if (isset($_SESSION['install'][$fieldName])) { $fields[$fieldName]['value'] = $_SESSION['install'][$fieldName]; - } - else { + } else { $fields[$fieldName]['value'] = (isset($fields[$fieldName]['default']))? $fields[$fieldName]['default'] : ''; } } diff --git a/tests/integration/Core/Tester.php b/tests/integration/Core/Tester.php index a65ef2fffa..9ff49a1e9d 100644 --- a/tests/integration/Core/Tester.php +++ b/tests/integration/Core/Tester.php @@ -140,11 +140,9 @@ class Tester if (file_exists($this->configPath)) { $data = include($this->configPath); - } - else if (getenv('TEST_DATABASE_NAME')) { + } else if (getenv('TEST_DATABASE_NAME')) { $data = include($this->envConfigPath); - } - else { + } else { die('Config for integration tests ['. $this->configPath .'] is not found'); } @@ -224,8 +222,7 @@ class Tester ->withMethod($this->authenticationMethod); $auth->login($authenticationData, $request, $response); - } - else { + } else { $this->application->setupSystemUser(); } } diff --git a/tests/unit/Espo/Core/Formula/ParserTest.php b/tests/unit/Espo/Core/Formula/ParserTest.php index 503b52ef0b..43befa5a39 100644 --- a/tests/unit/Espo/Core/Formula/ParserTest.php +++ b/tests/unit/Espo/Core/Formula/ParserTest.php @@ -889,8 +889,7 @@ class ParserTest extends \PHPUnit\Framework\TestCase $array[] = var_export($key, true) . " => " . $this->varExport($value, $level + 1); } $result = "[\n" . $tab . implode(",\n" . $tab, $array) . "\n" . $prevTab . "]"; - } - else { + } else { $result = var_export($variable, true); } diff --git a/tests/unit/Espo/Core/Select/AccessControl/FilterResolverFactoryTest.php b/tests/unit/Espo/Core/Select/AccessControl/FilterResolverFactoryTest.php index c2b5a987b6..0a2694c7b7 100644 --- a/tests/unit/Espo/Core/Select/AccessControl/FilterResolverFactoryTest.php +++ b/tests/unit/Espo/Core/Select/AccessControl/FilterResolverFactoryTest.php @@ -114,8 +114,7 @@ class FilterResolverFactoryTest extends \PHPUnit\Framework\TestCase if (!$this->user->isPortal()) { $defaultClassName = DefaultFilterResolver::class; - } - else { + } else { $defaultClassName = DefaultPortalFilterResolver::class; } diff --git a/tests/unit/Espo/Core/Select/Applier/Appliers/OrderApplierTest.php b/tests/unit/Espo/Core/Select/Applier/Appliers/OrderApplierTest.php index 32f987b209..9eab387cb2 100644 --- a/tests/unit/Espo/Core/Select/Applier/Appliers/OrderApplierTest.php +++ b/tests/unit/Espo/Core/Select/Applier/Appliers/OrderApplierTest.php @@ -279,8 +279,7 @@ class OrderApplierTest extends TestCase ->method('convert') ->with($item) ->willReturn($converterResult); - } - else { + } else { if ($notExisting) { $this->expectException(BadRequest::class); diff --git a/tests/unit/Espo/Core/Select/Order/ItemConverterFactoryTest.php b/tests/unit/Espo/Core/Select/Order/ItemConverterFactoryTest.php index d12f957094..6fa3a67091 100644 --- a/tests/unit/Espo/Core/Select/Order/ItemConverterFactoryTest.php +++ b/tests/unit/Espo/Core/Select/Order/ItemConverterFactoryTest.php @@ -92,8 +92,7 @@ class ItemConverterFactoryTest extends \PHPUnit\Framework\TestCase [['entityDefs', $entityType, 'fields', $field, 'type'], null, $type], [['app', 'select', 'orderItemConverterClassNameMap', $type], null, $className2], ]); - } - else { + } else { $this->metadata ->expects($this->any()) ->method('get')