Commit 63fd158d authored by Stefan Neufeind's avatar Stefan Neufeind
Browse files

[TASK] Remove ternary operator where not needed

The usage of the ternary operator just for conversion to boolean like
... ? TRUE : FALSE
is be replaced by a normal (bool) typecast.

Change-Id: Ia32f63b423ffa7e066c9cf8bb002dde51b419bfa
Resolves: #68063
Releases: master
Reviewed-on: http://review.typo3.org/41110

Reviewed-by: Markus Klein's avatarMarkus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein's avatarMarkus Klein <markus.klein@typo3.org>
Reviewed-by: default avatarStefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: default avatarStefan Neufeind <typo3.neufeind@speedpartner.de>
parent 1c7d7b75
......@@ -88,7 +88,7 @@ class EidRequestHandler implements RequestHandlerInterface {
* @return bool If the request is not an eID request, TRUE otherwise FALSE
*/
public function canHandleRequest(ServerRequestInterface $request) {
return $request->getQueryParams()['eID'] || $request->getParsedBody()['eID'] ? TRUE : FALSE;
return $request->getQueryParams()['eID'] || $request->getParsedBody()['eID'];
}
/**
......
......@@ -458,7 +458,7 @@ class PageGenerator {
// To fix MSIE 6 that cannot handle these as relative paths (according to Ben v Ende)
$ss = GeneralUtility::dirname(GeneralUtility::getIndpEnv('SCRIPT_NAME')) . '/' . $ss;
}
$pageRenderer->addCssInlineBlock('import_' . $key, '@import url("' . htmlspecialchars($ss) . '") ' . htmlspecialchars($cssFileConfig['media']) . ';', empty($cssFileConfig['disableCompression']), $cssFileConfig['forceOnTop'] ? TRUE : FALSE, '');
$pageRenderer->addCssInlineBlock('import_' . $key, '@import url("' . htmlspecialchars($ss) . '") ' . htmlspecialchars($cssFileConfig['media']) . ';', empty($cssFileConfig['disableCompression']), (bool)$cssFileConfig['forceOnTop'], '');
} else {
$pageRenderer->addCssFile(
$ss,
......@@ -466,9 +466,9 @@ class PageGenerator {
$cssFileConfig['media'] ?: 'all',
$cssFileConfig['title'] ?: '',
empty($cssFileConfig['disableCompression']),
$cssFileConfig['forceOnTop'] ? TRUE : FALSE,
(bool)$cssFileConfig['forceOnTop'],
$cssFileConfig['allWrap'],
$cssFileConfig['excludeFromConcatenation'] ? TRUE : FALSE,
(bool)$cssFileConfig['excludeFromConcatenation'],
$cssFileConfig['allWrap.']['splitChar']
);
unset($cssFileConfig);
......@@ -491,7 +491,7 @@ class PageGenerator {
// To fix MSIE 6 that cannot handle these as relative paths (according to Ben v Ende)
$ss = GeneralUtility::dirname(GeneralUtility::getIndpEnv('SCRIPT_NAME')) . '/' . $ss;
}
$pageRenderer->addCssInlineBlock('import_' . $key, '@import url("' . htmlspecialchars($ss) . '") ' . htmlspecialchars($cssFileConfig['media']) . ';', empty($cssFileConfig['disableCompression']), $cssFileConfig['forceOnTop'] ? TRUE : FALSE, '');
$pageRenderer->addCssInlineBlock('import_' . $key, '@import url("' . htmlspecialchars($ss) . '") ' . htmlspecialchars($cssFileConfig['media']) . ';', empty($cssFileConfig['disableCompression']), (bool)$cssFileConfig['forceOnTop'], '');
} else {
$pageRenderer->addCssLibrary(
$ss,
......@@ -499,9 +499,9 @@ class PageGenerator {
$cssFileConfig['media'] ?: 'all',
$cssFileConfig['title'] ?: '',
empty($cssFileConfig['disableCompression']),
$cssFileConfig['forceOnTop'] ? TRUE : FALSE,
(bool)$cssFileConfig['forceOnTop'],
$cssFileConfig['allWrap'],
$cssFileConfig['excludeFromConcatenation'] ? TRUE : FALSE,
(bool)$cssFileConfig['excludeFromConcatenation'],
$cssFileConfig['allWrap.']['splitChar']
);
unset($cssFileConfig);
......@@ -593,8 +593,8 @@ class PageGenerator {
$pageRenderer->loadJQuery($version, $source, $namespace);
}
if ($tsfe->pSetup['javascriptLibs.']['ExtJs']) {
$css = $tsfe->pSetup['javascriptLibs.']['ExtJs.']['css'] ? TRUE : FALSE;
$theme = $tsfe->pSetup['javascriptLibs.']['ExtJs.']['theme'] ? TRUE : FALSE;
$css = (bool)$tsfe->pSetup['javascriptLibs.']['ExtJs.']['css'];
$theme = (bool)$tsfe->pSetup['javascriptLibs.']['ExtJs.']['theme'];
$pageRenderer->loadExtJs($css, $theme);
if ($tsfe->pSetup['javascriptLibs.']['ExtJs.']['debug']) {
$pageRenderer->enableExtJsDebug();
......@@ -637,11 +637,11 @@ class PageGenerator {
$ss,
$type,
empty($jsFileConfig['disableCompression']),
$jsFileConfig['forceOnTop'] ? TRUE : FALSE,
(bool)$jsFileConfig['forceOnTop'],
$jsFileConfig['allWrap'],
$jsFileConfig['excludeFromConcatenation'] ? TRUE : FALSE,
(bool)$jsFileConfig['excludeFromConcatenation'],
$jsFileConfig['allWrap.']['splitChar'],
$jsFileConfig['async'] ? TRUE : FALSE,
(bool)$jsFileConfig['async'],
$jsFileConfig['integrity']
);
unset($jsFileConfig);
......@@ -667,11 +667,11 @@ class PageGenerator {
$ss,
$type,
empty($jsFileConfig['disableCompression']),
$jsFileConfig['forceOnTop'] ? TRUE : FALSE,
(bool)$jsFileConfig['forceOnTop'],
$jsFileConfig['allWrap'],
$jsFileConfig['excludeFromConcatenation'] ? TRUE : FALSE,
(bool)$jsFileConfig['excludeFromConcatenation'],
$jsFileConfig['allWrap.']['splitChar'],
$jsFileConfig['async'] ? TRUE : FALSE,
(bool)$jsFileConfig['async'],
$jsFileConfig['integrity']
);
unset($jsFileConfig);
......@@ -697,11 +697,11 @@ class PageGenerator {
$ss,
$type,
empty($jsConfig['disableCompression']),
$jsConfig['forceOnTop'] ? TRUE : FALSE,
(bool)$jsConfig['forceOnTop'],
$jsConfig['allWrap'],
$jsConfig['excludeFromConcatenation'] ? TRUE : FALSE,
(bool)$jsConfig['excludeFromConcatenation'],
$jsConfig['allWrap.']['splitChar'],
$jsConfig['async'] ? TRUE : FALSE,
(bool)$jsConfig['async'],
$jsConfig['integrity']
);
unset($jsConfig);
......@@ -726,11 +726,11 @@ class PageGenerator {
$ss,
$type,
empty($jsConfig['disableCompression']),
$jsConfig['forceOnTop'] ? TRUE : FALSE,
(bool)$jsConfig['forceOnTop'],
$jsConfig['allWrap'],
$jsConfig['excludeFromConcatenation'] ? TRUE : FALSE,
(bool)$jsConfig['excludeFromConcatenation'],
$jsConfig['allWrap.']['splitChar'],
$jsConfig['async'] ? TRUE : FALSE,
(bool)$jsConfig['async'],
$jsConfig['integrity']
);
unset($jsConfig);
......
......@@ -41,7 +41,7 @@ class EidUtility {
* @return bool
*/
static public function isEidRequest() {
return GeneralUtility::_GP('eID') ? TRUE : FALSE;
return (bool)GeneralUtility::_GP('eID');
}
/**
......
......@@ -149,7 +149,7 @@ class SearchController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControlle
}
// Indexer configuration from Extension Manager interface:
$this->indexerConfig = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['indexed_search']);
$this->enableMetaphoneSearch = $this->indexerConfig['enableMetaphoneSearch'] ? TRUE : FALSE;
$this->enableMetaphoneSearch = (bool)$this->indexerConfig['enableMetaphoneSearch'];
$this->initializeExternalParsers();
// If "_sections" is set, this value overrides any existing value.
if ($searchData['_sections']) {
......
......@@ -165,6 +165,9 @@ class SearchFormController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {
*/
public $indexerConfig = array();
/**
* @var bool
*/
public $enableMetaphoneSearch = FALSE;
public $storeMetaphoneInfoAsWords;
......@@ -210,7 +213,7 @@ class SearchFormController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {
public function initialize() {
// Indexer configuration from Extension Manager interface:
$this->indexerConfig = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['indexed_search']);
$this->enableMetaphoneSearch = $this->indexerConfig['enableMetaphoneSearch'] ? TRUE : FALSE;
$this->enableMetaphoneSearch = (bool)$this->indexerConfig['enableMetaphoneSearch'];
$this->storeMetaphoneInfoAsWords = !\TYPO3\CMS\IndexedSearch\Utility\IndexedSearchUtility::isTableUsed('index_words');
// Initialize external document parsers for icon display and other soft operations
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['indexed_search']['external_parsers'])) {
......
......@@ -526,7 +526,7 @@ class CrawlerHook {
// (Re)-Indexing a row from a table:
$indexerObj = GeneralUtility::makeInstance(\TYPO3\CMS\IndexedSearch\Indexer::class);
parse_str(str_replace('###UID###', $r['uid'], $cfgRec['get_params']), $GETparams);
$indexerObj->backend_initIndexer($cfgRec['pid'], 0, $sys_language_uid, '', $rl, $GETparams, $cfgRec['chashcalc'] ? TRUE : FALSE);
$indexerObj->backend_initIndexer($cfgRec['pid'], 0, $sys_language_uid, '', $rl, $GETparams, (bool)$cfgRec['chashcalc']);
$indexerObj->backend_setFreeIndexUid($cfgRec['uid'], $cfgRec['set_id']);
$indexerObj->forceIndexing = TRUE;
$theContent = '';
......
......@@ -369,8 +369,8 @@ class Indexer {
$this->maxExternalFiles = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->indexerConfig['maxExternalFiles'], 0, 1000, 5);
$this->flagBitMask = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->indexerConfig['flagBitMask'], 0, 255);
// Workaround: If the extension configuration was not updated yet, the value is not existing
$this->enableMetaphoneSearch = isset($this->indexerConfig['enableMetaphoneSearch']) ? ($this->indexerConfig['enableMetaphoneSearch'] ? TRUE : FALSE) : TRUE;
$this->storeMetaphoneInfoAsWords = \TYPO3\CMS\IndexedSearch\Utility\IndexedSearchUtility::isTableUsed('index_words') ? FALSE : ($this->enableMetaphoneSearch ? TRUE : FALSE);
$this->enableMetaphoneSearch = !isset($this->indexerConfig['enableMetaphoneSearch']) || $this->indexerConfig['enableMetaphoneSearch'];
$this->storeMetaphoneInfoAsWords = !\TYPO3\CMS\IndexedSearch\Utility\IndexedSearchUtility::isTableUsed('index_words') && $this->enableMetaphoneSearch;
// Initialize external document parsers:
// Example configuration, see ext_localconf.php of this file!
if ($this->conf['index_externals']) {
......
......@@ -96,8 +96,8 @@ class AllConfiguration extends Action\AbstractAction {
}
$description = trim($commentArray[$sectionName][$key]);
$isTextarea = preg_match('/^(<.*?>)?string \\(textarea\\)/i', $description) ? TRUE : FALSE;
$doNotRender = preg_match('/^(<.*?>)?string \\(exclude\\)/i', $description) ? TRUE : FALSE;
$isTextarea = (bool)preg_match('/^(<.*?>)?string \\(textarea\\)/i', $description);
$doNotRender = (bool)preg_match('/^(<.*?>)?string \\(exclude\\)/i', $description);
if (!is_array($value) && !$doNotRender && (!preg_match('/[' . LF . CR . ']/', $value) || $isTextarea)) {
$itemData = array();
......
......@@ -116,7 +116,7 @@ class Language extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
* @return void
*/
public function setSelected($selected) {
$this->selected = $selected ? TRUE : FALSE;
$this->selected = (bool)$selected;
}
/**
......
......@@ -271,7 +271,7 @@ class DatabaseIntegrityView extends BaseScriptClass {
$this->view->assign('PATH_typo3', PATH_typo3);
if (GeneralUtility::_GP('_update') || GeneralUtility::_GP('_check')) {
$testOnly = GeneralUtility::_GP('_check') ? TRUE : FALSE;
$testOnly = (bool)GeneralUtility::_GP('_check');
// Call the functionality
$refIndexObj = GeneralUtility::makeInstance(ReferenceIndex::class);
list(,$bodyContent) = $refIndexObj->updateIndex($testOnly);
......
......@@ -357,7 +357,7 @@ class AbstractDatabaseRecordList extends AbstractRecordList {
$this->searchLevels = (int)$levels;
$this->showLimit = MathUtility::forceIntegerInRange($showLimit, 0, 10000);
// Setting GPvars:
$this->csvOutput = GeneralUtility::_GP('csv') ? TRUE : FALSE;
$this->csvOutput = (bool)GeneralUtility::_GP('csv');
$this->sortField = GeneralUtility::_GP('sortField');
$this->sortRev = GeneralUtility::_GP('sortRev');
$this->displayFields = GeneralUtility::_GP('displayFields');
......
......@@ -50,11 +50,11 @@ class RecyclerUtility {
if ($table === 'pages') {
// If pages:
$calculatedPermissions = $backendUser->calcPerms($calcPRec);
$hasAccess = $calculatedPermissions & Permission::PAGE_EDIT ? TRUE : FALSE;
$hasAccess = (bool)($calculatedPermissions & Permission::PAGE_EDIT);
} else {
$calculatedPermissions = $backendUser->calcPerms(BackendUtility::getRecord('pages', $calcPRec['pid']));
// Fetching pid-record first.
$hasAccess = $calculatedPermissions & Permission::CONTENT_EDIT ? TRUE : FALSE;
$hasAccess = (bool)($calculatedPermissions & Permission::CONTENT_EDIT);
}
// Check internals regarding access:
if ($hasAccess) {
......
......@@ -85,7 +85,7 @@ class Spellchecker extends RteHtmlAreaApi {
$spellCheckerMode = 'normal';
}
// Set the use of personal dictionary
$enablePersonalDicts = $this->configuration['thisConfig']['buttons.'][$button . '.']['enablePersonalDictionaries'] ? (isset($GLOBALS['BE_USER']->userTS['options.']['enablePersonalDicts']) && $GLOBALS['BE_USER']->userTS['options.']['enablePersonalDicts'] ? TRUE : FALSE) : FALSE;
$enablePersonalDicts = $this->configuration['thisConfig']['buttons.'][$button . '.']['enablePersonalDictionaries'] && !empty($GLOBALS['BE_USER']->userTS['options.']['enablePersonalDicts']);
if (in_array($button, $this->toolbar)) {
if (!is_array($this->configuration['thisConfig']['buttons.']) || !is_array($this->configuration['thisConfig']['buttons.'][($button . '.')])) {
$jsArray[] = 'RTEarea[editornumber].buttons.' . $button . ' = new Object();';
......
......@@ -246,7 +246,7 @@ class BlowfishSalt extends Md5Salt {
*/
public function isValidSaltedPW($saltedPW) {
$isValid = FALSE;
$isValid = !strncmp($this->getSetting(), $saltedPW, strlen($this->getSetting())) ? TRUE : FALSE;
$isValid = !strncmp($this->getSetting(), $saltedPW, strlen($this->getSetting()));
if ($isValid) {
$isValid = $this->isValidSalt($saltedPW);
}
......
......@@ -216,7 +216,7 @@ class Md5Salt extends AbstractSalt implements SaltInterface {
*/
public function isValidSaltedPW($saltedPW) {
$isValid = FALSE;
$isValid = !strncmp($this->getSetting(), $saltedPW, strlen($this->getSetting())) ? TRUE : FALSE;
$isValid = !strncmp($this->getSetting(), $saltedPW, strlen($this->getSetting()));
if ($isValid) {
$isValid = $this->isValidSalt($saltedPW);
}
......
......@@ -337,7 +337,7 @@ class PhpassSalt extends AbstractSalt implements SaltInterface {
*/
public function isValidSaltedPW($saltedPW) {
$isValid = FALSE;
$isValid = !strncmp($this->getSetting(), $saltedPW, strlen($this->getSetting())) ? TRUE : FALSE;
$isValid = !strncmp($this->getSetting(), $saltedPW, strlen($this->getSetting()));
if ($isValid) {
$isValid = $this->isValidSalt($saltedPW);
}
......
......@@ -640,7 +640,7 @@ class SetupModuleController {
$localizedName = htmlspecialchars($name);
}
$localLabel = ' - [' . htmlspecialchars($defaultName) . ']';
$available = is_dir(PATH_typo3conf . 'l10n/' . $locale) ? TRUE : FALSE;
$available = is_dir(PATH_typo3conf . 'l10n/' . $locale);
if ($available) {
$languageOptions[$defaultName] = '<option value="' . $locale . '"' . ($this->getBackendUser()->uc['lang'] === $locale ? ' selected="selected"' : '') . '>' . $localizedName . $localLabel . '</option>';
}
......
......@@ -104,7 +104,7 @@ class TypoScriptTemplateInfoHook {
$tmpl->init();
// Get the row of the first VISIBLE template of the page. whereclause like the frontend.
$tplRow = $tmpl->ext_getFirstTemplate($pageId, $template_uid);
$existTemplate = is_array($tplRow) ? TRUE : FALSE;
$existTemplate = is_array($tplRow);
if ($existTemplate) {
$saveId = $tplRow['_ORIG_uid'] ?: $tplRow['uid'];
// Update template ?
......
......@@ -63,7 +63,7 @@ class ReviewController extends AbstractController {
}
}
}
$this->pageRenderer->addInlineSetting('Workspaces', 'isLiveWorkspace', (int)$GLOBALS['BE_USER']->workspace === 0 ? TRUE : FALSE);
$this->pageRenderer->addInlineSetting('Workspaces', 'isLiveWorkspace', (int)$GLOBALS['BE_USER']->workspace === 0);
$this->pageRenderer->addInlineSetting('Workspaces', 'workspaceTabs', $this->prepareWorkspaceTabs($wsList, $activeWorkspace));
$this->pageRenderer->addInlineSetting('Workspaces', 'activeWorkspaceId', $activeWorkspace);
$this->pageRenderer->addInlineSetting('FormEngine', 'moduleUrl', BackendUtility::getModuleUrl('record_edit'));
......
......@@ -424,7 +424,7 @@ class ActionHandler extends AbstractHandler {
return array(
'success' => TRUE,
// force refresh after publishing changes
'refreshLivePanel' => $parameters->stageId == -20 ? TRUE : FALSE
'refreshLivePanel' => $parameters->stageId == -20
);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment