From 3828d9f221c2f52d7fc862eb75763c94d3d7aaac Mon Sep 17 00:00:00 2001 From: Jonas Eberle Date: Mon, 23 Nov 2020 01:36:41 +0100 Subject: [PATCH] [TASK] lint --- Classes/Generator/FlexFormGenerator.php | 44 ++++++++-------- Classes/Generator/TcaGenerator.php | 9 ++-- Classes/Service/ConfigurationService.php | 1 - .../tx_contentblocks_reg_api_collection.php | 52 ++++++++++--------- 4 files changed, 54 insertions(+), 52 deletions(-) diff --git a/Classes/Generator/FlexFormGenerator.php b/Classes/Generator/FlexFormGenerator.php index f1e0080..1246e01 100644 --- a/Classes/Generator/FlexFormGenerator.php +++ b/Classes/Generator/FlexFormGenerator.php @@ -22,7 +22,8 @@ class FlexFormGenerator */ protected $dataService; - public function __construct(DataService $dataService) { + public function __construct(DataService $dataService) + { $this->dataService = $dataService; } @@ -121,17 +122,19 @@ protected function createInputField(array $field, array $contentBlock) :string $additionlConfig .= ' ' . floatval( - ($field['properties']['range']['lower'] !== '' + ( + $field['properties']['range']['lower'] !== '' ? $field['properties']['range']['lower'] : '0' - ) - ) . ' + ) + ) . ' ' . floatval( - ($field['properties']['range']['upper'] !== '' + ( + $field['properties']['range']['upper'] !== '' ? $field['properties']['range']['upper'] : '100' - ) - ) . ' + ) + ) . ' '; } if ($field['type'] === 'Percent') { @@ -290,11 +293,12 @@ protected function createTextarea(array $field, array $contentBlock) :string ' . ($field['properties']['rows'] === true ? $field['properties']['rows'] : '3') . ' ' . ($field['properties']['enableRichtext'] === true ? 'true' : '') . ' ' . ( - strlen( - $field['properties']['richtextConfiguration'] . '' - ) > 0 + strlen( + $field['properties']['richtextConfiguration'] . '' + ) > 0 ? '' . $field['properties']['richtextConfiguration'] . '' - : '') . ' + : '' + ) . ' ' . ($field['properties']['required'] === true ? 'required' : '') . ($field['properties']['trim'] === true && $field['properties']['required'] === true ? ', ' : '') . ($field['properties']['trim'] === true ? 'trim ' : '') . ' ' . $field['properties']['placeholder'] . ' ' . $field['properties']['default'] . ' @@ -315,8 +319,7 @@ protected function createCollection(array $field, array $contentBlock) :string foreach ($field['properties']['fields'] as $collectionField) { if ($collectionField['type'] === 'Collection') { $fieldsConfig = $fieldsConfig . $this->createCollection($collectionField, $contentBlock); - } - else { + } else { $fieldsConfig .= $this->createField($collectionField, $contentBlock); } } @@ -360,12 +363,12 @@ protected function createCollection(array $field, array $contentBlock) :string . ' ' . ( - ($field['properties']['minItems'] ?? false) + ($field['properties']['minItems'] ?? false) ? '' . $field['properties']['minItems'] . '' : '' ) . ( - ($field['properties']['maxItems'] ?? false) + ($field['properties']['maxItems'] ?? false) ? '' . $field['properties']['maxItems'] . '' : '' ) @@ -538,26 +541,25 @@ protected function createField(array $field, array $contentBlock) :string case 'Date': case 'DateTime': case 'Time': - return FlexFormGenerator::createInputField($field, $contentBlock); + return $this->createInputField($field, $contentBlock); case 'Textarea': case 'TextMultiline': - return FlexFormGenerator::createTextarea($field, $contentBlock); + return $this->createTextarea($field, $contentBlock); case 'Link': case 'Url': - return FlexFormGenerator::createTypoLink($field, $contentBlock); + return $this->createTypoLink($field, $contentBlock); case 'Image': case 'Icon': - return FlexFormGenerator::createImageField($field, $contentBlock); + return $this->createImageField($field, $contentBlock); case 'Select': case 'Checkbox': case 'MultiSelect': case 'Radiobox': case 'Toggle': - return FlexFormGenerator::createSelections($field, $contentBlock); + return $this->createSelections($field, $contentBlock); default: return ''; } } } } - diff --git a/Classes/Generator/TcaGenerator.php b/Classes/Generator/TcaGenerator.php index a089959..09ec3d8 100644 --- a/Classes/Generator/TcaGenerator.php +++ b/Classes/Generator/TcaGenerator.php @@ -11,15 +11,14 @@ namespace Typo3Contentblocks\ContentblocksRegApi\Generator; -use Typo3Contentblocks\ContentblocksRegApi\Service\ConfigurationService; -use Typo3Contentblocks\ContentblocksRegApi\Generator\FlexFormGenerator; use TYPO3\CMS\Core\Utility\GeneralUtility; +use Typo3Contentblocks\ContentblocksRegApi\Service\ConfigurationService; class TcaGenerator { /** * Get default flexform configuration of the tt_content.content_block field - * + * */ public function contentBlockFlexformColumnTca() :array { @@ -125,8 +124,8 @@ public function setTca() :void /*************** * Add flexForms for content element configuration */ - $flexFormGenerator = GeneralUtility::makeInstance(FlexFormGenerator::class) - ->createFlexform($contentBlock ); + GeneralUtility::makeInstance(FlexFormGenerator::class) + ->createFlexform($contentBlock); } } } diff --git a/Classes/Service/ConfigurationService.php b/Classes/Service/ConfigurationService.php index b9ccd07..5be4ae8 100644 --- a/Classes/Service/ConfigurationService.php +++ b/Classes/Service/ConfigurationService.php @@ -242,7 +242,6 @@ function ($e) use ($path) { ); } - /** * @param string $cType * @param array $path diff --git a/Configuration/TCA/tx_contentblocks_reg_api_collection.php b/Configuration/TCA/tx_contentblocks_reg_api_collection.php index 0d16cb7..9a2fc8c 100644 --- a/Configuration/TCA/tx_contentblocks_reg_api_collection.php +++ b/Configuration/TCA/tx_contentblocks_reg_api_collection.php @@ -1,7 +1,9 @@ 'endtime', ], 'typeicon_classes' => [ - 'default' => 'ext-contentblocks_reg_api' + 'default' => 'ext-contentblocks_reg_api', ], ], 'interface' => [ @@ -53,23 +55,23 @@ --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.visibility;visibility, --palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.access;access, --palette--;;hiddenLanguagePalette, - ' + ', ], ], 'palettes' => [ '1' => [ - 'showitem' => '' + 'showitem' => '', ], 'access' => [ 'showitem' => ' starttime;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:starttime_formlabel, endtime;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:endtime_formlabel - ' + ', ], 'visibility' => [ 'showitem' => ' hidden;LLL:EXT:bootstrap_package/Resources/Private/Language/Backend.xlf:card_group_item - ' + ', ], // hidden but needs to be included all the time, so sys_language_uid is set correctly 'hiddenLanguagePalette' => [ @@ -88,10 +90,10 @@ [ 0 => '', 1 => '', - 'invertStateDisplay' => true - ] + 'invertStateDisplay' => true, + ], ], - ] + ], ], 'starttime' => [ 'exclude' => true, @@ -100,10 +102,10 @@ 'type' => 'input', 'renderType' => 'inputDateTime', 'eval' => 'datetime', - 'default' => 0 + 'default' => 0, ], 'l10n_mode' => 'exclude', - 'l10n_display' => 'defaultAsReadonly' + 'l10n_display' => 'defaultAsReadonly', ], 'endtime' => [ 'exclude' => true, @@ -114,11 +116,11 @@ 'eval' => 'datetime', 'default' => 0, 'range' => [ - 'upper' => mktime(0, 0, 0, 1, 1, 2038) - ] + 'upper' => mktime(0, 0, 0, 1, 1, 2038), + ], ], 'l10n_mode' => 'exclude', - 'l10n_display' => 'defaultAsReadonly' + 'l10n_display' => 'defaultAsReadonly', ], 'sys_language_uid' => [ 'exclude' => 1, @@ -131,15 +133,15 @@ 'items' => [ [ 'LLL:' . $generalLanguageFile . ':LGL.allLanguages', - -1 + -1, ], [ 'LLL:' . $generalLanguageFile . ':LGL.default_value', - 0 - ] + 0, + ], ], 'allowNonIdValues' => true, - ] + ], ], 'l10n_parent' => [ 'displayCond' => 'FIELD:sys_language_uid:>:0', @@ -151,18 +153,18 @@ 'items' => [ [ '', - 0 - ] + 0, + ], ], 'foreign_table' => 'tx_contentblocks_reg_api_collection', 'foreign_table_where' => 'AND tx_contentblocks_reg_api_collection.pid=###CURRENT_PID### AND tx_contentblocks_reg_api_collection.sys_language_uid IN (-1,0)', - 'default' => 0 - ] + 'default' => 0, + ], ], 'l10n_diffsource' => [ 'config' => [ - 'type' => 'passthrough' - ] + 'type' => 'passthrough', + ], ], 'content_block' => [ 'label' => 'Content Block Data', @@ -197,6 +199,6 @@ 'type' => 'input', 'size' => 500, ], - ] + ], ], ];