diff --git a/.github/workflows/cla-check.yml b/.github/workflows/cla-check.yml new file mode 100644 index 00000000..2b3f2fbc --- /dev/null +++ b/.github/workflows/cla-check.yml @@ -0,0 +1,27 @@ +name: CLA Check +on: + issue_comment: + types: [created] + pull_request_target: + types: [opened, closed, synchronize] + +permissions: + actions: write + contents: write + pull-requests: write + statuses: write + +jobs: + CLAAssistant: + runs-on: ubuntu-latest + steps: + - name: "CLA Assistant" + if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target' + uses: contributor-assistant/github-action@v2.5.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + path-to-signatures: 'signatures/version1/cla.json' + path-to-document: 'https://github.com/instride-ch/pimcore-data-definitions/blob/5.0/CLA.md' + branch: "5.0" + allowlist: user1,bot* \ No newline at end of file diff --git a/.github/workflows/codestyles.yml b/.github/workflows/codestyles.yml new file mode 100644 index 00000000..efd2c942 --- /dev/null +++ b/.github/workflows/codestyles.yml @@ -0,0 +1,48 @@ +name: Coding standard refactor + +on: + schedule: + - cron: "0 2 * * MON" # Run at 2am every Monday + workflow_dispatch: ~ + +jobs: + coding-standard: + runs-on: ubuntu-latest + name: "Coding standard refactor" + + timeout-minutes: 5 + + strategy: + fail-fast: false + matrix: + branch: [ '4.0' ] + + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ matrix.branch }} + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.1 + + - name: Install PHP dependencies + run: composer update --no-interaction --no-scripts + + - name: Run ECS + run: vendor/bin/ecs check --fix src + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v4 + with: + commit-message: '[CS] Refactor' + author: CORS GmbH + title: '[CS] Refactor' + body: | + This PR has been generated automatically to fix code-styles + labels: | + Enhancement + branch: coding-standard/refactor-${{ matrix.branch }} + delete-branch: true + base: ${{ matrix.branch }} \ No newline at end of file diff --git a/CLA.md b/CLA.md new file mode 100644 index 00000000..5832f10f --- /dev/null +++ b/CLA.md @@ -0,0 +1,42 @@ +# Contributor License Agreement + +The following terms are used throughout this agreement: + +**You** - the person or legal entity including its affiliates asked to accept this agreement. An affiliate is any entity +that controls or is controlled by the legal entity, or is under common control with it. + +**Project** - is an umbrella term that refers to any and all CORS GmbH in combination with instride AG open source projects. + +**Contribution** - any type of work that is submitted to a Project, including any modifications or additions to existing +work. + +Submitted - conveyed to a Project via a pull request, commit, issue, or any form of electronic, written, or verbal +communication with CORS GmbH and instride AG, contributors or maintainers. + +# 1. Grant of Copyright License. + +Subject to the terms and conditions of this agreement, You grant to the Projects’ maintainers, contributors, users and +to CORS GmbH and instride AG a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, +prepare derivative works of, publicly display, publicly perform, sublicense, and distribute Your contributions and such +derivative works. Except for this license, You reserve all rights, title, and interest in your contributions. + +# 2. Grant of Patent License. + +Subject to the terms and conditions of this agreement, You grant to the Projects’ maintainers, contributors, users and +to CORS GmbH and instride AG a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this +section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer your contributions, +where such license applies only to those patent claims licensable by you that are necessarily infringed by your +contribution or by combination of your contribution with the project to which this contribution was submitted. + +If any entity institutes patent litigation - including cross-claim or counterclaim in a lawsuit - against You alleging +that your contribution or any project it was submitted to constitutes or is responsible for direct or contributory +patent infringement, then any patent licenses granted to that entity under this agreement shall terminate as of the date +such litigation is filed. + +# 3. Source of Contribution. + +Your contribution is either your original creation, based upon previous work that, to the best of your knowledge, is +covered under an appropriate open source license and you have the right under that license to submit that work with +modifications, whether created in whole or in part by you, or you have clearly identified the source of the contribution +and any license or other restriction (like related patents, trademarks, and license agreements) of which you are +personally aware. \ No newline at end of file diff --git a/LICENSE.md b/LICENSE.md index ebfc7e20..a4771e33 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,5 +1,14 @@ # License -Copyright (C) 2016-2024 instride AG +Copyright (C) CORS GmbH in combination with instride AG + +This software is available under two different licenses: +* GNU General Public License version 3 (GPLv3) as Pimcore Community Edition +* Data Definitions Commercial License (DDCL) + +The default Data Definitions license, without a valid Data Definitions Commercial License agreement, is the Open-Source GPLv3 license. + +## GNU General Public License version 3 (GPLv3) +If you decide to choose the GPLv3 license, you must comply with the following terms: This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,3 +22,13 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . + +## Data Definitions Commercial License (DDCL) +Alternatively, commercial and supported versions of the program - also known as +Commercial Distributions - must be used in accordance with the terms and conditions +contained in a separate written agreement between you and CORS GmbH/instride AG. +For more information about the Data Definitions Commercial License (DDCL) please contact office@cors.gmbh. + + +Please see also (files in this directory): +[GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 - gpl-3.0.txt](gpl-3.0.txt) \ No newline at end of file diff --git a/composer.json b/composer.json index 83213df5..ea195ee8 100755 --- a/composer.json +++ b/composer.json @@ -46,13 +46,14 @@ "symfony/http-client": "^6.3 | ^7.0" }, "require-dev": { - "roave/security-advisories": "dev-latest", "behat/behat": "^3.8", "friends-of-behat/symfony-extension": "^2.1", "phpstan/phpstan": "^1.5", "phpstan/phpstan-doctrine": "^1.3", "phpstan/phpstan-symfony": "^1.1", - "phpstan/phpstan-webmozart-assert": "^1.1" + "phpstan/phpstan-webmozart-assert": "^1.1", + "roave/security-advisories": "dev-latest", + "symplify/easy-coding-standard": "^11" }, "conflict": { "guzzlehttp/psr7": "< 2.0" diff --git a/ecs.php b/ecs.php new file mode 100644 index 00000000..efd3792f --- /dev/null +++ b/ecs.php @@ -0,0 +1,268 @@ +rules([ + BinaryOperatorSpacesFixer::class, + BlankLineAfterNamespaceFixer::class, + BlankLineAfterOpeningTagFixer::class, + BlankLineBeforeStatementFixer::class, + CastSpacesFixer::class, + ClassAttributesSeparationFixer::class, + CombineConsecutiveIssetsFixer::class, + CombineConsecutiveUnsetsFixer::class, + DeclareEqualNormalizeFixer::class, + DeclareStrictTypesFixer::class, + DirConstantFixer::class, + ElseifFixer::class, + EncodingFixer::class, + EregToPregFixer::class, + ErrorSuppressionFixer::class, + FullOpeningTagFixer::class, + FunctionDeclarationFixer::class, + FunctionToConstantFixer::class, + FunctionTypehintSpaceFixer::class, + GeneralPhpdocTagRenameFixer::class, + IncludeFixer::class, + IndentationTypeFixer::class, + IsNullFixer::class, + LineEndingFixer::class, + LowercaseCastFixer::class, + LowercaseKeywordsFixer::class, + LowercaseStaticReferenceFixer::class, + MagicConstantCasingFixer::class, + MethodArgumentSpaceFixer::class, + ModernizeTypesCastingFixer::class, + NativeConstantInvocationFixer::class, + NativeFunctionCasingFixer::class, + NewWithBracesFixer::class, + NoAliasFunctionsFixer::class, + NoBlankLinesAfterClassOpeningFixer::class, + NoBlankLinesAfterPhpdocFixer::class, + NoBreakCommentFixer::class, + NoClosingTagFixer::class, + NoEmptyCommentFixer::class, + NoEmptyPhpdocFixer::class, + NoEmptyStatementFixer::class, + NoHomoglyphNamesFixer::class, + NoLeadingImportSlashFixer::class, + NoLeadingNamespaceWhitespaceFixer::class, + NoMultilineWhitespaceAroundDoubleArrowFixer::class, + NonPrintableCharacterFixer::class, + NoNullPropertyInitializationFixer::class, + NoPhp4ConstructorFixer::class, + NormalizeIndexBraceFixer::class, + NoShortBoolCastFixer::class, + NoSinglelineWhitespaceBeforeSemicolonsFixer::class, + NoSpacesAfterFunctionNameFixer::class, + NoSpacesAroundOffsetFixer::class, + NoSpacesInsideParenthesisFixer::class, + NoSuperfluousElseifFixer::class, + NoTrailingCommaInListCallFixer::class, + NoTrailingCommaInSinglelineArrayFixer::class, + NoTrailingWhitespaceFixer::class, + NoTrailingWhitespaceInCommentFixer::class, + NoUnneededControlParenthesesFixer::class, + NoUnneededCurlyBracesFixer::class, + NoUnneededFinalMethodFixer::class, + NoUnusedImportsFixer::class, + NoUselessElseFixer::class, + NoWhitespaceBeforeCommaInArrayFixer::class, + NoWhitespaceInBlankLineFixer::class, + ObjectOperatorWithoutWhitespaceFixer::class, + OrderedImportsFixer::class, + PhpdocIndentFixer::class, + PhpdocInlineTagNormalizerFixer::class, + PhpdocNoAccessFixer::class, + PhpdocNoAliasTagFixer::class, + PhpdocNoEmptyReturnFixer::class, + PhpdocNoPackageFixer::class, + PhpdocNoUselessInheritdocFixer::class, + PhpdocReturnSelfReferenceFixer::class, + PhpdocScalarFixer::class, + PhpdocSeparationFixer::class, + PhpdocSingleLineVarSpacingFixer::class, + PhpdocTagTypeFixer::class, + PhpdocTrimFixer::class, + PhpdocTypesFixer::class, + PhpdocVarWithoutNameFixer::class, + PhpUnitDedicateAssertFixer::class, + PhpUnitFqcnAnnotationFixer::class, + PowToExponentiationFixer::class, + ProtectedToPrivateFixer::class, + ReturnTypeDeclarationFixer::class, + SelfAccessorFixer::class, + ShortScalarCastFixer::class, + SingleBlankLineAtEofFixer::class, + SingleBlankLineBeforeNamespaceFixer::class, + SingleClassElementPerStatementFixer::class, + SingleImportPerStatementFixer::class, + SingleLineAfterImportsFixer::class, + SingleQuoteFixer::class, + SpaceAfterSemicolonFixer::class, + StandardizeNotEqualsFixer::class, + SwitchCaseSemicolonToColonFixer::class, + SwitchCaseSpaceFixer::class, + TernaryOperatorSpacesFixer::class, + TernaryToNullCoalescingFixer::class, + TrimArraySpacesFixer::class, + UnaryOperatorSpacesFixer::class, + WhitespaceAfterCommaInArrayFixer::class, + \Symplify\CodingStandard\Fixer\Spacing\StandaloneLineConstructorParamFixer::class + ]); + + $ecsConfig->ruleWithConfiguration(ArraySyntaxFixer::class, ['syntax' => 'short']); + $ecsConfig->ruleWithConfiguration(BracesFixer::class, ['allow_single_line_closure' => true]); + $ecsConfig->ruleWithConfiguration(ClassDefinitionFixer::class, ['single_item_single_line' => true, 'multi_line_extends_each_single_line' => true]); + $ecsConfig->ruleWithConfiguration(ConcatSpaceFixer::class, ['spacing' => 'one']); + $ecsConfig->ruleWithConfiguration(ConstantCaseFixer::class, ['case' => 'lower']); + $ecsConfig->ruleWithConfiguration(IncrementStyleFixer::class, ['style' => 'pre']); + $ecsConfig->ruleWithConfiguration(ListSyntaxFixer::class, ['syntax' => 'short']); + $ecsConfig->ruleWithConfiguration(MultilineWhitespaceBeforeSemicolonsFixer::class, ['strategy' => 'new_line_for_chained_calls']); + $ecsConfig->ruleWithConfiguration(NoExtraBlankLinesFixer::class, ['tokens' => ['break', 'case', 'continue', 'curly_brace_block', 'default', 'extra', 'parenthesis_brace_block', 'return', 'square_brace_block', 'switch', 'throw', 'use']]); + $ecsConfig->ruleWithConfiguration(NoMixedEchoPrintFixer::class, ['use' => 'echo']); + $ecsConfig->ruleWithConfiguration(NoSuperfluousPhpdocTagsFixer::class, ['allow_mixed' => true]); + $ecsConfig->ruleWithConfiguration(OperatorLinebreakFixer::class, ['only_booleans' => true, 'position' => 'end']); + $ecsConfig->ruleWithConfiguration(PhpdocTypesOrderFixer::class, ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none']); + $ecsConfig->ruleWithConfiguration(SingleLineCommentStyleFixer::class, ['comment_types' => ['hash']]); + $ecsConfig->ruleWithConfiguration(TrailingCommaInMultilineFixer::class, ['elements' => ['arrays', 'arguments', 'parameters']]); + $ecsConfig->ruleWithConfiguration(VisibilityRequiredFixer::class, ['elements' => ['const', 'property', 'method']]); + + $header = <<ruleWithConfiguration(HeaderCommentFixer::class, ['header' => $header]); +}; diff --git a/features/interpreter/asset_url.feature b/features/interpreter/asset_url.feature index f7462e79..ab903506 100644 --- a/features/interpreter/asset_url.feature +++ b/features/interpreter/asset_url.feature @@ -1,4 +1,4 @@ -@interpreter @interpreter_asset_url +@interpreter @interpreter_asset_url @wip Feature: Adding a import with a interpreter The Interpreter will check for an image to download and assign it if found @@ -23,10 +23,10 @@ Feature: Adding a import with a interpreter Given there is a file test.csv with content: """ name,image - test1,https://via.placeholder.com/300/09f/fff.png + test1,https://www.coreshop.org/assets/img/logo-full.svg """ And I run the import-definitions with params: | key | value | | file | test.csv | Then there should be "1" data-objects for definition - And the field "image" for object of the definition should have the value of asset "/images/fff.png" + And the field "image" for object of the definition should have the value of asset "/images/logo-full.svg.png" diff --git a/signatures/version1/cla.json b/signatures/version1/cla.json new file mode 100644 index 00000000..f2463dbf --- /dev/null +++ b/signatures/version1/cla.json @@ -0,0 +1,44 @@ +{ + "signedContributors": [ + { + "name": "dpfaffenbauer", + "id": 5981845, + "comment_id": 2346292662, + "created_at": "2024-09-12T13:30:45Z", + "repoId": 62632812, + "pullRequestNo": 422 + }, + { + "name": "dpfaffenbauer", + "id": 5981845, + "comment_id": 2346296210, + "created_at": "2024-09-12T13:32:00Z", + "repoId": 62632812, + "pullRequestNo": 422 + }, + { + "name": "dpfaffenbauer", + "id": 5981845, + "comment_id": 2346302271, + "created_at": "2024-09-12T13:34:37Z", + "repoId": 62632812, + "pullRequestNo": 422 + }, + { + "name": "dpfaffenbauer", + "id": 5981845, + "comment_id": 2346303578, + "created_at": "2024-09-12T13:35:09Z", + "repoId": 62632812, + "pullRequestNo": 422 + }, + { + "name": "dpfaffenbauer", + "id": 5981845, + "comment_id": 2346304975, + "created_at": "2024-09-12T13:35:43Z", + "repoId": 62632812, + "pullRequestNo": 422 + } + ] +} \ No newline at end of file diff --git a/src/BehatKernel.php b/src/BehatKernel.php index 4298642b..8611258a 100644 --- a/src/BehatKernel.php +++ b/src/BehatKernel.php @@ -1,16 +1,16 @@ getO_Id() === $objectId) { + if ((int) $log->getO_Id() === $objectId) { $found = true; break; @@ -71,10 +70,9 @@ protected function writeNewLogs(DataDefinitionInterface $definition, array $obje { foreach ($objectIds as $objId) { $log = new Log(); - $log->setO_Id((int)$objId); - $log->setDefinition((int)$definition->getId()); + $log->setO_Id((int) $objId); + $log->setDefinition((int) $definition->getId()); $log->save(); } } } - diff --git a/src/DataDefinitionsBundle/Cleaner/CleanerInterface.php b/src/DataDefinitionsBundle/Cleaner/CleanerInterface.php index 3ca6e6c7..6f888cad 100644 --- a/src/DataDefinitionsBundle/Cleaner/CleanerInterface.php +++ b/src/DataDefinitionsBundle/Cleaner/CleanerInterface.php @@ -1,19 +1,18 @@ metadata = $metadata; $this->repository = $repository; @@ -57,8 +59,9 @@ protected function configure(): void ->addArgument( 'path', InputArgument::REQUIRED, - sprintf('Path to %s Definition JSON export file', $type) - ); + sprintf('Path to %s Definition JSON export file', $type), + ) + ; } protected function execute(InputInterface $input, OutputInterface $output) @@ -96,9 +99,7 @@ protected function execute(InputInterface $input, OutputInterface $output) /** * Validate and return path to JSON file * - * @return string * @throws InvalidArgumentException - * */ protected function getPath(): string { @@ -112,8 +113,6 @@ protected function getPath(): string /** * Get type - * - * @return string */ abstract protected function getType(): string; } diff --git a/src/DataDefinitionsBundle/Command/ConvertExportDefinitionsToYaml.php b/src/DataDefinitionsBundle/Command/ConvertExportDefinitionsToYaml.php index 5de979d9..cc025a6b 100644 --- a/src/DataDefinitionsBundle/Command/ConvertExportDefinitionsToYaml.php +++ b/src/DataDefinitionsBundle/Command/ConvertExportDefinitionsToYaml.php @@ -1,23 +1,37 @@ setName('data-definition:configuration:exporter:convert-to-yaml') ->setDescription('Convert export definitions file to YAML files') ->setHelp('This command converts export definitions file to YAML') - ->addArgument('file', InputArgument::OPTIONAL, 'Path to the PHP file', 'var/config/exportdefinitions.php'); + ->addArgument('file', InputArgument::OPTIONAL, 'Path to the PHP file', 'var/config/exportdefinitions.php') + ; } protected function execute(InputInterface $input, OutputInterface $output): int @@ -25,16 +39,20 @@ protected function execute(InputInterface $input, OutputInterface $output): int $filePath = $input->getArgument('file'); $data = require $filePath; - foreach ($data as $entry) { + $fs = new Filesystem(); + if (!$fs->exists('var/config/export-definitions')) { + $fs->mkdir('var/config/export-definitions'); + } + foreach ($data as $entry) { $fileName = $entry['id'] . '.yaml'; $yamlData = [ 'data_definitions' => [ 'export_definitions' => [ - $entry['id'] => $entry - ] - ] + $entry['id'] => $entry, + ], + ], ]; $yaml = Yaml::dump($yamlData, 4, 2, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK); diff --git a/src/DataDefinitionsBundle/Command/ConvertImportDefinitionsToYaml.php b/src/DataDefinitionsBundle/Command/ConvertImportDefinitionsToYaml.php index c21bf20c..d7996d3a 100644 --- a/src/DataDefinitionsBundle/Command/ConvertImportDefinitionsToYaml.php +++ b/src/DataDefinitionsBundle/Command/ConvertImportDefinitionsToYaml.php @@ -1,22 +1,36 @@ setName('data-definition:configuration:importer:convert-to-yaml') ->setDescription('Convert convert import file definitions to YAML files') ->setHelp('This command converts convert import file definitions file to YAML files') - ->addArgument('file', InputArgument::OPTIONAL, 'Path to the PHP file', 'var/config/importdefinitions.php'); + ->addArgument('file', InputArgument::OPTIONAL, 'Path to the PHP file', 'var/config/importdefinitions.php') + ; } protected function execute(InputInterface $input, OutputInterface $output): int @@ -24,15 +38,19 @@ protected function execute(InputInterface $input, OutputInterface $output): int $filePath = $input->getArgument('file'); $data = require $filePath; - foreach ($data as $entry) { + $fs = new Filesystem(); + if (!$fs->exists('var/config/import-definitions')) { + $fs->mkdir('var/config/import-definitions'); + } + foreach ($data as $entry) { $fileName = $entry['id'] . '.yaml'; $yamlData = [ 'data_definitions' => [ 'import_definitions' => [ - $entry['id'] => $entry - ] - ] + $entry['id'] => $entry, + ], + ], ]; $yaml = Yaml::dump($yamlData, 4, 2, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK); diff --git a/src/DataDefinitionsBundle/Command/ExportCommand.php b/src/DataDefinitionsBundle/Command/ExportCommand.php index 3566ec57..d147cd20 100644 --- a/src/DataDefinitionsBundle/Command/ExportCommand.php +++ b/src/DataDefinitionsBundle/Command/ExportCommand.php @@ -1,23 +1,25 @@ addOption( 'params', 'p', InputOption::VALUE_REQUIRED, - 'JSON Encoded Params' - ); + 'JSON Encoded Params', + ) + ; } protected function execute(InputInterface $input, OutputInterface $output) @@ -82,13 +83,12 @@ protected function execute(InputInterface $input, OutputInterface $output) $definition = null; try { - if (filter_var($definitionId, FILTER_VALIDATE_INT)) { + if (filter_var($definitionId, \FILTER_VALIDATE_INT)) { $definition = $this->repository->find($definitionId); } else { $definition = $this->repository->findByName($definitionId); } } catch (NotFoundException) { - } if (!$definition instanceof ExportDefinitionInterface) { @@ -113,7 +113,7 @@ protected function execute(InputInterface $input, OutputInterface $output) if ($total > 0) { $progress = new ProgressBar($output, $total); $progress->setFormat( - ' %current%/%max% [%bar%] %percent:3s%% (%elapsed:6s%/%estimated:-6s%) %memory:6s%: %message%' + ' %current%/%max% [%bar%] %percent:3s%% (%elapsed:6s%/%estimated:-6s%) %memory:6s%: %message%', ); $progress->start(); } diff --git a/src/DataDefinitionsBundle/Command/ImportAsyncCommand.php b/src/DataDefinitionsBundle/Command/ImportAsyncCommand.php index c7edb957..f0c3e565 100644 --- a/src/DataDefinitionsBundle/Command/ImportAsyncCommand.php +++ b/src/DataDefinitionsBundle/Command/ImportAsyncCommand.php @@ -1,42 +1,37 @@ addOption( 'params', 'p', InputOption::VALUE_REQUIRED, - 'JSON Encoded Params' - ); + 'JSON Encoded Params', + ) + ; } protected function execute(InputInterface $input, OutputInterface $output) diff --git a/src/DataDefinitionsBundle/Command/ImportCommand.php b/src/DataDefinitionsBundle/Command/ImportCommand.php index eaac27ef..4d80818d 100644 --- a/src/DataDefinitionsBundle/Command/ImportCommand.php +++ b/src/DataDefinitionsBundle/Command/ImportCommand.php @@ -1,23 +1,25 @@ eventDispatcher = $eventDispatcher; $this->repository = $repository; @@ -63,21 +63,22 @@ protected function configure(): void 'definition', 'd', InputOption::VALUE_REQUIRED, - 'Import Definition ID or Name' + 'Import Definition ID or Name', ) ->addOption( 'params', 'p', InputOption::VALUE_REQUIRED, - 'JSON Encoded Params' - ); + 'JSON Encoded Params', + ) + ; } protected function execute(InputInterface $input, OutputInterface $output) { $eventDispatcher = $this->eventDispatcher; - $params = json_decode($input->getOption('params'), true, 512, JSON_THROW_ON_ERROR); + $params = json_decode($input->getOption('params'), true, 512, \JSON_THROW_ON_ERROR); $definitionId = $input->getOption('definition'); if (!isset($params['userId'])) { @@ -87,13 +88,12 @@ protected function execute(InputInterface $input, OutputInterface $output) $definition = null; try { - if (filter_var($definitionId, FILTER_VALIDATE_INT)) { + if (filter_var($definitionId, \FILTER_VALIDATE_INT)) { $definition = $this->repository->find($definitionId); } else { $definition = $this->repository->findByName($definitionId); } } catch (NotFoundException) { - } if (!$definition instanceof ImportDefinitionInterface) { @@ -115,8 +115,8 @@ protected function execute(InputInterface $input, OutputInterface $output) $countProgress, Helper::formatTime(time() - $startTime), Helper::formatMemory(memory_get_usage(true)), - $e->getSubject() - ) + $e->getSubject(), + ), ); } }; @@ -124,7 +124,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $imTotal = function (ImportDefinitionEvent $e) use ($output, &$progress) { $progress = new ProgressBar($output, $e->getSubject()); $progress->setFormat( - ' %current%/%max% [%bar%] %percent:3s%% (%elapsed:6s%/%estimated:-6s%) %memory:6s%: %message%' + ' %current%/%max% [%bar%] %percent:3s%% (%elapsed:6s%/%estimated:-6s%) %memory:6s%: %message%', ); $progress->start(); }; @@ -134,7 +134,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $progress->advance(); } - $countProgress++; + ++$countProgress; }; $imFinished = function (ImportDefinitionEvent $e) use ($output, &$progress) { diff --git a/src/DataDefinitionsBundle/Command/ImportExportDefinitionCommand.php b/src/DataDefinitionsBundle/Command/ImportExportDefinitionCommand.php index 418fdee6..0a56c386 100644 --- a/src/DataDefinitionsBundle/Command/ImportExportDefinitionCommand.php +++ b/src/DataDefinitionsBundle/Command/ImportExportDefinitionCommand.php @@ -1,19 +1,18 @@ repository = $repository; parent::__construct(); @@ -43,7 +43,8 @@ protected function configure(): void <<%command.name% lists all Data Definitions for Exports. EOT - ); + ) + ; } protected function execute(InputInterface $input, OutputInterface $output) @@ -64,7 +65,8 @@ protected function execute(InputInterface $input, OutputInterface $output) $table = new Table($output); $table ->setHeaders(['ID', 'Name', 'Provider']) - ->setRows($data); + ->setRows($data) + ; $table->render(); return 0; diff --git a/src/DataDefinitionsBundle/Command/ListImportDefinitionsCommand.php b/src/DataDefinitionsBundle/Command/ListImportDefinitionsCommand.php index 5b56178d..d0b9af19 100644 --- a/src/DataDefinitionsBundle/Command/ListImportDefinitionsCommand.php +++ b/src/DataDefinitionsBundle/Command/ListImportDefinitionsCommand.php @@ -1,34 +1,34 @@ repository = $repository; parent::__construct(); @@ -43,7 +43,8 @@ protected function configure(): void <<%command.name% lists all Data Definitions for Imports. EOT - ); + ) + ; } protected function execute(InputInterface $input, OutputInterface $output) @@ -64,7 +65,8 @@ protected function execute(InputInterface $input, OutputInterface $output) $table = new Table($output); $table ->setHeaders(['ID', 'Name', 'Provider']) - ->setRows($data); + ->setRows($data) + ; $table->render(); return 0; diff --git a/src/DataDefinitionsBundle/Context/Context.php b/src/DataDefinitionsBundle/Context/Context.php index be7dd0cf..1c79cd6f 100644 --- a/src/DataDefinitionsBundle/Context/Context.php +++ b/src/DataDefinitionsBundle/Context/Context.php @@ -1,19 +1,18 @@ object; } - public function getValue(): mixed { return $this->value; diff --git a/src/DataDefinitionsBundle/Context/InterpreterContextInterface.php b/src/DataDefinitionsBundle/Context/InterpreterContextInterface.php index 13c11a6c..70e13f23 100644 --- a/src/DataDefinitionsBundle/Context/InterpreterContextInterface.php +++ b/src/DataDefinitionsBundle/Context/InterpreterContextInterface.php @@ -1,24 +1,23 @@ array_keys($importRuleConditions), 'actions' => array_keys($importRuleActions), ], - ] + ], ); } public function exportAction(Request $request): Response { - $id = (int)$request->get('id'); + $id = (int) $request->get('id'); if ($id) { $definition = $this->repository->find($id); if ($definition instanceof ExportDefinitionInterface) { - $name = $definition->getName(); unset($definition->id, $definition->creationDate, $definition->modificationDate); @@ -74,7 +71,7 @@ public function exportAction(Request $request): Response $response->headers->set('Content-Type', 'application/json'); $response->headers->set( 'Content-Disposition', - sprintf('attachment; filename="export-definition-%s.json"', $name) + sprintf('attachment; filename="export-definition-%s.json"', $name), ); $response->headers->set('Pragma', 'no-cache'); $response->headers->set('Expires', '0'); @@ -91,7 +88,7 @@ public function exportAction(Request $request): Response public function importAction(Request $request): JsonResponse { - $id = (int)$request->get('id'); + $id = (int) $request->get('id'); $definition = $this->repository->find($id); if ($id && $definition instanceof ExportDefinitionInterface && $request->files->has('Filedata')) { @@ -99,8 +96,7 @@ public function importAction(Request $request): JsonResponse if ($uploadedFile instanceof UploadedFile) { $jsonContent = file_get_contents($uploadedFile->getPathname()); - $data = $this->decodeJson($jsonContent, false,[],false); - + $data = $this->decodeJson($jsonContent, false, [], false); $form = $this->resourceFormFactory->create($this->metadata, $definition); $handledForm = $form->submit($data); @@ -121,9 +117,9 @@ public function importAction(Request $request): JsonResponse public function duplicateAction(Request $request): JsonResponse { - $id = (int)$request->get('id'); + $id = (int) $request->get('id'); $definition = $this->repository->find($id); - $name = (string)$request->get('name'); + $name = (string) $request->get('name'); if ($definition instanceof ExportDefinitionInterface && $name) { $newDefinition = clone $definition; @@ -176,14 +172,14 @@ public function getColumnsAction(Request $request): JsonResponse foreach ($localizedFields as $localizedField) { $localizedField = $this->getFieldConfiguration($localizedField); - $localizedField->setGroup('localizedfield.'.strtolower($language)); + $localizedField->setGroup('localizedfield.' . strtolower($language)); $localizedField->setType('localizedfields'); $localizedField->setIdentifier( sprintf( '%s~%s', $localizedField->getIdentifier(), - $language - ) + $language, + ), ); $localizedField->setGetter('localizedfield'); $localizedField->setConfig(['language' => $language]); @@ -192,8 +188,8 @@ public function getColumnsAction(Request $request): JsonResponse $result[] = $localizedField; } } - break; + break; case DataObject\ClassDefinition\Data\Objectbricks::class: $list = new DataObject\Objectbrick\Definition\Listing(); $list = $list->load(); @@ -205,21 +201,21 @@ public function getColumnsAction(Request $request): JsonResponse foreach ($classDefs as $classDef) { if ($classDef['classname'] === $classDefinition->getName( - ) && $classDef['fieldname'] === $field->getName()) { + ) && $classDef['fieldname'] === $field->getName()) { $fields = $brickDefinition->getFieldDefinitions(); foreach ($fields as $brickField) { $resultField = $this->getFieldConfiguration($brickField); - $resultField->setGroup('objectbrick.'.$key); + $resultField->setGroup('objectbrick.' . $key); $resultField->setType('objectbricks'); $resultField->setIdentifier( sprintf( 'objectbrick~%s~%s~%s', $field->getName(), $key, - $resultField->getIdentifier() - ) + $resultField->getIdentifier(), + ), ); $resultField->setGetter('objectbrick'); $resultField->setConfig(['class' => $key]); @@ -232,8 +228,8 @@ public function getColumnsAction(Request $request): JsonResponse } } } - break; + break; case DataObject\ClassDefinition\Data\Fieldcollections::class: foreach ($field->getAllowedTypes() as $type) { $definition = DataObject\Fieldcollection\Definition::getByKey($type); @@ -243,15 +239,15 @@ public function getColumnsAction(Request $request): JsonResponse foreach ($fieldDefinition as $fieldcollectionField) { $resultField = $this->getFieldConfiguration($fieldcollectionField); - $resultField->setGroup('fieldcollection.'.$type); + $resultField->setGroup('fieldcollection.' . $type); $resultField->setType('fieldcollections'); $resultField->setIdentifier( sprintf( 'fieldcollection~%s~%s~%s', $field->getName(), $type, - $resultField->getIdentifier() - ) + $resultField->getIdentifier(), + ), ); $resultField->setGetter('fieldcollection'); $resultField->setConfig(['class' => $type]); @@ -260,8 +256,8 @@ public function getColumnsAction(Request $request): JsonResponse $result[] = $resultField; } } - break; + break; case DataObject\ClassDefinition\Data\Classificationstore::class: $resultField = $this->getFieldConfiguration($field); $resultField->setType('object'); @@ -274,8 +270,8 @@ public function getColumnsAction(Request $request): JsonResponse if ($allowedGroupIds) { $list->setCondition( - 'ID in ('.implode(',', $allowedGroupIds).') AND storeId = ?', - [$field->getStoreId()] + 'ID in (' . implode(',', $allowedGroupIds) . ') AND storeId = ?', + [$field->getStoreId()], ); } else { $list->setCondition('storeId = ?', [$field->getStoreId()]); @@ -300,16 +296,16 @@ public function getColumnsAction(Request $request): JsonResponse sprintf( 'classificationstore - %s (%s)', $config->getName(), - $config->getId() - ) + $config->getId(), + ), ); $toColumn->setIdentifier( sprintf( 'classificationstore~%s~%s~%s', $field->getName(), $keyConfig->getId(), - $config->getId() - ) + $config->getId(), + ), ); $toColumn->setType('classificationstore'); $toColumn->setFieldtype($keyConfig->getType()); @@ -326,13 +322,14 @@ public function getColumnsAction(Request $request): JsonResponse } } } - break; + break; default: $resultField = $this->getFieldConfiguration($field); $resultField->setType('object'); $result[] = $resultField; + break; } } diff --git a/src/DataDefinitionsBundle/Controller/ImportDefinitionController.php b/src/DataDefinitionsBundle/Controller/ImportDefinitionController.php index 6e591cbe..24f9d0f2 100644 --- a/src/DataDefinitionsBundle/Controller/ImportDefinitionController.php +++ b/src/DataDefinitionsBundle/Controller/ImportDefinitionController.php @@ -1,24 +1,28 @@ container->get('data_definitions.registry.provider')->get( - $definition->getProvider() + $definition->getProvider(), )->testData( - $definition->getConfiguration() + $definition->getConfiguration(), )) { return $this->viewHandler->handle(['success' => true]); } @@ -101,7 +100,7 @@ public function getColumnsAction(Request $request): JsonResponse try { $fromColumns = $this->container->get('data_definitions.registry.provider')->get( - $definition->getProvider() + $definition->getProvider(), )->getColumns($definition->getConfiguration()); $fromColumns[] = $customFromColumn; } catch (Exception $e) { @@ -193,13 +192,12 @@ public function getColumnsAction(Request $request): JsonResponse public function exportAction(Request $request): Response { - $id = (int)$request->get('id'); + $id = (int) $request->get('id'); if ($id) { $definition = $this->repository->find($id); if ($definition instanceof ImportDefinitionInterface) { - $name = $definition->getName(); unset($definition->id, $definition->creationDate, $definition->modificationDate); @@ -207,7 +205,7 @@ public function exportAction(Request $request): Response $response->headers->set('Content-Type', 'application/json'); $response->headers->set( 'Content-Disposition', - sprintf('attachment; filename="import-definition-%s.json"', $name) + sprintf('attachment; filename="import-definition-%s.json"', $name), ); $response->headers->set('Pragma', 'no-cache'); $response->headers->set('Expires', '0'); @@ -224,7 +222,7 @@ public function exportAction(Request $request): Response public function importAction(Request $request): JsonResponse { - $id = (int)$request->get('id'); + $id = (int) $request->get('id'); $definition = $this->repository->find($id); if ($id && $definition instanceof ImportDefinitionInterface && $request->files->has('Filedata')) { @@ -232,7 +230,7 @@ public function importAction(Request $request): JsonResponse if ($uploadedFile instanceof UploadedFile) { $jsonContent = file_get_contents($uploadedFile->getPathname()); - $data = $this->decodeJson($jsonContent, false,[],false); + $data = $this->decodeJson($jsonContent, false, [], false); $form = $this->resourceFormFactory->create($this->metadata, $definition); $handledForm = $form->submit($data); @@ -253,9 +251,9 @@ public function importAction(Request $request): JsonResponse public function duplicateAction(Request $request): JsonResponse { - $id = (int)$request->get('id'); + $id = (int) $request->get('id'); $definition = $this->repository->find($id); - $name = (string)$request->get('name'); + $name = (string) $request->get('name'); if ($definition instanceof ImportDefinitionInterface && $name) { $newDefinition = clone $definition; @@ -275,11 +273,10 @@ public static function getSubscribedServices(): array { return parent::getSubscribedServices() + [ FieldSelection::class, - new SubscribedService('data_definitions.registry.provider', ServiceRegistryInterface::class, attributes: new Autowire(service: 'data_definitions.registry.provider')) + new SubscribedService('data_definitions.registry.provider', ServiceRegistryInterface::class, attributes: new Autowire(service: 'data_definitions.registry.provider')), ]; } - protected function getConfigProviders(): array { return $this->getParameter('data_definitions.import_providers'); diff --git a/src/DataDefinitionsBundle/Controller/ImportRuleController.php b/src/DataDefinitionsBundle/Controller/ImportRuleController.php index b0b8819f..f2c4fcee 100644 --- a/src/DataDefinitionsBundle/Controller/ImportRuleController.php +++ b/src/DataDefinitionsBundle/Controller/ImportRuleController.php @@ -1,21 +1,21 @@ $value) { - $conditionHeader = 'condition_'.$type.'___1___'.$key; + $conditionHeader = 'condition_' . $type . '___1___' . $key; if (!array_key_exists($conditionHeader, $countPerType)) { $countPerType[$conditionHeader] = 0; } - $countPerType[$conditionHeader]++; + ++$countPerType[$conditionHeader]; if ($countPerType[$conditionHeader] > 1) { - $conditionHeader = 'condition_'.$type.'___'.$countPerType[$conditionHeader].'___'.$key; + $conditionHeader = 'condition_' . $type . '___' . $countPerType[$conditionHeader] . '___' . $key; } if (!in_array($conditionHeader, $headersCondition)) { @@ -244,16 +243,16 @@ public function exportAction(Request $request): BinaryFileResponse $type = $action['type']; foreach ($action['configuration'] as $key => $value) { - $actionHeader = 'action_'.$type.'___1___'.$key; + $actionHeader = 'action_' . $type . '___1___' . $key; if (!array_key_exists($actionHeader, $countPerType)) { $countPerType[$actionHeader] = 0; } - $countPerType[$actionHeader]++; + ++$countPerType[$actionHeader]; if ($countPerType[$actionHeader] > 1) { - $actionHeader = 'action_'.$type.'___'.$countPerType[$actionHeader].'___'.$key; + $actionHeader = 'action_' . $type . '___' . $countPerType[$actionHeader] . '___' . $key; } if (!in_array($actionHeader, $headersAction)) { @@ -277,16 +276,16 @@ public function exportAction(Request $request): BinaryFileResponse $type = $condition['type']; foreach ($condition['configuration'] as $key => $value) { - $conditionHeader = 'condition_'.$type.'___1___'.$key; + $conditionHeader = 'condition_' . $type . '___1___' . $key; if (!array_key_exists($conditionHeader, $countPerType)) { $countPerType[$conditionHeader] = 0; } - $countPerType[$conditionHeader]++; + ++$countPerType[$conditionHeader]; if ($countPerType[$conditionHeader] > 1) { - $conditionHeader = 'condition_'.$type.'___'.$countPerType[$conditionHeader].'___'.$key; + $conditionHeader = 'condition_' . $type . '___' . $countPerType[$conditionHeader] . '___' . $key; } if (is_array($value)) { @@ -301,16 +300,16 @@ public function exportAction(Request $request): BinaryFileResponse $type = $action['type']; foreach ($action['configuration'] as $key => $value) { - $actionHeader = 'action_'.$type.'___1___'.$key; + $actionHeader = 'action_' . $type . '___1___' . $key; if (!array_key_exists($actionHeader, $countPerType)) { $countPerType[$actionHeader] = 0; } - $countPerType[$actionHeader]++; + ++$countPerType[$actionHeader]; if ($countPerType[$actionHeader] > 1) { - $actionHeader = 'action_'.$type.'___'.$countPerType[$actionHeader].'___'.$key; + $actionHeader = 'action_' . $type . '___' . $countPerType[$actionHeader] . '___' . $key; } if (is_array($value)) { diff --git a/src/DataDefinitionsBundle/DataDefinitionsBundle.php b/src/DataDefinitionsBundle/DataDefinitionsBundle.php index 04d6094c..e133f46b 100644 --- a/src/DataDefinitionsBundle/DataDefinitionsBundle.php +++ b/src/DataDefinitionsBundle/DataDefinitionsBundle.php @@ -1,31 +1,24 @@ '/var/config/import-definitions', - 'export_definitions' => '/var/config/export-definitions' + 'export_definitions' => '/var/config/export-definitions', ]); $rootNode ->children() ->scalarNode('driver')->defaultValue(CoreShopResourceBundle::DRIVER_PIMCORE)->end() - ->end(); + ->end() + ; $rootNode ->children() @@ -131,7 +131,8 @@ public function getConfigTreeBuilder(): TreeBuilder ->end() ->end() ->end() - ->end(); + ->end() + ; $this->addPimcoreResourcesSection($rootNode); $this->addModelsSection($rootNode); @@ -213,6 +214,7 @@ private function addPimcoreResourcesSection(ArrayNodeDefinition $node) ->end() ->end() ->end() - ->end(); + ->end() + ; } } diff --git a/src/DataDefinitionsBundle/DependencyInjection/DataDefinitionsExtension.php b/src/DataDefinitionsBundle/DependencyInjection/DataDefinitionsExtension.php index c2bb2213..4bfe6c21 100644 --- a/src/DataDefinitionsBundle/DependencyInjection/DataDefinitionsExtension.php +++ b/src/DataDefinitionsBundle/DependencyInjection/DataDefinitionsExtension.php @@ -1,28 +1,21 @@ processConfiguration($configuration, $configs); @@ -90,40 +88,52 @@ public function load(array $configs, ContainerBuilder $container) $container ->registerForAutoconfiguration(CleanerInterface::class) - ->addTag(CleanerRegistryCompilerPass::CLEANER_TAG); + ->addTag(CleanerRegistryCompilerPass::CLEANER_TAG) + ; $container ->registerForAutoconfiguration(ExportProviderInterface::class) - ->addTag(ExportProviderRegistryCompilerPass::EXPORT_PROVIDER_TAG); + ->addTag(ExportProviderRegistryCompilerPass::EXPORT_PROVIDER_TAG) + ; $container ->registerForAutoconfiguration(ExportRunnerInterface::class) - ->addTag(ExportRunnerRegistryCompilerPass::EXPORT_RUNNER_TAG); + ->addTag(ExportRunnerRegistryCompilerPass::EXPORT_RUNNER_TAG) + ; $container ->registerForAutoconfiguration(FetcherInterface::class) - ->addTag(FetcherRegistryCompilerPass::FETCHER_TAG); + ->addTag(FetcherRegistryCompilerPass::FETCHER_TAG) + ; $container ->registerForAutoconfiguration(FilterInterface::class) - ->addTag(FilterRegistryCompilerPass::FILTER_TAG); + ->addTag(FilterRegistryCompilerPass::FILTER_TAG) + ; $container ->registerForAutoconfiguration(GetterInterface::class) - ->addTag(GetterRegistryCompilerPass::GETTER_TAG); + ->addTag(GetterRegistryCompilerPass::GETTER_TAG) + ; $container ->registerForAutoconfiguration(InterpreterInterface::class) - ->addTag(InterpreterRegistryCompilerPass::INTERPRETER_TAG); + ->addTag(InterpreterRegistryCompilerPass::INTERPRETER_TAG) + ; $container ->registerForAutoconfiguration(LoaderInterface::class) - ->addTag(LoaderRegistryCompilerPass::LOADER_TAG); + ->addTag(LoaderRegistryCompilerPass::LOADER_TAG) + ; $container ->registerForAutoconfiguration(ImportProviderInterface::class) - ->addTag(ProviderRegistryCompilerPass::IMPORT_PROVIDER_TAG); + ->addTag(ProviderRegistryCompilerPass::IMPORT_PROVIDER_TAG) + ; $container ->registerForAutoconfiguration(RunnerInterface::class) - ->addTag(RunnerRegistryCompilerPass::RUNNER_TAG); + ->addTag(RunnerRegistryCompilerPass::RUNNER_TAG) + ; $container ->registerForAutoconfiguration(SetterInterface::class) - ->addTag(SetterRegistryCompilerPass::SETTER_TAG); + ->addTag(SetterRegistryCompilerPass::SETTER_TAG) + ; $container ->registerForAutoconfiguration(PersisterInterface::class) - ->addTag(PersisterRegistryCompilerPass::PERSISTER_TAG); + ->addTag(PersisterRegistryCompilerPass::PERSISTER_TAG) + ; $container->setParameter('data_definitions.config_location', $config['config_location'] ?? []); diff --git a/src/DataDefinitionsBundle/Event/DefinitionEventInterface.php b/src/DataDefinitionsBundle/Event/DefinitionEventInterface.php index 55cb2484..489ff52b 100644 --- a/src/DataDefinitionsBundle/Event/DefinitionEventInterface.php +++ b/src/DataDefinitionsBundle/Event/DefinitionEventInterface.php @@ -1,19 +1,18 @@ eventDispatcher = $eventDispatcher; } @@ -32,7 +34,7 @@ public function dispatch(DataDefinitionInterface $definition, $eventName, $subje $this->eventDispatcher->dispatch( $event, - sprintf('%s%s', $eventName, isset($params['child']) && $params['child'] ? '.child' : '') + sprintf('%s%s', $eventName, isset($params['child']) && $params['child'] ? '.child' : ''), ); } diff --git a/src/DataDefinitionsBundle/Event/EventDispatcherInterface.php b/src/DataDefinitionsBundle/Event/EventDispatcherInterface.php index 915c82a8..52cb8990 100644 --- a/src/DataDefinitionsBundle/Event/EventDispatcherInterface.php +++ b/src/DataDefinitionsBundle/Event/EventDispatcherInterface.php @@ -1,17 +1,18 @@ definition = $definition; $this->subject = $subject; $this->params = $params; diff --git a/src/DataDefinitionsBundle/Event/ImportDefinitionEvent.php b/src/DataDefinitionsBundle/Event/ImportDefinitionEvent.php index b78d6829..92d885d2 100644 --- a/src/DataDefinitionsBundle/Event/ImportDefinitionEvent.php +++ b/src/DataDefinitionsBundle/Event/ImportDefinitionEvent.php @@ -1,32 +1,36 @@ definition = $definition; $this->subject = $subject; $this->options = $options; diff --git a/src/DataDefinitionsBundle/EventListener/ObjectDeleteListener.php b/src/DataDefinitionsBundle/EventListener/ObjectDeleteListener.php index 752d4322..2ab3f24e 100644 --- a/src/DataDefinitionsBundle/EventListener/ObjectDeleteListener.php +++ b/src/DataDefinitionsBundle/EventListener/ObjectDeleteListener.php @@ -1,23 +1,22 @@ formatMessage($definition, $mapping, $params, $value, $previous), 0, $previous); } @@ -38,8 +37,8 @@ public static function fromInterpreter( MappingInterface $mapping, array $params, $value, - ?Throwable $previous = null - ): InterpreterException { + ?Throwable $previous = null, + ): self { return new self($definition, $mapping, $params, $value, $previous); } @@ -48,7 +47,7 @@ private function formatMessage( MappingInterface $mapping, array $params, $value, - ?Throwable $previous = null + ?Throwable $previous = null, ): string { $format = '%1$s, %2$s'; if ($previous !== null) { @@ -59,7 +58,7 @@ private function formatMessage( $format, $this->formatDefinition($definition), $this->formatSource($mapping, $value, $params['row'] ?? null), - $previous ? $previous->getMessage() : null + $previous ? $previous->getMessage() : null, ); } @@ -82,7 +81,7 @@ private function formatSource(MappingInterface $mapping, $value, ?int $row = nul $mapping->getInterpreter(), var_export_pretty($mapping->getInterpreterConfig()), $row, - $this->formatValue($value) + $this->formatValue($value), ); } diff --git a/src/DataDefinitionsBundle/Exception/SpoutException.php b/src/DataDefinitionsBundle/Exception/SpoutException.php index dbe9e5d4..49456746 100644 --- a/src/DataDefinitionsBundle/Exception/SpoutException.php +++ b/src/DataDefinitionsBundle/Exception/SpoutException.php @@ -1,19 +1,18 @@ eventDispatcher->dispatch( new ExportDefinitionEvent($definition, $total, $params), - 'data_definitions.export.total' + 'data_definitions.export.total', ); $this->runExport($definition, $params, $total, $fetcherContext, $fetcher, $provider); $this->eventDispatcher->dispatch( new ExportDefinitionEvent($definition, null, $params), - 'data_definitions.export.finished' + 'data_definitions.export.finished', ); } @@ -84,8 +83,8 @@ private function getFetcher(ExportDefinitionInterface $definition): FetcherInter throw new InvalidArgumentException( sprintf( 'Export Definition %s has no valid fetcher configured', - $definition->getName() - ) + $definition->getName(), + ), ); } @@ -101,8 +100,8 @@ private function getProvider(ExportDefinitionInterface $definition): ExportProvi throw new InvalidArgumentException( sprintf( 'Definition %s has no valid export provider configured', - $definition->getName() - ) + $definition->getName(), + ), ); } @@ -115,7 +114,7 @@ private function runExport( int $total, FetcherContextInterface $fetcherContext, FetcherInterface $fetcher, - ExportProviderInterface $provider + ExportProviderInterface $provider, ) { $getInheritedValues = DataObject::getGetInheritedValues(); DataObject::setGetInheritedValues($definition->isEnableInheritance()); @@ -126,11 +125,11 @@ function () use ($definition, $params, $total, $fetcher, $provider, $fetcherCont $perLoop = 50; $perRun = ceil($total / $perLoop); - for ($i = 0; $i < $perRun; $i++) { + for ($i = 0; $i < $perRun; ++$i) { $objects = $fetcher->fetch( $fetcherContext, $perLoop, - $i * $perLoop + $i * $perLoop, ); foreach ($objects as $object) { @@ -142,11 +141,11 @@ function () use ($definition, $params, $total, $fetcher, $provider, $fetcherCont $this->logger->info('Clean Garbage'); $this->eventDispatcher->dispatch( new ExportDefinitionEvent($definition, 'Collect Garbage', $params), - 'data_definitions.export.status' + 'data_definitions.export.status', ); } - $count++; + ++$count; } catch (Exception $ex) { $this->logger->error($ex); @@ -154,9 +153,11 @@ function () use ($definition, $params, $total, $fetcher, $provider, $fetcherCont $this->eventDispatcher->dispatch( new ExportDefinitionEvent( - $definition, sprintf('Error: %s', $ex->getMessage()), $params + $definition, + sprintf('Error: %s', $ex->getMessage()), + $params, ), - 'data_definitions.export.status' + 'data_definitions.export.status', ); if ($definition->getStopOnException()) { @@ -166,23 +167,22 @@ function () use ($definition, $params, $total, $fetcher, $provider, $fetcherCont $this->eventDispatcher->dispatch( new ExportDefinitionEvent($definition, null, $params), - 'data_definitions.export.progress' + 'data_definitions.export.progress', ); } if ($this->shouldStop) { $this->eventDispatcher->dispatch( new ExportDefinitionEvent($definition, 'Process has been stopped.', $params), - 'data_definitions.export.status' + 'data_definitions.export.status', ); return; } - } $provider->exportData($definition->getConfiguration(), $definition, $params); }, - false === $definition->isFetchUnpublished() + false === $definition->isFetchUnpublished(), ); DataObject::setGetInheritedValues($getInheritedValues); @@ -192,7 +192,7 @@ private function exportRow( ExportDefinitionInterface $definition, Concrete $object, $params, - ExportProviderInterface $provider + ExportProviderInterface $provider, ): array { $data = []; @@ -201,11 +201,11 @@ private function exportRow( $this->eventDispatcher->dispatch( new ExportDefinitionEvent($definition, sprintf('Export Object %s', $object->getId()), $params), - 'data_definitions.export.status' + 'data_definitions.export.status', ); $this->eventDispatcher->dispatch( new ExportDefinitionEvent($definition, $object, $params), - 'data_definitions.export.object.start' + 'data_definitions.export.object.start', ); if ($definition->getRunner()) { @@ -230,7 +230,7 @@ private function exportRow( $data, $definition, $params, - $getter + $getter, ); if ($getter instanceof DynamicColumnGetterInterface) { @@ -245,11 +245,11 @@ private function exportRow( $this->eventDispatcher->dispatch( new ExportDefinitionEvent($definition, sprintf('Exported Object %s', $object->getFullPath()), $params), - 'data_definitions.export.status' + 'data_definitions.export.status', ); $this->eventDispatcher->dispatch( new ExportDefinitionEvent($definition, $object, $params), - 'data_definitions.export.object.finished' + 'data_definitions.export.object.finished', ); if ($runner instanceof ExportRunnerInterface) { @@ -265,7 +265,7 @@ private function getObjectValue( $data, ExportDefinitionInterface $definition, $params, - ?GetterInterface $getter + ?GetterInterface $getter, ) { $value = null; @@ -273,7 +273,7 @@ private function getObjectValue( $getterContext = $this->contextFactory->createGetterContext($definition, $params, $object, $map); $value = $getter->get($getterContext); } else { - $getter = 'get'.ucfirst($map->getFromColumn()); + $getter = 'get' . ucfirst($map->getFromColumn()); if (method_exists($object, $getter)) { $value = $object->$getter(); @@ -293,7 +293,7 @@ private function getObjectValue( null, $object, $value, - $map + $map, ); $value = $interpreter->interpret($context); } catch (UnexpectedValueException $ex) { @@ -301,13 +301,11 @@ private function getObjectValue( sprintf( 'Unexpected Value from Interpreter "%s" with message "%s"', $map->getInterpreter(), - $ex->getMessage() - ) + $ex->getMessage(), + ), ); } - } - } return $value; diff --git a/src/DataDefinitionsBundle/Exporter/ExporterInterface.php b/src/DataDefinitionsBundle/Exporter/ExporterInterface.php index 6258872d..955ef5ba 100644 --- a/src/DataDefinitionsBundle/Exporter/ExporterInterface.php +++ b/src/DataDefinitionsBundle/Exporter/ExporterInterface.php @@ -1,19 +1,18 @@ setUnpublished($definition->isFetchUnpublished()); $rootNode = null; @@ -64,26 +63,26 @@ private function getClassListing(ExportDefinitionInterface $definition, array $p if (null !== $rootNode) { $quotedPath = $list->quote($rootNode->getRealFullPath()); - $quotedWildcardPath = $list->quote(str_replace('//', '/', $rootNode->getRealFullPath().'/').'%'); - $conditionFilters[] = '(path = '.$quotedPath.' OR path LIKE '.$quotedWildcardPath.')'; + $quotedWildcardPath = $list->quote(str_replace('//', '/', $rootNode->getRealFullPath() . '/') . '%'); + $conditionFilters[] = '(path = ' . $quotedPath . ' OR path LIKE ' . $quotedWildcardPath . ')'; } } if (isset($params['query'])) { $query = $this->filterQueryParam($params['query']); if (!empty($query)) { - $conditionFilters[] = 'oo_id IN (SELECT id FROM search_backend_data WHERE MATCH (`data`,`properties`) AGAINST ('.$list->quote( - $query - ).' IN BOOLEAN MODE))'; + $conditionFilters[] = 'oo_id IN (SELECT id FROM search_backend_data WHERE MATCH (`data`,`properties`) AGAINST (' . $list->quote( + $query, + ) . ' IN BOOLEAN MODE))'; } } if (isset($params['only_direct_children']) && $params['only_direct_children'] == 'true' && null !== $rootNode) { - $conditionFilters[] = 'parentId = '.$rootNode->getId(); + $conditionFilters[] = 'parentId = ' . $rootNode->getId(); } if (isset($params['condition'])) { - $conditionFilters[] = '('.$params['condition'].')'; + $conditionFilters[] = '(' . $params['condition'] . ')'; } if (isset($params['ids'])) { $quotedIds = []; @@ -91,7 +90,7 @@ private function getClassListing(ExportDefinitionInterface $definition, array $p $quotedIds[] = $list->quote($id); } if (!empty($quotedIds)) { - $conditionFilters[] = 'oo_id IN ('.implode(',', $quotedIds).')'; + $conditionFilters[] = 'oo_id IN (' . implode(',', $quotedIds) . ')'; } } diff --git a/src/DataDefinitionsBundle/Filter/FilterInterface.php b/src/DataDefinitionsBundle/Filter/FilterInterface.php index 1c5b3562..ef667a0b 100644 --- a/src/DataDefinitionsBundle/Filter/FilterInterface.php +++ b/src/DataDefinitionsBundle/Filter/FilterInterface.php @@ -1,19 +1,18 @@ cleaners = $cleaners; } diff --git a/src/DataDefinitionsBundle/Form/Type/DefinitionChoiceType.php b/src/DataDefinitionsBundle/Form/Type/DefinitionChoiceType.php index afd9dd3e..8129c855 100644 --- a/src/DataDefinitionsBundle/Form/Type/DefinitionChoiceType.php +++ b/src/DataDefinitionsBundle/Form/Type/DefinitionChoiceType.php @@ -1,22 +1,21 @@ false, 'active' => true, - ] - ); + ], + ) + ; } public function getParent(): ?string diff --git a/src/DataDefinitionsBundle/Form/Type/ExportDefinitionType.php b/src/DataDefinitionsBundle/Form/Type/ExportDefinitionType.php index b5b52f69..aaf96055 100644 --- a/src/DataDefinitionsBundle/Form/Type/ExportDefinitionType.php +++ b/src/DataDefinitionsBundle/Form/Type/ExportDefinitionType.php @@ -1,19 +1,18 @@ add('fetchUnpublished', CheckboxType::class) ->add('failureNotificationDocument', IntegerType::class) ->add('successNotificationDocument', IntegerType::class) - ->add('mapping', ExportMappingCollectionType::class); + ->add('mapping', ExportMappingCollectionType::class) + ; $builder ->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) { @@ -93,7 +94,8 @@ public function buildForm(FormBuilderInterface $builder, array $options): void } $this->addConfigurationFields($event->getForm(), $formType); - }); + }) + ; $builder ->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) { @@ -130,22 +132,17 @@ public function buildForm(FormBuilderInterface $builder, array $options): void } $this->addFetcherConfigurationFields($event->getForm(), $formType); - }); + }) + ; } - /** - * @param FormInterface $form - * @param string $configurationType - */ protected function addConfigurationFields(FormInterface $form, string $configurationType): void { $form->add('configuration', $configurationType); } /** - * @param FormInterface $form * @param mixed $data - * @return string|null */ protected function getRegistryIdentifier(FormInterface $form, $data = null): ?string { @@ -160,19 +157,13 @@ protected function getRegistryIdentifier(FormInterface $form, $data = null): ?st return null; } - /** - * @param FormInterface $form - * @param string $configurationType - */ protected function addFetcherConfigurationFields(FormInterface $form, string $configurationType): void { $form->add('fetcherConfig', $configurationType); } /** - * @param FormInterface $form * @param mixed $data - * @return string|null */ protected function getFetcherRegistryIdentifier(FormInterface $form, $data = null): ?string { diff --git a/src/DataDefinitionsBundle/Form/Type/ExportMappingCollectionType.php b/src/DataDefinitionsBundle/Form/Type/ExportMappingCollectionType.php index 066fca32..478eda0d 100644 --- a/src/DataDefinitionsBundle/Form/Type/ExportMappingCollectionType.php +++ b/src/DataDefinitionsBundle/Form/Type/ExportMappingCollectionType.php @@ -1,19 +1,18 @@ dataMapper = $dataMapper; } diff --git a/src/DataDefinitionsBundle/Form/Type/ExportMappingType.php b/src/DataDefinitionsBundle/Form/Type/ExportMappingType.php index 9c00e410..0f46d623 100644 --- a/src/DataDefinitionsBundle/Form/Type/ExportMappingType.php +++ b/src/DataDefinitionsBundle/Form/Type/ExportMappingType.php @@ -1,37 +1,39 @@ add('fromColumn', TextType::class) ->add('toColumn', TextType::class) ->add('getter', TextType::class) - ->add('interpreter', TextType::class); + ->add('interpreter', TextType::class) + ; /** Getter Configurations */ $builder @@ -75,7 +78,8 @@ public function buildForm(FormBuilderInterface $builder, array $options): void } $this->addGetterConfigurationFields($event->getForm(), $formType); - }); + }) + ; /** Interpreter Configurations */ $builder @@ -105,32 +109,22 @@ public function buildForm(FormBuilderInterface $builder, array $options): void } $this->addInterpreterConfigurationFields($event->getForm(), $formType); - }); + }) + ; } - /** - * @param FormInterface $form - * @param string $configurationType - */ protected function addGetterConfigurationFields(FormInterface $form, string $configurationType): void { $form->add('getterConfig', $configurationType); } - /** - * @param FormInterface $form - * @param string $configurationType - */ protected function addInterpreterConfigurationFields(FormInterface $form, string $configurationType): void { $form->add('interpreterConfig', $configurationType); } - /** - * @param FormInterface $form * @param mixed $data - * @return string|null */ protected function getGetterRegistryIdentifier(FormInterface $form, $data = null): ?string { @@ -142,9 +136,7 @@ protected function getGetterRegistryIdentifier(FormInterface $form, $data = null } /** - * @param FormInterface $form * @param mixed $data - * @return string|null */ protected function getInterpreterRegistryIdentifier(FormInterface $form, $data = null): ?string { diff --git a/src/DataDefinitionsBundle/Form/Type/ExportProvider/CsvProviderType.php b/src/DataDefinitionsBundle/Form/Type/ExportProvider/CsvProviderType.php index 699e401e..cfbad0d0 100644 --- a/src/DataDefinitionsBundle/Form/Type/ExportProvider/CsvProviderType.php +++ b/src/DataDefinitionsBundle/Form/Type/ExportProvider/CsvProviderType.php @@ -1,19 +1,18 @@ add('delimiter', TextType::class) ->add('enclosure', TextType::class) - ->add('escape', TextType::class, ['empty_data' => '']); + ->add('escape', TextType::class, ['empty_data' => '']) + ; } } diff --git a/src/DataDefinitionsBundle/Form/Type/ExportProvider/XmlProviderType.php b/src/DataDefinitionsBundle/Form/Type/ExportProvider/XmlProviderType.php index 18125fff..d982b2fc 100644 --- a/src/DataDefinitionsBundle/Form/Type/ExportProvider/XmlProviderType.php +++ b/src/DataDefinitionsBundle/Form/Type/ExportProvider/XmlProviderType.php @@ -1,19 +1,18 @@ add('xsltPath', TextType::class); + ->add('xsltPath', TextType::class) + ; } } diff --git a/src/DataDefinitionsBundle/Form/Type/ExportProviderChoiceType.php b/src/DataDefinitionsBundle/Form/Type/ExportProviderChoiceType.php index daf14bc3..3f2a6add 100644 --- a/src/DataDefinitionsBundle/Form/Type/ExportProviderChoiceType.php +++ b/src/DataDefinitionsBundle/Form/Type/ExportProviderChoiceType.php @@ -1,19 +1,18 @@ providers = $providers; } diff --git a/src/DataDefinitionsBundle/Form/Type/ExportRunnerChoiceType.php b/src/DataDefinitionsBundle/Form/Type/ExportRunnerChoiceType.php index 921bc0e1..4b164738 100644 --- a/src/DataDefinitionsBundle/Form/Type/ExportRunnerChoiceType.php +++ b/src/DataDefinitionsBundle/Form/Type/ExportRunnerChoiceType.php @@ -1,19 +1,18 @@ runners = $runners; } diff --git a/src/DataDefinitionsBundle/Form/Type/Fetcher/ObjectsFetcherType.php b/src/DataDefinitionsBundle/Form/Type/Fetcher/ObjectsFetcherType.php index c9e0a739..939e8e40 100644 --- a/src/DataDefinitionsBundle/Form/Type/Fetcher/ObjectsFetcherType.php +++ b/src/DataDefinitionsBundle/Form/Type/Fetcher/ObjectsFetcherType.php @@ -1,19 +1,18 @@ add('unpublished', CheckboxType::class); + ->add('unpublished', CheckboxType::class) + ; } } diff --git a/src/DataDefinitionsBundle/Form/Type/FetcherChoiceType.php b/src/DataDefinitionsBundle/Form/Type/FetcherChoiceType.php index d119e09c..461368ec 100644 --- a/src/DataDefinitionsBundle/Form/Type/FetcherChoiceType.php +++ b/src/DataDefinitionsBundle/Form/Type/FetcherChoiceType.php @@ -1,19 +1,18 @@ fetchers = $fetchers; } diff --git a/src/DataDefinitionsBundle/Form/Type/FilterChoiceType.php b/src/DataDefinitionsBundle/Form/Type/FilterChoiceType.php index f83ff8c5..916fb427 100644 --- a/src/DataDefinitionsBundle/Form/Type/FilterChoiceType.php +++ b/src/DataDefinitionsBundle/Form/Type/FilterChoiceType.php @@ -1,15 +1,16 @@ filters = $filters; } @@ -39,4 +41,3 @@ public function getParent(): ?string return ChoiceType::class; } } - diff --git a/src/DataDefinitionsBundle/Form/Type/ImportDefinitionType.php b/src/DataDefinitionsBundle/Form/Type/ImportDefinitionType.php index f620d20c..3a390d69 100644 --- a/src/DataDefinitionsBundle/Form/Type/ImportDefinitionType.php +++ b/src/DataDefinitionsBundle/Form/Type/ImportDefinitionType.php @@ -1,19 +1,18 @@ add('failureNotificationDocument', IntegerType::class) ->add('successNotificationDocument', IntegerType::class) ->add('mapping', ImportMappingCollectionType::class) - ->add('forceLoadObject', CheckboxType::class); + ->add('forceLoadObject', CheckboxType::class) + ; $builder ->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) { @@ -100,22 +100,17 @@ public function buildForm(FormBuilderInterface $builder, array $options): void } $this->addConfigurationFields($event->getForm(), $formType); - }); + }) + ; } - /** - * @param FormInterface $form - * @param string $configurationType - */ protected function addConfigurationFields(FormInterface $form, string $configurationType): void { $form->add('configuration', $configurationType); } /** - * @param FormInterface $form * @param mixed $data - * @return string|null */ protected function getRegistryIdentifier(FormInterface $form, $data = null): ?string { diff --git a/src/DataDefinitionsBundle/Form/Type/ImportMappingCollectionType.php b/src/DataDefinitionsBundle/Form/Type/ImportMappingCollectionType.php index 63a30ef6..c5fd1795 100644 --- a/src/DataDefinitionsBundle/Form/Type/ImportMappingCollectionType.php +++ b/src/DataDefinitionsBundle/Form/Type/ImportMappingCollectionType.php @@ -1,19 +1,18 @@ dataMapper = $dataMapper; } diff --git a/src/DataDefinitionsBundle/Form/Type/ImportMappingType.php b/src/DataDefinitionsBundle/Form/Type/ImportMappingType.php index 0200ef19..f31b3449 100644 --- a/src/DataDefinitionsBundle/Form/Type/ImportMappingType.php +++ b/src/DataDefinitionsBundle/Form/Type/ImportMappingType.php @@ -1,40 +1,40 @@ add('toColumn', TextType::class) ->add('primaryIdentifier', CheckboxType::class) ->add('setter', TextType::class) - ->add('interpreter', TextType::class); + ->add('interpreter', TextType::class) + ; /** Setter Configurations */ $builder @@ -79,7 +80,8 @@ public function buildForm(FormBuilderInterface $builder, array $options): void } $this->addSetterConfigurationFields($event->getForm(), $formType); - }); + }) + ; /** Interpreter Configurations */ $builder @@ -109,31 +111,22 @@ public function buildForm(FormBuilderInterface $builder, array $options): void } $this->addInterpreterConfigurationFields($event->getForm(), $formType); - }); + }) + ; } - /** - * @param FormInterface $form - * @param string $configurationType - */ protected function addSetterConfigurationFields(FormInterface $form, string $configurationType): void { $form->add('setterConfig', $configurationType); } - /** - * @param FormInterface $form - * @param string $configurationType - */ protected function addInterpreterConfigurationFields(FormInterface $form, string $configurationType): void { $form->add('interpreterConfig', $configurationType); } /** - * @param FormInterface $form * @param mixed $data - * @return string|null */ protected function getSetterRegistryIdentifier(FormInterface $form, $data = null): ?string { @@ -145,9 +138,7 @@ protected function getSetterRegistryIdentifier(FormInterface $form, $data = null } /** - * @param FormInterface $form * @param mixed $data - * @return string|null */ protected function getInterpreterRegistryIdentifier(FormInterface $form, $data = null): ?string { diff --git a/src/DataDefinitionsBundle/Form/Type/ImportProvider/CsvProviderType.php b/src/DataDefinitionsBundle/Form/Type/ImportProvider/CsvProviderType.php index 86b58873..32583dfd 100644 --- a/src/DataDefinitionsBundle/Form/Type/ImportProvider/CsvProviderType.php +++ b/src/DataDefinitionsBundle/Form/Type/ImportProvider/CsvProviderType.php @@ -1,19 +1,18 @@ add('csvExample', TextType::class) ->add('delimiter', TextType::class) ->add('enclosure', TextType::class) - ->add('csvHeaders', TextType::class); + ->add('csvHeaders', TextType::class) + ; } } diff --git a/src/DataDefinitionsBundle/Form/Type/ImportProvider/ExcelProviderType.php b/src/DataDefinitionsBundle/Form/Type/ImportProvider/ExcelProviderType.php index 615f4a4f..42efba8c 100644 --- a/src/DataDefinitionsBundle/Form/Type/ImportProvider/ExcelProviderType.php +++ b/src/DataDefinitionsBundle/Form/Type/ImportProvider/ExcelProviderType.php @@ -1,19 +1,18 @@ add('exampleFile', TextType::class) - ->add('excelHeaders', TextType::class); + ->add('excelHeaders', TextType::class) + ; } } diff --git a/src/DataDefinitionsBundle/Form/Type/ImportProvider/ExternalSqlProviderType.php b/src/DataDefinitionsBundle/Form/Type/ImportProvider/ExternalSqlProviderType.php index a3d84442..208e5fe3 100644 --- a/src/DataDefinitionsBundle/Form/Type/ImportProvider/ExternalSqlProviderType.php +++ b/src/DataDefinitionsBundle/Form/Type/ImportProvider/ExternalSqlProviderType.php @@ -1,19 +1,18 @@ add('database', TextType::class) ->add('adapter', TextType::class) ->add('port', NumberType::class) - ->add('query', TextType::class); + ->add('query', TextType::class) + ; } } diff --git a/src/DataDefinitionsBundle/Form/Type/ImportProvider/JsonProviderType.php b/src/DataDefinitionsBundle/Form/Type/ImportProvider/JsonProviderType.php index 12551322..bfd3b25c 100644 --- a/src/DataDefinitionsBundle/Form/Type/ImportProvider/JsonProviderType.php +++ b/src/DataDefinitionsBundle/Form/Type/ImportProvider/JsonProviderType.php @@ -1,19 +1,18 @@ add('jsonExample', TextType::class); + ->add('jsonExample', TextType::class) + ; } } diff --git a/src/DataDefinitionsBundle/Form/Type/ImportProvider/RawProviderType.php b/src/DataDefinitionsBundle/Form/Type/ImportProvider/RawProviderType.php index 7e5a1adf..b0070012 100644 --- a/src/DataDefinitionsBundle/Form/Type/ImportProvider/RawProviderType.php +++ b/src/DataDefinitionsBundle/Form/Type/ImportProvider/RawProviderType.php @@ -1,19 +1,18 @@ add('headers', TextType::class); + ->add('headers', TextType::class) + ; } } diff --git a/src/DataDefinitionsBundle/Form/Type/ImportProvider/SqlProviderType.php b/src/DataDefinitionsBundle/Form/Type/ImportProvider/SqlProviderType.php index 5753739d..9747acb7 100644 --- a/src/DataDefinitionsBundle/Form/Type/ImportProvider/SqlProviderType.php +++ b/src/DataDefinitionsBundle/Form/Type/ImportProvider/SqlProviderType.php @@ -1,19 +1,18 @@ add('query', TextType::class); + ->add('query', TextType::class) + ; } } diff --git a/src/DataDefinitionsBundle/Form/Type/ImportProvider/XmlProviderType.php b/src/DataDefinitionsBundle/Form/Type/ImportProvider/XmlProviderType.php index e0c1b441..4326dce4 100644 --- a/src/DataDefinitionsBundle/Form/Type/ImportProvider/XmlProviderType.php +++ b/src/DataDefinitionsBundle/Form/Type/ImportProvider/XmlProviderType.php @@ -1,19 +1,18 @@ add('exampleFile', TextType::class) ->add('xPath', TextType::class) - ->add('exampleXPath', TextType::class); + ->add('exampleXPath', TextType::class) + ; } } diff --git a/src/DataDefinitionsBundle/Form/Type/ImportProviderChoiceType.php b/src/DataDefinitionsBundle/Form/Type/ImportProviderChoiceType.php index d1501604..374fe42d 100644 --- a/src/DataDefinitionsBundle/Form/Type/ImportProviderChoiceType.php +++ b/src/DataDefinitionsBundle/Form/Type/ImportProviderChoiceType.php @@ -1,19 +1,18 @@ providers = $providers; } diff --git a/src/DataDefinitionsBundle/Form/Type/ImportRulesImportType.php b/src/DataDefinitionsBundle/Form/Type/ImportRulesImportType.php index f3f03486..18641feb 100644 --- a/src/DataDefinitionsBundle/Form/Type/ImportRulesImportType.php +++ b/src/DataDefinitionsBundle/Form/Type/ImportRulesImportType.php @@ -1,19 +1,18 @@ add('path', TextType::class); + ->add('path', TextType::class) + ; } } diff --git a/src/DataDefinitionsBundle/Form/Type/Interpreter/AssetUrlInterpreterType.php b/src/DataDefinitionsBundle/Form/Type/Interpreter/AssetUrlInterpreterType.php index 601cf9e0..688a7a73 100644 --- a/src/DataDefinitionsBundle/Form/Type/Interpreter/AssetUrlInterpreterType.php +++ b/src/DataDefinitionsBundle/Form/Type/Interpreter/AssetUrlInterpreterType.php @@ -1,19 +1,18 @@ add('deduplicate_by_hash', CheckboxType::class) ->add('use_content_disposition', CheckboxType::class) ->add('relocate_existing_objects', CheckboxType::class) - ->add('rename_existing_objects', CheckboxType::class); + ->add('rename_existing_objects', CheckboxType::class) + ; } } diff --git a/src/DataDefinitionsBundle/Form/Type/Interpreter/AssetsUrlInterpreterType.php b/src/DataDefinitionsBundle/Form/Type/Interpreter/AssetsUrlInterpreterType.php index c954c344..bdc2ee79 100644 --- a/src/DataDefinitionsBundle/Form/Type/Interpreter/AssetsUrlInterpreterType.php +++ b/src/DataDefinitionsBundle/Form/Type/Interpreter/AssetsUrlInterpreterType.php @@ -1,19 +1,18 @@ add('deduplicate_by_hash', CheckboxType::class) ->add('use_content_disposition', CheckboxType::class) ->add('relocate_existing_objects', CheckboxType::class) - ->add('rename_existing_objects', CheckboxType::class); + ->add('rename_existing_objects', CheckboxType::class) + ; } } - - diff --git a/src/DataDefinitionsBundle/Form/Type/Interpreter/CarbonInterpreterType.php b/src/DataDefinitionsBundle/Form/Type/Interpreter/CarbonInterpreterType.php index feee5862..404ec6d1 100644 --- a/src/DataDefinitionsBundle/Form/Type/Interpreter/CarbonInterpreterType.php +++ b/src/DataDefinitionsBundle/Form/Type/Interpreter/CarbonInterpreterType.php @@ -1,19 +1,18 @@ add('date_format', TextType::class); + ->add('date_format', TextType::class) + ; } } diff --git a/src/DataDefinitionsBundle/Form/Type/Interpreter/ConditionalInterpreterType.php b/src/DataDefinitionsBundle/Form/Type/Interpreter/ConditionalInterpreterType.php index 1dd5730e..cb286109 100644 --- a/src/DataDefinitionsBundle/Form/Type/Interpreter/ConditionalInterpreterType.php +++ b/src/DataDefinitionsBundle/Form/Type/Interpreter/ConditionalInterpreterType.php @@ -1,19 +1,18 @@ add('condition', TextType::class) ->add('true_interpreter', InterpreterType::class) - ->add('false_interpreter', InterpreterType::class); + ->add('false_interpreter', InterpreterType::class) + ; } } diff --git a/src/DataDefinitionsBundle/Form/Type/Interpreter/CoreShop/MoneyInterpreterType.php b/src/DataDefinitionsBundle/Form/Type/Interpreter/CoreShop/MoneyInterpreterType.php index 2c0fb304..c09adec2 100644 --- a/src/DataDefinitionsBundle/Form/Type/Interpreter/CoreShop/MoneyInterpreterType.php +++ b/src/DataDefinitionsBundle/Form/Type/Interpreter/CoreShop/MoneyInterpreterType.php @@ -2,6 +2,17 @@ declare(strict_types=1); +/* + * This source file is available under two different licenses: + * - GNU General Public License version 3 (GPLv3) + * - Data Definitions Commercial License (DDCL) + * Full copyright and license information is available in + * LICENSE.md which is distributed with this source code. + * + * @copyright Copyright (c) CORS GmbH (https://www.cors.gmbh) in combination with instride AG (https://instride.ch) + * @license GPLv3 and DDCL + */ + namespace Instride\Bundle\DataDefinitionsBundle\Form\Type\Interpreter\CoreShop; use CoreShop\Bundle\CurrencyBundle\Form\Type\CurrencyChoiceType; @@ -24,14 +35,14 @@ function ($value) { return $value; }, function ($value) { - if (isset($value['currency']) && $value['currency'] instanceof CurrencyInterface) { $value['currency'] = $value['currency']->getId(); } return $value; - } - ) - ); + }, + ), + ) + ; } } diff --git a/src/DataDefinitionsBundle/Form/Type/Interpreter/CoreShop/PriceInterpreterType.php b/src/DataDefinitionsBundle/Form/Type/Interpreter/CoreShop/PriceInterpreterType.php index 76b11906..0d1d5832 100644 --- a/src/DataDefinitionsBundle/Form/Type/Interpreter/CoreShop/PriceInterpreterType.php +++ b/src/DataDefinitionsBundle/Form/Type/Interpreter/CoreShop/PriceInterpreterType.php @@ -1,19 +1,18 @@ add('isFloat', CheckboxType::class); + ->add('isFloat', CheckboxType::class) + ; } } diff --git a/src/DataDefinitionsBundle/Form/Type/Interpreter/CoreShop/StoresInterpreterType.php b/src/DataDefinitionsBundle/Form/Type/Interpreter/CoreShop/StoresInterpreterType.php index d267b78b..dc397da1 100644 --- a/src/DataDefinitionsBundle/Form/Type/Interpreter/CoreShop/StoresInterpreterType.php +++ b/src/DataDefinitionsBundle/Form/Type/Interpreter/CoreShop/StoresInterpreterType.php @@ -1,28 +1,27 @@ add('value', TextType::class); + ->add('value', TextType::class) + ; } } diff --git a/src/DataDefinitionsBundle/Form/Type/Interpreter/DefinitionType.php b/src/DataDefinitionsBundle/Form/Type/Interpreter/DefinitionType.php index 0763c5ab..8f8aea89 100644 --- a/src/DataDefinitionsBundle/Form/Type/Interpreter/DefinitionType.php +++ b/src/DataDefinitionsBundle/Form/Type/Interpreter/DefinitionType.php @@ -1,30 +1,30 @@ add('definition', DefinitionChoiceType::class); + ->add('definition', DefinitionChoiceType::class) + ; } } diff --git a/src/DataDefinitionsBundle/Form/Type/Interpreter/ExpressionInterpreterType.php b/src/DataDefinitionsBundle/Form/Type/Interpreter/ExpressionInterpreterType.php index f59ec427..38aeaa45 100644 --- a/src/DataDefinitionsBundle/Form/Type/Interpreter/ExpressionInterpreterType.php +++ b/src/DataDefinitionsBundle/Form/Type/Interpreter/ExpressionInterpreterType.php @@ -1,19 +1,18 @@ add('expression', TextType::class); + ->add('expression', TextType::class) + ; } } diff --git a/src/DataDefinitionsBundle/Form/Type/Interpreter/HrefInterpreterType.php b/src/DataDefinitionsBundle/Form/Type/Interpreter/HrefInterpreterType.php index 5f5759c1..c3c2e648 100644 --- a/src/DataDefinitionsBundle/Form/Type/Interpreter/HrefInterpreterType.php +++ b/src/DataDefinitionsBundle/Form/Type/Interpreter/HrefInterpreterType.php @@ -1,19 +1,18 @@ 'document', ], ]) - ->add('class', TextType::class); + ->add('class', TextType::class) + ; } } diff --git a/src/DataDefinitionsBundle/Form/Type/Interpreter/InterpreterCollectionType.php b/src/DataDefinitionsBundle/Form/Type/Interpreter/InterpreterCollectionType.php index 6936a8b2..786867e9 100644 --- a/src/DataDefinitionsBundle/Form/Type/Interpreter/InterpreterCollectionType.php +++ b/src/DataDefinitionsBundle/Form/Type/Interpreter/InterpreterCollectionType.php @@ -1,19 +1,18 @@ registry = $registry; } @@ -42,8 +42,8 @@ public function buildForm(FormBuilderInterface $builder, array $options): void $options['entry_type'], array_replace( $options['entry_options'], - ['configuration_type' => $type] - ) + ['configuration_type' => $type], + ), ); $prototypes[$type] = $formBuilder->getForm(); diff --git a/src/DataDefinitionsBundle/Form/Type/Interpreter/InterpreterType.php b/src/DataDefinitionsBundle/Form/Type/Interpreter/InterpreterType.php index 54d0263a..304c9a85 100644 --- a/src/DataDefinitionsBundle/Form/Type/Interpreter/InterpreterType.php +++ b/src/DataDefinitionsBundle/Form/Type/Interpreter/InterpreterType.php @@ -1,37 +1,37 @@ formTypeRegistry = $formTypeRegistry; } @@ -40,7 +40,8 @@ public function buildForm(FormBuilderInterface $builder, array $options): void parent::buildForm($builder, $options); $builder - ->add('type', InterpreterChoiceType::class); + ->add('type', InterpreterChoiceType::class) + ; $builder ->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) { @@ -75,7 +76,8 @@ public function buildForm(FormBuilderInterface $builder, array $options): void } $this->addConfigurationFields($event->getForm(), $formType); - }); + }) + ; } public function configureOptions(OptionsResolver $resolver): void @@ -84,23 +86,17 @@ public function configureOptions(OptionsResolver $resolver): void $resolver ->setDefault('configuration_type', null) - ->setAllowedTypes('configuration_type', ['string', 'null']); + ->setAllowedTypes('configuration_type', ['string', 'null']) + ; } - /** - * @param FormInterface $form - * @param string $configurationType - */ protected function addConfigurationFields(FormInterface $form, string $configurationType): void { $form->add('interpreterConfig', $configurationType); } /** - * @param FormInterface $form * @param mixed $data - * - * @return string|null */ protected function getRegistryIdentifier(FormInterface $form, $data = null): ?string { diff --git a/src/DataDefinitionsBundle/Form/Type/Interpreter/IteratorInterpreterType.php b/src/DataDefinitionsBundle/Form/Type/Interpreter/IteratorInterpreterType.php index 0fddf297..fddc91fd 100644 --- a/src/DataDefinitionsBundle/Form/Type/Interpreter/IteratorInterpreterType.php +++ b/src/DataDefinitionsBundle/Form/Type/Interpreter/IteratorInterpreterType.php @@ -1,19 +1,18 @@ add('interpreter', InterpreterType::class); + ->add('interpreter', InterpreterType::class) + ; } } diff --git a/src/DataDefinitionsBundle/Form/Type/Interpreter/MappingInterpreterType.php b/src/DataDefinitionsBundle/Form/Type/Interpreter/MappingInterpreterType.php index 67c8e399..cf2eed49 100644 --- a/src/DataDefinitionsBundle/Form/Type/Interpreter/MappingInterpreterType.php +++ b/src/DataDefinitionsBundle/Form/Type/Interpreter/MappingInterpreterType.php @@ -1,19 +1,18 @@ true, 'allow_delete' => true, ]) - ->add('return_null_when_not_found', CheckboxType::class); + ->add('return_null_when_not_found', CheckboxType::class) + ; } } diff --git a/src/DataDefinitionsBundle/Form/Type/Interpreter/MappingType.php b/src/DataDefinitionsBundle/Form/Type/Interpreter/MappingType.php index debd0e78..fe2f12c9 100644 --- a/src/DataDefinitionsBundle/Form/Type/Interpreter/MappingType.php +++ b/src/DataDefinitionsBundle/Form/Type/Interpreter/MappingType.php @@ -1,19 +1,18 @@ add('from', TextType::class) - ->add('to', TextType::class); + ->add('to', TextType::class) + ; } } diff --git a/src/DataDefinitionsBundle/Form/Type/Interpreter/MetadataInterpreterType.php b/src/DataDefinitionsBundle/Form/Type/Interpreter/MetadataInterpreterType.php index 159fd0e4..8ce262bd 100644 --- a/src/DataDefinitionsBundle/Form/Type/Interpreter/MetadataInterpreterType.php +++ b/src/DataDefinitionsBundle/Form/Type/Interpreter/MetadataInterpreterType.php @@ -1,19 +1,18 @@ add('class', TextType::class) - ->add('metadata', TextType::class); + ->add('metadata', TextType::class) + ; } } diff --git a/src/DataDefinitionsBundle/Form/Type/Interpreter/MultiHrefInterpreterType.php b/src/DataDefinitionsBundle/Form/Type/Interpreter/MultiHrefInterpreterType.php index 54f2493f..38110d44 100644 --- a/src/DataDefinitionsBundle/Form/Type/Interpreter/MultiHrefInterpreterType.php +++ b/src/DataDefinitionsBundle/Form/Type/Interpreter/MultiHrefInterpreterType.php @@ -1,19 +1,18 @@ add('class', TextType::class); + ->add('class', TextType::class) + ; } } diff --git a/src/DataDefinitionsBundle/Form/Type/Interpreter/NestedInterpreterType.php b/src/DataDefinitionsBundle/Form/Type/Interpreter/NestedInterpreterType.php index 7fb9cb3b..c901327e 100644 --- a/src/DataDefinitionsBundle/Form/Type/Interpreter/NestedInterpreterType.php +++ b/src/DataDefinitionsBundle/Form/Type/Interpreter/NestedInterpreterType.php @@ -1,19 +1,18 @@ add('interpreters', InterpreterCollectionType::class); + ->add('interpreters', InterpreterCollectionType::class) + ; } } diff --git a/src/DataDefinitionsBundle/Form/Type/Interpreter/ObjectResolverType.php b/src/DataDefinitionsBundle/Form/Type/Interpreter/ObjectResolverType.php index e0457b02..2a0c134b 100644 --- a/src/DataDefinitionsBundle/Form/Type/Interpreter/ObjectResolverType.php +++ b/src/DataDefinitionsBundle/Form/Type/Interpreter/ObjectResolverType.php @@ -1,26 +1,25 @@ add('class', ClassChoiceType::class) ->add('field', TextType::class) - ->add('match_unpublished', CheckboxType::class); + ->add('match_unpublished', CheckboxType::class) + ; } } diff --git a/src/DataDefinitionsBundle/Form/Type/Interpreter/QuantityValueInterpreterType.php b/src/DataDefinitionsBundle/Form/Type/Interpreter/QuantityValueInterpreterType.php index ff6b5f06..7ebefda3 100644 --- a/src/DataDefinitionsBundle/Form/Type/Interpreter/QuantityValueInterpreterType.php +++ b/src/DataDefinitionsBundle/Form/Type/Interpreter/QuantityValueInterpreterType.php @@ -1,19 +1,18 @@ add('unit', TextType::class); + ->add('unit', TextType::class) + ; } } diff --git a/src/DataDefinitionsBundle/Form/Type/Interpreter/SpecificObjectInterpreterType.php b/src/DataDefinitionsBundle/Form/Type/Interpreter/SpecificObjectInterpreterType.php index 83e1b068..252475df 100644 --- a/src/DataDefinitionsBundle/Form/Type/Interpreter/SpecificObjectInterpreterType.php +++ b/src/DataDefinitionsBundle/Form/Type/Interpreter/SpecificObjectInterpreterType.php @@ -1,19 +1,18 @@ add('objectId', TextType::class); + ->add('objectId', TextType::class) + ; } } diff --git a/src/DataDefinitionsBundle/Form/Type/Interpreter/TwigInterpreterType.php b/src/DataDefinitionsBundle/Form/Type/Interpreter/TwigInterpreterType.php index 1dbfd9ea..7acf6994 100644 --- a/src/DataDefinitionsBundle/Form/Type/Interpreter/TwigInterpreterType.php +++ b/src/DataDefinitionsBundle/Form/Type/Interpreter/TwigInterpreterType.php @@ -1,19 +1,18 @@ add('template', TextareaType::class); + ->add('template', TextareaType::class) + ; } } diff --git a/src/DataDefinitionsBundle/Form/Type/Interpreter/TypeCastingInterpreterType.php b/src/DataDefinitionsBundle/Form/Type/Interpreter/TypeCastingInterpreterType.php index 68d9f43b..57113589 100644 --- a/src/DataDefinitionsBundle/Form/Type/Interpreter/TypeCastingInterpreterType.php +++ b/src/DataDefinitionsBundle/Form/Type/Interpreter/TypeCastingInterpreterType.php @@ -1,25 +1,24 @@ TypeCastingInterpreter::TYPE_STRING, TypeCastingInterpreter::TYPE_BOOLEAN => TypeCastingInterpreter::TYPE_BOOLEAN, ], - ]); + ]) + ; } } diff --git a/src/DataDefinitionsBundle/Form/Type/InterpreterChoiceType.php b/src/DataDefinitionsBundle/Form/Type/InterpreterChoiceType.php index 0ed2e50f..f95cefcf 100644 --- a/src/DataDefinitionsBundle/Form/Type/InterpreterChoiceType.php +++ b/src/DataDefinitionsBundle/Form/Type/InterpreterChoiceType.php @@ -1,19 +1,18 @@ interpreters = $interpreters; } diff --git a/src/DataDefinitionsBundle/Form/Type/LoaderChoiceType.php b/src/DataDefinitionsBundle/Form/Type/LoaderChoiceType.php index 179f088b..1d725571 100644 --- a/src/DataDefinitionsBundle/Form/Type/LoaderChoiceType.php +++ b/src/DataDefinitionsBundle/Form/Type/LoaderChoiceType.php @@ -1,19 +1,18 @@ loaders = $loaders; } diff --git a/src/DataDefinitionsBundle/Form/Type/NoConfigurationType.php b/src/DataDefinitionsBundle/Form/Type/NoConfigurationType.php index 8ba71444..cc100580 100644 --- a/src/DataDefinitionsBundle/Form/Type/NoConfigurationType.php +++ b/src/DataDefinitionsBundle/Form/Type/NoConfigurationType.php @@ -1,19 +1,18 @@ persisters = $persisters; } diff --git a/src/DataDefinitionsBundle/Form/Type/ProcessManager/ExportDefinitionObjectStartupForm.php b/src/DataDefinitionsBundle/Form/Type/ProcessManager/ExportDefinitionObjectStartupForm.php index 591b24f5..83821858 100644 --- a/src/DataDefinitionsBundle/Form/Type/ProcessManager/ExportDefinitionObjectStartupForm.php +++ b/src/DataDefinitionsBundle/Form/Type/ProcessManager/ExportDefinitionObjectStartupForm.php @@ -1,19 +1,18 @@ true, 'entry_type' => TextType::class, 'required' => false, - ]); + ]) + ; } } diff --git a/src/DataDefinitionsBundle/Form/Type/ProcessManager/ImportDefinitionsType.php b/src/DataDefinitionsBundle/Form/Type/ProcessManager/ImportDefinitionsType.php index 928e814d..b8b873bd 100644 --- a/src/DataDefinitionsBundle/Form/Type/ProcessManager/ImportDefinitionsType.php +++ b/src/DataDefinitionsBundle/Form/Type/ProcessManager/ImportDefinitionsType.php @@ -1,19 +1,18 @@ add('definition', TextType::class) - ->add('params', TextType::class); + ->add('params', TextType::class) + ; } } diff --git a/src/DataDefinitionsBundle/Form/Type/RunnerChoiceType.php b/src/DataDefinitionsBundle/Form/Type/RunnerChoiceType.php index 4d1f57bf..e673b336 100644 --- a/src/DataDefinitionsBundle/Form/Type/RunnerChoiceType.php +++ b/src/DataDefinitionsBundle/Form/Type/RunnerChoiceType.php @@ -1,19 +1,18 @@ runners = $runners; } diff --git a/src/DataDefinitionsBundle/Form/Type/Setter/ClassificationStoreSetterType.php b/src/DataDefinitionsBundle/Form/Type/Setter/ClassificationStoreSetterType.php index 01f28972..fd042c00 100644 --- a/src/DataDefinitionsBundle/Form/Type/Setter/ClassificationStoreSetterType.php +++ b/src/DataDefinitionsBundle/Form/Type/Setter/ClassificationStoreSetterType.php @@ -1,19 +1,18 @@ add('field', TextType::class) ->add('keyConfig', IntegerType::class) - ->add('groupConfig', IntegerType::class); + ->add('groupConfig', IntegerType::class) + ; } } - - diff --git a/src/DataDefinitionsBundle/Form/Type/Setter/CoreShop/StorePriceSetterType.php b/src/DataDefinitionsBundle/Form/Type/Setter/CoreShop/StorePriceSetterType.php index 29753064..deab04ac 100644 --- a/src/DataDefinitionsBundle/Form/Type/Setter/CoreShop/StorePriceSetterType.php +++ b/src/DataDefinitionsBundle/Form/Type/Setter/CoreShop/StorePriceSetterType.php @@ -1,28 +1,27 @@ add('field', TextType::class) ->add('class', TextType::class) - ->add('keys', TextType::class); + ->add('keys', TextType::class) + ; } } - - diff --git a/src/DataDefinitionsBundle/Form/Type/Setter/LocalizedFieldSetterType.php b/src/DataDefinitionsBundle/Form/Type/Setter/LocalizedFieldSetterType.php index 65b2021a..6ca66b56 100644 --- a/src/DataDefinitionsBundle/Form/Type/Setter/LocalizedFieldSetterType.php +++ b/src/DataDefinitionsBundle/Form/Type/Setter/LocalizedFieldSetterType.php @@ -1,19 +1,18 @@ add('language', TextType::class); + ->add('language', TextType::class) + ; } } diff --git a/src/DataDefinitionsBundle/Form/Type/Setter/ObjectBrickSetterType.php b/src/DataDefinitionsBundle/Form/Type/Setter/ObjectBrickSetterType.php index e48ae527..e50f2ea5 100644 --- a/src/DataDefinitionsBundle/Form/Type/Setter/ObjectBrickSetterType.php +++ b/src/DataDefinitionsBundle/Form/Type/Setter/ObjectBrickSetterType.php @@ -1,19 +1,18 @@ add('brickField', TextType::class) - ->add('class', TextType::class); + ->add('class', TextType::class) + ; } } diff --git a/src/DataDefinitionsBundle/Form/Type/SetterChoiceType.php b/src/DataDefinitionsBundle/Form/Type/SetterChoiceType.php index 69615ebc..3025682d 100644 --- a/src/DataDefinitionsBundle/Form/Type/SetterChoiceType.php +++ b/src/DataDefinitionsBundle/Form/Type/SetterChoiceType.php @@ -1,19 +1,18 @@ setters = $setters; } diff --git a/src/DataDefinitionsBundle/Getter/DynamicColumnGetterInterface.php b/src/DataDefinitionsBundle/Getter/DynamicColumnGetterInterface.php index b6145199..5c9aa809 100644 --- a/src/DataDefinitionsBundle/Getter/DynamicColumnGetterInterface.php +++ b/src/DataDefinitionsBundle/Getter/DynamicColumnGetterInterface.php @@ -1,19 +1,18 @@ filterRegistry->get($filterType); } - $object = $this->importRow( $definition, $row, $dataSet, $params, $filter, - $runner + $runner, ); } @@ -132,7 +129,7 @@ public function doImportAsync(ImportDefinitionInterface $definition, array $para $definition->getId(), $row, $params, - ) + ), ); } } @@ -155,7 +152,6 @@ public function doImport(ImportDefinitionInterface $definition, $params): array $filter = $this->filterRegistry->get($filterType); } - /** @var ImportDataSetInterface|array $data */ $data = $this->getData($definition, $params); @@ -169,7 +165,6 @@ public function doImport(ImportDefinitionInterface $definition, $params): array $runner = $this->runnerRegistry->get($definition->getRunner()); } - if ((\is_countable($data) || $data instanceof Countable) && ($count = \count($data)) > 0) { $this->eventDispatcher->dispatch($definition, 'data_definitions.import.total', $count, $params); } @@ -192,7 +187,7 @@ public function doImport(ImportDefinitionInterface $definition, $params): array $this->eventDispatcher->dispatch( $definition, 'data_definitions.import.status', - sprintf('Running Cleaner "%s"', $cleanerType) + sprintf('Running Cleaner "%s"', $cleanerType), ); if ($cleaner instanceof ParamsAwareInterface) { @@ -209,7 +204,7 @@ public function doImport(ImportDefinitionInterface $definition, $params): array $this->eventDispatcher->dispatch( $definition, 'data_definitions.import.status', - sprintf('Finished Cleaner "%s"', $cleanerType) + sprintf('Finished Cleaner "%s"', $cleanerType), ); } @@ -234,7 +229,7 @@ public function processSuccessfullImport(ImportDefinitionInterface $definition, $definition, Document::getById($definition->getSuccessNotificationDocument()), $objectIds, - $exceptions + $exceptions, ); $this->eventDispatcher->dispatch($definition, 'data_definitions.import.success', $params); } @@ -249,7 +244,7 @@ public function processFailedImport(ImportDefinitionInterface $definition, $para $definition, Document::getById($definition->getFailureNotificationDocument()), $objectIds, - $exceptions + $exceptions, ); $this->eventDispatcher->dispatch($definition, 'data_definitions.import.failure', $params); } @@ -263,7 +258,7 @@ private function sendDocument( ImportDefinitionInterface $definition, ?Document $document, array $objectIds, - array $exceptions + array $exceptions, ) { if ($document instanceof Document) { $params = [ @@ -322,7 +317,7 @@ private function runImport( $dataSet, array_merge($params, ['row' => $count]), $filter, - $runner + $runner, ); if ($object instanceof Concrete) { @@ -337,7 +332,7 @@ private function runImport( $definition, 'data_definitions.import.failure', sprintf('Error: %s', $ex->getMessage()), - $params + $params, ); if ($definition->getStopOnException()) { @@ -351,11 +346,11 @@ private function runImport( $definition, 'data_definitions.import.status', 'Collect Garbage', - $params + $params, ); } - $count++; + ++$count; } $this->eventDispatcher->dispatch($definition, 'data_definitions.import.progress', '', $params); @@ -364,7 +359,7 @@ private function runImport( $this->eventDispatcher->dispatch( $definition, 'data_definitions.import.status', - 'Process has been stopped.' + 'Process has been stopped.', ); return [$objectIds, $exceptions]; @@ -390,7 +385,7 @@ private function importRow( $definition, 'data_definitions.import.status', 'Ignoring new Object', - $params + $params, ); return null; @@ -401,7 +396,7 @@ private function importRow( $definition, 'data_definitions.import.status', 'Ignoring existing Object', - $params + $params, ); return null; @@ -420,7 +415,7 @@ private function importRow( $definition, 'data_definitions.import.status', 'Filtered Object', - $params + $params, ); return null; @@ -431,13 +426,13 @@ private function importRow( $definition, 'data_definitions.import.status', sprintf('Import Object %s', ($object->getId() ? $object->getFullPath() : 'new')), - $params + $params, ); $this->eventDispatcher->dispatch( $definition, 'data_definitions.import.object.start', $object, - $params + $params, ); $runnerContext = $this->contextFactory->createRunnerContext($definition, $params, $data, $dataSet, $object); @@ -456,7 +451,7 @@ private function importRow( foreach ($definition->getMapping() as $mapItem) { $value = null; - if (array_key_exists($mapItem->getFromColumn(), $data) || $mapItem->getFromColumn() === "custom") { + if (array_key_exists($mapItem->getFromColumn(), $data) || $mapItem->getFromColumn() === 'custom') { $value = $data[$mapItem->getFromColumn()] ?? null; $this->setObjectValue($object, $mapItem, $value, $data, $dataSet, $definition, $params, $runner); } @@ -483,14 +478,14 @@ private function importRow( $definition, 'data_definitions.import.status', sprintf('Imported Object %s', $object->getFullPath()), - $params + $params, ); } else { $this->eventDispatcher->dispatch( $definition, 'data_definitions.import.status', sprintf('Skipped Object %s', $object->getFullPath()), - $params + $params, ); } @@ -498,13 +493,13 @@ private function importRow( $definition, 'data_definitions.import.status', sprintf('Imported Object %s', $object->getFullPath()), - $params + $params, ); $this->eventDispatcher->dispatch( $definition, 'data_definitions.import.object.finished', $object, - $params + $params, ); if ($runner instanceof RunnerInterface) { @@ -526,7 +521,7 @@ private function setObjectValue( ImportDataSetInterface $dataSet, ImportDefinitionInterface $definition, array $params, - RunnerInterface $runner = null + RunnerInterface $runner = null, ): void { if ($map->getInterpreter()) { try { @@ -549,7 +544,7 @@ private function setObjectValue( $dataSet, $object, $value, - $map + $map, ); $value = $interpreter->interpret($context); } catch (UnexpectedValueException $ex) { @@ -557,15 +552,13 @@ private function setObjectValue( sprintf( 'Unexpected Value from Interpreter "%s" with message "%s"', $map->getInterpreter(), - $ex->getMessage() - ) + $ex->getMessage(), + ), ); } - } catch (DoNotSetException $ex) { return; } - } if ($map->getToColumn() === 'o_type' && $map->getSetter() !== 'object_type') { @@ -595,7 +588,7 @@ private function setObjectValue( $map, $data, $dataSet, - $value + $value, ); if ($setter instanceof SetterInterface) { @@ -614,10 +607,10 @@ private function getObject( ImportDefinitionInterface $definition, $data, ImportDataSetInterface $dataSet, - $params + $params, ): Concrete { $class = $definition->getClass(); - $classObject = '\Pimcore\Model\DataObject\\'.ucfirst($class); + $classObject = '\Pimcore\Model\DataObject\\' . ucfirst($class); $classDefinition = ClassDefinition::getByName($class); if (!$classDefinition instanceof ClassDefinition) { diff --git a/src/DataDefinitionsBundle/Importer/ImporterInterface.php b/src/DataDefinitionsBundle/Importer/ImporterInterface.php index 2c031826..bc14b2a4 100644 --- a/src/DataDefinitionsBundle/Importer/ImporterInterface.php +++ b/src/DataDefinitionsBundle/Importer/ImporterInterface.php @@ -1,19 +1,18 @@ getConfiguration()['path'].'/'.$context->getValue(); + $assetFullPath = $context->getConfiguration()['path'] . '/' . $context->getValue(); return Asset::getByPath($assetFullPath); } diff --git a/src/DataDefinitionsBundle/Interpreter/AssetUrlInterpreter.php b/src/DataDefinitionsBundle/Interpreter/AssetUrlInterpreter.php index bbe82c28..ae66063a 100644 --- a/src/DataDefinitionsBundle/Interpreter/AssetUrlInterpreter.php +++ b/src/DataDefinitionsBundle/Interpreter/AssetUrlInterpreter.php @@ -1,36 +1,38 @@ httpClient = $httpClient; $this->requestFactory = $requestFactory; @@ -41,7 +43,7 @@ public function interpret(InterpreterContextInterface $context): mixed $path = $context->getConfiguration()['path']; $url = $context->getValue(); - if (filter_var($url, FILTER_VALIDATE_URL) === false) { + if (filter_var($url, \FILTER_VALIDATE_URL) === false) { throw new \InvalidArgumentException(sprintf('Provided asset URL value %1$s is not a valid URL', $url)); } $parent = Asset\Service::createFolderByPath($path); @@ -74,7 +76,7 @@ public function interpret(InterpreterContextInterface $context): mixed $save = false; $currentUrl = $asset->getMetadata(self::METADATA_ORIGIN_URL) ?? ''; if (strpos($currentUrl, $url) === false) { - $url = $currentUrl ? $currentUrl .'|'. $url : $url; + $url = $currentUrl ? $currentUrl . '|' . $url : $url; $asset->addMetadata(self::METADATA_ORIGIN_URL, 'input', $url); $save = true; } @@ -110,11 +112,11 @@ private function getFileName(string $url, bool $useContentDisposition = false): $headers = $response->getHeaders(); if ( - isset($headers["Content-Disposition"]) && + isset($headers['Content-Disposition']) && preg_match( '/^.*?filename=(?[^\s]+|\x22[^\x22]+\x22)\x3B?.*$/m', - current($headers["Content-Disposition"]), - $match + current($headers['Content-Disposition']), + $match, ) ) { $filename = trim($match['f'], ' ";'); @@ -135,14 +137,14 @@ protected function getFileContents(string $value): string $request = $this->requestFactory->createRequest('GET', $value); $response = $this->httpClient->sendRequest($request); } catch (\Psr\Http\Client\ClientExceptionInterface $ex) { - throw new \RuntimeException('Unable to download asset from URL '.$value); + throw new \RuntimeException('Unable to download asset from URL ' . $value); } if ($response->getStatusCode() === 200) { - return (string)$response->getBody(); + return (string) $response->getBody(); } - throw new \RuntimeException('Unable to download asset from URL '.$value); + throw new \RuntimeException('Unable to download asset from URL ' . $value); } private function deduplicateAssetByUrl(string $value): ?Asset @@ -161,11 +163,11 @@ private function deduplicateAsset(string $name, string $value, bool $fuzzy = fal $listing->onCreateQueryBuilder( function (QueryBuilder $select) { $select->join('assets', 'assets_metadata', 'am', 'id = am.cid'); - } + }, ); $listing->addConditionParam('am.name = ?', $name); if ($fuzzy) { - $listing->addConditionParam('am.data LIKE ?', '%'. $value .'%'); + $listing->addConditionParam('am.data LIKE ?', '%' . $value . '%'); } else { $listing->addConditionParam('am.data = ?', $value); } diff --git a/src/DataDefinitionsBundle/Interpreter/AssetsUrlInterpreter.php b/src/DataDefinitionsBundle/Interpreter/AssetsUrlInterpreter.php index 1901135b..0461cdd7 100644 --- a/src/DataDefinitionsBundle/Interpreter/AssetsUrlInterpreter.php +++ b/src/DataDefinitionsBundle/Interpreter/AssetsUrlInterpreter.php @@ -1,19 +1,18 @@ getValue() as $item) { + foreach ((array) $context->getValue() as $item) { $childContext = new InterpreterContext( $context->getDefinition(), $context->getParams(), @@ -33,7 +32,7 @@ public function interpret(InterpreterContextInterface $context): mixed $context->getDataSet(), $context->getObject(), $item, - $context->getMapping() + $context->getMapping(), ); $asset = parent::interpret($childContext); diff --git a/src/DataDefinitionsBundle/Interpreter/CarbonInterpreter.php b/src/DataDefinitionsBundle/Interpreter/CarbonInterpreter.php index 0bdc992d..7eb597ac 100644 --- a/src/DataDefinitionsBundle/Interpreter/CarbonInterpreter.php +++ b/src/DataDefinitionsBundle/Interpreter/CarbonInterpreter.php @@ -1,19 +1,18 @@ getValue())) { - if ($context->getValue() === "") { + if ($context->getValue() === '') { return null; } - return filter_var(strtolower($context->getValue()), FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); + return filter_var(strtolower($context->getValue()), \FILTER_VALIDATE_BOOLEAN, \FILTER_NULL_ON_FAILURE); } - return ((bool)$context->getValue()); + return (bool) $context->getValue(); } } diff --git a/src/DataDefinitionsBundle/Interpreter/ConditionalInterpreter.php b/src/DataDefinitionsBundle/Interpreter/ConditionalInterpreter.php index 9f944c9d..d889b1bc 100644 --- a/src/DataDefinitionsBundle/Interpreter/ConditionalInterpreter.php +++ b/src/DataDefinitionsBundle/Interpreter/ConditionalInterpreter.php @@ -1,26 +1,25 @@ getDataSet(), $context->getObject(), $context->getValue(), - $context->getMapping() + $context->getMapping(), ); return $interpreterObject->interpret($newContext); diff --git a/src/DataDefinitionsBundle/Interpreter/CoreShop/CurrencyInterpreter.php b/src/DataDefinitionsBundle/Interpreter/CoreShop/CurrencyInterpreter.php index 75ce721e..bab8de7d 100644 --- a/src/DataDefinitionsBundle/Interpreter/CoreShop/CurrencyInterpreter.php +++ b/src/DataDefinitionsBundle/Interpreter/CoreShop/CurrencyInterpreter.php @@ -1,19 +1,18 @@ currencyRepository = $currencyRepository; } @@ -34,5 +34,3 @@ public function interpret(InterpreterContextInterface $context): mixed return $this->currencyRepository->getByCode($context->getValue()); } } - - diff --git a/src/DataDefinitionsBundle/Interpreter/CoreShop/MoneyInterpreter.php b/src/DataDefinitionsBundle/Interpreter/CoreShop/MoneyInterpreter.php index 54bf90b3..8ee70725 100644 --- a/src/DataDefinitionsBundle/Interpreter/CoreShop/MoneyInterpreter.php +++ b/src/DataDefinitionsBundle/Interpreter/CoreShop/MoneyInterpreter.php @@ -1,19 +1,18 @@ currencyRepository = $currencyRepository; } public function interpret(InterpreterContextInterface $context): mixed { - $value = $this->getValue((string)$context->getValue(), $context); - $currency = $this->resolveCurrency((string)$value, $context); + $value = $this->getValue((string) $context->getValue(), $context); + $currency = $this->resolveCurrency((string) $value, $context); if (null === $currency) { return null; @@ -47,26 +47,26 @@ private function getValue(string $value, InterpreterContextInterface $context): { $inputIsFloat = $context->getConfiguration()['isFloat']; - $value = preg_replace("/[^0-9,.]+/", "", $value); + $value = preg_replace('/[^0-9,.]+/', '', $value); if (\is_string($value)) { $value = str_replace(',', '.', $value); - $value = (float)$value; + $value = (float) $value; } if ($inputIsFloat) { - $value = (int)round(round($value, 2) * 100, 0); + $value = (int) round(round($value, 2) * 100, 0); } - return (int)$value; + return (int) $value; } - private function resolveCurrency(string $value, InterpreterContextInterface$context): ?CurrencyInterface + private function resolveCurrency(string $value, InterpreterContextInterface $context): ?CurrencyInterface { $currency = null; if (preg_match('/^\pL+$/u', $value)) { - $currencyCode = preg_replace("/[^a-zA-Z]+/", "", $value); + $currencyCode = preg_replace('/[^a-zA-Z]+/', '', $value); $currency = $this->currencyRepository->getByCode($currencyCode); } diff --git a/src/DataDefinitionsBundle/Interpreter/CoreShop/PriceInterpreter.php b/src/DataDefinitionsBundle/Interpreter/CoreShop/PriceInterpreter.php index 6613918e..633f3df5 100644 --- a/src/DataDefinitionsBundle/Interpreter/CoreShop/PriceInterpreter.php +++ b/src/DataDefinitionsBundle/Interpreter/CoreShop/PriceInterpreter.php @@ -1,19 +1,18 @@ getConfiguration()['stores']; } } - - diff --git a/src/DataDefinitionsBundle/Interpreter/DefaultValueInterpreter.php b/src/DataDefinitionsBundle/Interpreter/DefaultValueInterpreter.php index 5ecc3356..f919c1d8 100644 --- a/src/DataDefinitionsBundle/Interpreter/DefaultValueInterpreter.php +++ b/src/DataDefinitionsBundle/Interpreter/DefaultValueInterpreter.php @@ -1,19 +1,18 @@ definitionRepository->find($context->getConfiguration()['definition']); if (!$subDefinition instanceof ImportDefinitionInterface) { diff --git a/src/DataDefinitionsBundle/Interpreter/DoNotSetOnEmptyInterpreter.php b/src/DataDefinitionsBundle/Interpreter/DoNotSetOnEmptyInterpreter.php index 22770e61..c9c76367 100644 --- a/src/DataDefinitionsBundle/Interpreter/DoNotSetOnEmptyInterpreter.php +++ b/src/DataDefinitionsBundle/Interpreter/DoNotSetOnEmptyInterpreter.php @@ -1,19 +1,18 @@ getValue() === "" || $context->getValue() === null) { + if ($context->getValue() === '' || $context->getValue() === null) { throw new DoNotSetException(); } diff --git a/src/DataDefinitionsBundle/Interpreter/ExpressionInterpreter.php b/src/DataDefinitionsBundle/Interpreter/ExpressionInterpreter.php index a7a610f0..14296c48 100644 --- a/src/DataDefinitionsBundle/Interpreter/ExpressionInterpreter.php +++ b/src/DataDefinitionsBundle/Interpreter/ExpressionInterpreter.php @@ -1,39 +1,42 @@ expressionLanguage = $expressionLanguage; $this->container = $container; } - public function interpret(InterpreterContextInterface $context): mixed { + public function interpret(InterpreterContextInterface $context): mixed + { $expression = $context->getConfiguration()['expression']; try { @@ -54,7 +57,7 @@ public function interpret(InterpreterContextInterface $context): mixed { $context->getMapping(), $context->getParams(), $context->getValue(), - $exception + $exception, ); } } diff --git a/src/DataDefinitionsBundle/Interpreter/ExternalImageInterpreter.php b/src/DataDefinitionsBundle/Interpreter/ExternalImageInterpreter.php index 2c008782..11f299d2 100644 --- a/src/DataDefinitionsBundle/Interpreter/ExternalImageInterpreter.php +++ b/src/DataDefinitionsBundle/Interpreter/ExternalImageInterpreter.php @@ -1,39 +1,38 @@ getDefinition() instanceof ExportDefinitionInterface) && $context->getValue( - ) instanceof ExternalImage) { + ) instanceof ExternalImage) { return $context->getValue()->getUrl(); } if (($context->getDefinition() instanceof ImportDefinitionInterface) && filter_var( - $context->getValue(), - FILTER_VALIDATE_URL - )) { + $context->getValue(), + \FILTER_VALIDATE_URL, + )) { return new ExternalImage($context->getValue()); } diff --git a/src/DataDefinitionsBundle/Interpreter/HrefInterpreter.php b/src/DataDefinitionsBundle/Interpreter/HrefInterpreter.php index e91f7e03..72f97571 100644 --- a/src/DataDefinitionsBundle/Interpreter/HrefInterpreter.php +++ b/src/DataDefinitionsBundle/Interpreter/HrefInterpreter.php @@ -1,25 +1,24 @@ ruleValidationProcessor = $ruleValidationProcessor; $this->ruleProcessor = $ruleProcessor; @@ -81,13 +81,13 @@ public function interpret(InterpreterContextInterface $context): mixed $context->getDefinition(), $context->getObject(), $rule, - $params + $params, )) { $value = $this->ruleProcessor->applyRule( $rule, $context->getObject(), $value, - $params + $params, ); } } diff --git a/src/DataDefinitionsBundle/Interpreter/InterpreterInterface.php b/src/DataDefinitionsBundle/Interpreter/InterpreterInterface.php index 3cb8be1c..b14c3d86 100644 --- a/src/DataDefinitionsBundle/Interpreter/InterpreterInterface.php +++ b/src/DataDefinitionsBundle/Interpreter/InterpreterInterface.php @@ -1,19 +1,18 @@ getDataSet(), $context->getObject(), $val, - $context->getMapping() + $context->getMapping(), ); $result[] = $interpreterObject->interpret($context); diff --git a/src/DataDefinitionsBundle/Interpreter/LinkInterpreter.php b/src/DataDefinitionsBundle/Interpreter/LinkInterpreter.php index 3db1a3cd..ac78bb05 100644 --- a/src/DataDefinitionsBundle/Interpreter/LinkInterpreter.php +++ b/src/DataDefinitionsBundle/Interpreter/LinkInterpreter.php @@ -1,26 +1,25 @@ getDefinition() instanceof ImportDefinitionInterface)) { $link = new Link(); - if (filter_var($context->getValue(), FILTER_VALIDATE_URL)) { + if (filter_var($context->getValue(), \FILTER_VALIDATE_URL)) { $link->setDirect($context->getValue()); } diff --git a/src/DataDefinitionsBundle/Interpreter/MappingInterpreter.php b/src/DataDefinitionsBundle/Interpreter/MappingInterpreter.php index 27492984..54ef1fef 100644 --- a/src/DataDefinitionsBundle/Interpreter/MappingInterpreter.php +++ b/src/DataDefinitionsBundle/Interpreter/MappingInterpreter.php @@ -1,19 +1,18 @@ getConfiguration()['class']; + $class = '\\Pimcore\\Model\\DataObject\\Data\\' . $context->getConfiguration()['class']; $fieldname = $context->getMapping()->getToColumn(); $metadata = $context->getConfiguration()['metadata']; - $metadata = json_decode($metadata, true, 512, JSON_THROW_ON_ERROR); + $metadata = json_decode($metadata, true, 512, \JSON_THROW_ON_ERROR); if (!is_array($metadata)) { $metadata = []; } @@ -36,7 +35,7 @@ public function interpret(InterpreterContextInterface $context): mixed /** @var ElementMetadata|ObjectMetadata $elementMetadata */ $elementMetadata = new $class($fieldname, array_keys($metadata), $context->getValue()); foreach ($metadata as $metadataKey => $metadataValue) { - $setter = 'set'.ucfirst($metadataKey); + $setter = 'set' . ucfirst($metadataKey); $elementMetadata->$setter($metadataValue); } diff --git a/src/DataDefinitionsBundle/Interpreter/MultiHrefInterpreter.php b/src/DataDefinitionsBundle/Interpreter/MultiHrefInterpreter.php index 9e064267..72bc1529 100644 --- a/src/DataDefinitionsBundle/Interpreter/MultiHrefInterpreter.php +++ b/src/DataDefinitionsBundle/Interpreter/MultiHrefInterpreter.php @@ -1,24 +1,23 @@ getConfiguration()['class']; - $class = 'Pimcore\Model\DataObject\\'.ucfirst($objectClass); + $class = 'Pimcore\Model\DataObject\\' . ucfirst($objectClass); if (Tool::classExists($class)) { $class = new $class(); diff --git a/src/DataDefinitionsBundle/Interpreter/NestedInterpreter.php b/src/DataDefinitionsBundle/Interpreter/NestedInterpreter.php index cf097073..245f741a 100644 --- a/src/DataDefinitionsBundle/Interpreter/NestedInterpreter.php +++ b/src/DataDefinitionsBundle/Interpreter/NestedInterpreter.php @@ -1,31 +1,30 @@ getDataSet(), $context->getObject(), $value, - $context->getMapping() + $context->getMapping(), ); $value = $interpreterObject->interpret($newContext); diff --git a/src/DataDefinitionsBundle/Interpreter/ObjectResolverInterpreter.php b/src/DataDefinitionsBundle/Interpreter/ObjectResolverInterpreter.php index cac3b1a6..9e7be71c 100644 --- a/src/DataDefinitionsBundle/Interpreter/ObjectResolverInterpreter.php +++ b/src/DataDefinitionsBundle/Interpreter/ObjectResolverInterpreter.php @@ -1,23 +1,22 @@ getConfiguration()['class']); - $lookup = 'getBy'.ucfirst($context->getConfiguration()['field']); + $class = 'Pimcore\Model\DataObject\\' . ucfirst($context->getConfiguration()['class']); + $lookup = 'getBy' . ucfirst($context->getConfiguration()['field']); /** * @var Listing $listing diff --git a/src/DataDefinitionsBundle/Interpreter/QuantityValueInterpreter.php b/src/DataDefinitionsBundle/Interpreter/QuantityValueInterpreter.php index 4ba6eb9e..689277e9 100644 --- a/src/DataDefinitionsBundle/Interpreter/QuantityValueInterpreter.php +++ b/src/DataDefinitionsBundle/Interpreter/QuantityValueInterpreter.php @@ -1,23 +1,22 @@ twig = $twig; } diff --git a/src/DataDefinitionsBundle/Interpreter/TypeCastingInterpreter.php b/src/DataDefinitionsBundle/Interpreter/TypeCastingInterpreter.php index a39cbc7b..fd14b6fb 100644 --- a/src/DataDefinitionsBundle/Interpreter/TypeCastingInterpreter.php +++ b/src/DataDefinitionsBundle/Interpreter/TypeCastingInterpreter.php @@ -1,29 +1,31 @@ getValue(); + return (int) $context->getValue(); case static::TYPE_FLOAT: - return (float)$context->getValue(); + return (float) $context->getValue(); case static::TYPE_STRING: - return (string)$context->getValue(); + return (string) $context->getValue(); case static::TYPE_BOOLEAN: - return (boolean)$context->getValue(); + return (bool) $context->getValue(); } throw new InvalidArgumentException(sprintf('Not valid type cast given, given %s', $type)); diff --git a/src/DataDefinitionsBundle/Loader/LoaderInterface.php b/src/DataDefinitionsBundle/Loader/LoaderInterface.php index 96d4d3ee..d5c0c292 100644 --- a/src/DataDefinitionsBundle/Loader/LoaderInterface.php +++ b/src/DataDefinitionsBundle/Loader/LoaderInterface.php @@ -1,23 +1,22 @@ getClass()); - $classList = '\Pimcore\Model\DataObject\\'.ucfirst($context->getClass()).'\Listing'; + $classObject = '\Pimcore\Model\DataObject\\' . ucfirst($context->getClass()); + $classList = '\Pimcore\Model\DataObject\\' . ucfirst($context->getClass()) . '\Listing'; $list = new $classList(); @@ -42,7 +41,7 @@ public function load(LoaderContextInterface $context): ?Concrete $conditionValues = []; foreach ($mapping as $map) { if ($map->getPrimaryIdentifier()) { - $condition[] = '`'.$map->getToColumn().'` = ?'; + $condition[] = '`' . $map->getToColumn() . '` = ?'; $conditionValues[] = $context->getDataRow()[$map->getFromColumn()]; } } diff --git a/src/DataDefinitionsBundle/Messenger/ImportRowMessage.php b/src/DataDefinitionsBundle/Messenger/ImportRowMessage.php index fc0f6b19..77b3a516 100644 --- a/src/DataDefinitionsBundle/Messenger/ImportRowMessage.php +++ b/src/DataDefinitionsBundle/Messenger/ImportRowMessage.php @@ -1,29 +1,33 @@ definitionId = $definitionId; $this->data = $data; $this->params = $params; diff --git a/src/DataDefinitionsBundle/Messenger/ImportRowMessageHandler.php b/src/DataDefinitionsBundle/Messenger/ImportRowMessageHandler.php index f50e51b0..6d52a930 100644 --- a/src/DataDefinitionsBundle/Messenger/ImportRowMessageHandler.php +++ b/src/DataDefinitionsBundle/Messenger/ImportRowMessageHandler.php @@ -1,19 +1,18 @@ identifier; @@ -36,9 +32,6 @@ public function setIdentifier($identifier): void $this->identifier = $identifier; } - /** - * @param array $values - */ public function setValues(array $values): void { foreach ($values as $key => $value) { diff --git a/src/DataDefinitionsBundle/Model/AbstractDataDefinition.php b/src/DataDefinitionsBundle/Model/AbstractDataDefinition.php index 5c5334fd..a0652494 100644 --- a/src/DataDefinitionsBundle/Model/AbstractDataDefinition.php +++ b/src/DataDefinitionsBundle/Model/AbstractDataDefinition.php @@ -1,19 +1,18 @@ $value) { @@ -57,7 +53,7 @@ public function setValues(array $values) } /** - * @return null|string + * @return string|null */ public function getToColumn() { @@ -73,7 +69,7 @@ public function setToColumn($toColumn) } /** - * @return null|string + * @return string|null */ public function getFromColumn() { @@ -89,7 +85,7 @@ public function setFromColumn($fromColumn) } /** - * @return null|string + * @return string|null */ public function getInterpreter() { diff --git a/src/DataDefinitionsBundle/Model/DataDefinitionInterface.php b/src/DataDefinitionsBundle/Model/DataDefinitionInterface.php index 439dfaaf..0691a978 100644 --- a/src/DataDefinitionsBundle/Model/DataDefinitionInterface.php +++ b/src/DataDefinitionsBundle/Model/DataDefinitionInterface.php @@ -1,26 +1,24 @@ id = (int)$id; + $this->id = (int) $id; } public function setName($name) @@ -69,17 +68,11 @@ public function setName($name) $this->name = $name; } - /** - * @param bool $enableInheritance - */ public function setEnableInheritance(bool $enableInheritance): void { $this->enableInheritance = $enableInheritance; } - /** - * @return bool - */ public function isEnableInheritance(): bool { return $this->enableInheritance; @@ -105,17 +98,11 @@ public function setFetcherConfig($fetcherConfig) $this->fetcherConfig = $fetcherConfig; } - /** - * @param bool $fetchUnpublushed - */ public function setFetchUnpublished(bool $fetchUnpublushed): void { $this->fetchUnpublished = $fetchUnpublushed; } - /** - * @return bool - */ public function isFetchUnpublished(): bool { return $this->fetchUnpublished; diff --git a/src/DataDefinitionsBundle/Model/ExportDefinition/Dao.php b/src/DataDefinitionsBundle/Model/ExportDefinition/Dao.php index df088486..5fd148b8 100644 --- a/src/DataDefinitionsBundle/Model/ExportDefinition/Dao.php +++ b/src/DataDefinitionsBundle/Model/ExportDefinition/Dao.php @@ -1,26 +1,25 @@ $value) { if ($key === 'mapping') { - $maps = array(); + $maps = []; foreach ($this->model->getMapping() as $map) { if (\is_array($map)) { @@ -79,7 +78,7 @@ public function getById(string $id) } else { throw new Model\Exception\NotFoundException(sprintf( 'Export Definition with ID "%s" does not exist.', - $id + $id, )); } } @@ -87,17 +86,18 @@ public function getById(string $id) public function getByName(string $name): void { foreach ($this->loadIdList() as $id) { - $definition = ExportDefinition::getById((int)$id); + $definition = ExportDefinition::getById((int) $id); if ($definition->getName() === $name) { $this->getById((string) $id); + return; } } throw new Model\Exception\NotFoundException(sprintf( 'Export Definition with Name "%s" does not exist.', - $name + $name, )); } @@ -148,7 +148,7 @@ public function save() } } elseif ($key === 'mapping') { if ($value) { - $data[$key] = array(); + $data[$key] = []; if (\is_array($value)) { foreach ($value as $map) { @@ -161,7 +161,7 @@ public function save() } } } - $this->saveData((string)$this->model->getId(), $data); + $this->saveData((string) $this->model->getId(), $data); } protected function prepareDataStructureForYaml(string $id, mixed $data): mixed @@ -177,10 +177,11 @@ protected function prepareDataStructureForYaml(string $id, mixed $data): mixed /** * Deletes object from database + * * @throws Exception */ public function delete() { - $this->deleteData((string)$this->model->getId()); + $this->deleteData((string) $this->model->getId()); } } diff --git a/src/DataDefinitionsBundle/Model/ExportDefinition/Listing.php b/src/DataDefinitionsBundle/Model/ExportDefinition/Listing.php index 39edcfd1..6a382206 100644 --- a/src/DataDefinitionsBundle/Model/ExportDefinition/Listing.php +++ b/src/DataDefinitionsBundle/Model/ExportDefinition/Listing.php @@ -1,28 +1,27 @@ loadIdList() as $id) { - $definitions[] = ExportDefinition::getById((int)$id); + $definitions[] = ExportDefinition::getById((int) $id); } if ($this->model->getFilter()) { diff --git a/src/DataDefinitionsBundle/Model/ExportDefinitionInterface.php b/src/DataDefinitionsBundle/Model/ExportDefinitionInterface.php index a5110b6d..bc0d8682 100644 --- a/src/DataDefinitionsBundle/Model/ExportDefinitionInterface.php +++ b/src/DataDefinitionsBundle/Model/ExportDefinitionInterface.php @@ -1,31 +1,24 @@ group; } - /** - * @param string $group - */ public function setGroup(string $group) { $this->group = $group; diff --git a/src/DataDefinitionsBundle/Model/ExportMapping/ToColumn.php b/src/DataDefinitionsBundle/Model/ExportMapping/ToColumn.php index 1b18caad..ef907f73 100644 --- a/src/DataDefinitionsBundle/Model/ExportMapping/ToColumn.php +++ b/src/DataDefinitionsBundle/Model/ExportMapping/ToColumn.php @@ -1,24 +1,22 @@ = $maxNumber) { - $maxNumber = (int)$id + 1; + if ((int) $id >= $maxNumber) { + $maxNumber = (int) $id + 1; } } return $maxNumber; } - } diff --git a/src/DataDefinitionsBundle/Model/ImportDefinition.php b/src/DataDefinitionsBundle/Model/ImportDefinition.php index 2d5184b1..9e5668fb 100644 --- a/src/DataDefinitionsBundle/Model/ImportDefinition.php +++ b/src/DataDefinitionsBundle/Model/ImportDefinition.php @@ -1,19 +1,18 @@ getDao(); - $dao->getById((string)$id); + $dao->getById((string) $id); return $definitionEntry; } @@ -106,7 +105,7 @@ public static function getByName(string $name): self public function setId($id) { - $this->id = (int)$id; + $this->id = (int) $id; } public function setName($name) diff --git a/src/DataDefinitionsBundle/Model/ImportDefinition/Dao.php b/src/DataDefinitionsBundle/Model/ImportDefinition/Dao.php index 2ba4425a..12fc212b 100644 --- a/src/DataDefinitionsBundle/Model/ImportDefinition/Dao.php +++ b/src/DataDefinitionsBundle/Model/ImportDefinition/Dao.php @@ -1,26 +1,25 @@ $value) { if ($key === 'mapping') { - $maps = array(); + $maps = []; foreach ($this->model->getMapping() as $map) { if (\is_array($map)) { @@ -86,7 +85,7 @@ public function getById(string $id) } else { throw new Model\Exception\NotFoundException(sprintf( 'Import Definition with ID "%s" does not exist.', - $id + $id, )); } } @@ -94,17 +93,18 @@ public function getById(string $id) public function getByName(string $name): void { foreach ($this->loadIdList() as $id) { - $definition = ImportDefinition::getById((int)$id); + $definition = ImportDefinition::getById((int) $id); if ($definition->getName() === $name) { $this->getById((string) $id); + return; } } throw new Model\Exception\NotFoundException(sprintf( 'Import Definition with Name "%s" does not exist.', - $name + $name, )); } @@ -163,7 +163,7 @@ public function save() } } elseif ($key === 'mapping') { if ($value) { - $data[$key] = array(); + $data[$key] = []; if (\is_array($value)) { foreach ($value as $map) { @@ -177,8 +177,7 @@ public function save() } } - - $this->saveData((string)$this->model->getId(), $data); + $this->saveData((string) $this->model->getId(), $data); } protected function prepareDataStructureForYaml(string $id, mixed $data): mixed @@ -194,10 +193,11 @@ protected function prepareDataStructureForYaml(string $id, mixed $data): mixed /** * Deletes object from database + * * @throws Exception */ public function delete() { - $this->deleteData((string)$this->model->getId()); + $this->deleteData((string) $this->model->getId()); } } diff --git a/src/DataDefinitionsBundle/Model/ImportDefinition/Listing.php b/src/DataDefinitionsBundle/Model/ImportDefinition/Listing.php index 166d57c3..b8835ea5 100644 --- a/src/DataDefinitionsBundle/Model/ImportDefinition/Listing.php +++ b/src/DataDefinitionsBundle/Model/ImportDefinition/Listing.php @@ -1,29 +1,27 @@ loadIdList() as $id) { - $definitions[] = ImportDefinition::getById((int)$id); + $definitions[] = ImportDefinition::getById((int) $id); } if ($this->model->getFilter()) { diff --git a/src/DataDefinitionsBundle/Model/ImportDefinitionInterface.php b/src/DataDefinitionsBundle/Model/ImportDefinitionInterface.php index 12720b03..fbd71aef 100644 --- a/src/DataDefinitionsBundle/Model/ImportDefinitionInterface.php +++ b/src/DataDefinitionsBundle/Model/ImportDefinitionInterface.php @@ -1,19 +1,18 @@ group; } - /** - * @param string $group - */ public function setGroup(string $group) { $this->group = $group; diff --git a/src/DataDefinitionsBundle/Model/Log.php b/src/DataDefinitionsBundle/Model/Log.php index 8af5511c..1e11bbc1 100644 --- a/src/DataDefinitionsBundle/Model/Log.php +++ b/src/DataDefinitionsBundle/Model/Log.php @@ -1,29 +1,30 @@ model->setId($id); } - $data = $this->db->fetchAssociative('SELECT * FROM '.$this->tableName.' WHERE id = ?', [$this->model->getId()]); + $data = $this->db->fetchAssociative('SELECT * FROM ' . $this->tableName . ' WHERE id = ?', [$this->model->getId()]); if (!$data['id']) { throw new InvalidArgumentException(sprintf('Object with the ID %s does not exist', $this->model->getId())); @@ -77,7 +77,7 @@ public function save() $value = $this->model->$getter(); if (is_bool($value)) { - $value = (int)$value; + $value = (int) $value; } $buffer[$k] = $value; @@ -91,7 +91,7 @@ public function save() } $this->db->insert($this->tableName, $buffer); - $this->model->setId((int)$this->db->lastInsertId()); + $this->model->setId((int) $this->db->lastInsertId()); } /** diff --git a/src/DataDefinitionsBundle/Model/Log/Listing.php b/src/DataDefinitionsBundle/Model/Log/Listing.php index 23979523..c5dfbff3 100644 --- a/src/DataDefinitionsBundle/Model/Log/Listing.php +++ b/src/DataDefinitionsBundle/Model/Log/Listing.php @@ -1,26 +1,25 @@ loadIdList(); - $objects = array(); + $objects = []; foreach ($list as $o_id) { if ($object = Log::getById($o_id)) { $objects[] = $object; @@ -80,46 +80,44 @@ public function getQueryBuilder(...$columns): DoctrineQueryBuilder * Loads a list for the specified parameters, returns an array of ids. * * @return array + * * @throws Exception */ public function loadIdList() { $queryBuilder = $this->getQueryBuilder(['id']); $assetIds = $this->db->fetchFirstColumn( - (string)$queryBuilder, + (string) $queryBuilder, $this->model->getConditionVariables(), - $this->model->getConditionVariableTypes() + $this->model->getConditionVariableTypes(), ); return array_map('intval', $assetIds); } - /** * Get Count * - * @return int * @throws Exception */ public function getCount(): int { - return (int)$this->db->fetchOne( - 'SELECT COUNT(*) as amount FROM '.$this->getTableName().$this->getCondition().$this->getOffsetLimit(), - [$this->model->getConditionVariables()] + return (int) $this->db->fetchOne( + 'SELECT COUNT(*) as amount FROM ' . $this->getTableName() . $this->getCondition() . $this->getOffsetLimit(), + [$this->model->getConditionVariables()], ); } /** * Get Total Count. * - * @return int * @throws Exception */ public function getTotalCount(): int { - return (int)$this->db->fetchOne( - 'SELECT COUNT(*) as amount FROM '.$this->getTableName().$this->getCondition(), - [$this->model->getConditionVariables()] + return (int) $this->db->fetchOne( + 'SELECT COUNT(*) as amount FROM ' . $this->getTableName() . $this->getCondition(), + [$this->model->getConditionVariables()], ); } } diff --git a/src/DataDefinitionsBundle/Model/MappingInterface.php b/src/DataDefinitionsBundle/Model/MappingInterface.php index 150e6729..e434e195 100644 --- a/src/DataDefinitionsBundle/Model/MappingInterface.php +++ b/src/DataDefinitionsBundle/Model/MappingInterface.php @@ -1,25 +1,24 @@ processFactory = $processFactory; $this->processLogger = $processLogger; @@ -74,9 +77,6 @@ public function getProcess(): ProcessInterface return $this->process; } - /** - * @param DefinitionEventInterface $event - */ public function onTotalEvent(DefinitionEventInterface $event): void { if (null === $this->process) { @@ -84,9 +84,9 @@ public function onTotalEvent(DefinitionEventInterface $event): void $this->process = $this->processFactory->createProcess( sprintf( - static::PROCESS_NAME.' (%s): %s', + static::PROCESS_NAME . ' (%s): %s', $date->formatLocalized('%A %d %B %Y'), - $event->getDefinition()->getName() + $event->getDefinition()->getName(), ), static::PROCESS_TYPE, 'Loading', @@ -95,23 +95,19 @@ public function onTotalEvent(DefinitionEventInterface $event): void -1, 0, 1, - ProcessManagerBundle::STATUS_RUNNING - + ProcessManagerBundle::STATUS_RUNNING, ); $this->process->save(); - $this->processLogger->info($this->process, ImportDefinitionsReport::EVENT_TOTAL.$event->getSubject()); + $this->processLogger->info($this->process, ImportDefinitionsReport::EVENT_TOTAL . $event->getSubject()); } } - /** - * @return void - */ public function onProgressEvent(DefinitionEventInterface $event): void { if ($this->process) { $now = new \DateTimeImmutable(); - $this->lastProgressStepsCount++; + ++$this->lastProgressStepsCount; if ($this->lastProgressAt instanceof \DateTimeInterface) { $diff = $now->getTimestamp() - $this->lastProgressAt->getTimestamp(); @@ -139,13 +135,10 @@ public function onProgressEvent(DefinitionEventInterface $event): void } } - /** - * @param DefinitionEventInterface $event - */ public function onStatusEvent(DefinitionEventInterface $event): void { if ($this->process) { - $this->processLogger->info($this->process, ImportDefinitionsReport::EVENT_STATUS.$event->getSubject()); + $this->processLogger->info($this->process, ImportDefinitionsReport::EVENT_STATUS . $event->getSubject()); $now = new \DateTimeImmutable(); if ($this->lastStatusAt instanceof \DateTimeInterface) { @@ -165,9 +158,6 @@ public function onStatusEvent(DefinitionEventInterface $event): void } } - /** - * @param DefinitionEventInterface $event - */ public function onFinishedEvent(DefinitionEventInterface $event): void { if ($this->process) { @@ -178,13 +168,10 @@ public function onFinishedEvent(DefinitionEventInterface $event): void $this->process->setCompleted(time()); $this->process->save(); } - $this->processLogger->info($this->process, ImportDefinitionsReport::EVENT_FINISHED.$event->getSubject()); + $this->processLogger->info($this->process, ImportDefinitionsReport::EVENT_FINISHED . $event->getSubject()); } } - /** - * @param DefinitionEventInterface $event - */ public function onFailureEvent(DefinitionEventInterface $event): void { if ($this->process) { @@ -197,7 +184,7 @@ public function onFailureEvent(DefinitionEventInterface $event): void $this->process->save(); if (is_string($event->getSubject())) { - $this->processLogger->info($this->process, ImportDefinitionsReport::EVENT_STATUS_ERROR.$event->getSubject()); + $this->processLogger->info($this->process, ImportDefinitionsReport::EVENT_STATUS_ERROR . $event->getSubject()); } } } diff --git a/src/DataDefinitionsBundle/ProcessManager/ArtifactGenerationProviderInterface.php b/src/DataDefinitionsBundle/ProcessManager/ArtifactGenerationProviderInterface.php index 3aa1f349..d1ab3f8e 100644 --- a/src/DataDefinitionsBundle/ProcessManager/ArtifactGenerationProviderInterface.php +++ b/src/DataDefinitionsBundle/ProcessManager/ArtifactGenerationProviderInterface.php @@ -1,30 +1,26 @@ self::EVENT_STATUS_IMPORT_NEW, 'attr' => 'new', @@ -55,7 +63,6 @@ class ImportDefinitionsReport implements ReportInterface ], ]; - public function generateReport(ProcessInterface $process, string $log): string { $result = $this->doReport($log); @@ -75,42 +82,42 @@ public function generateReport(ProcessInterface $process, string $log): string $status = $result['productStatus'][$iter]; if (isset($status['error'])) { - $errors[] = 'Line '.($iter + 1).'. Error: '.$status['error']; - $errorsCnt++; + $errors[] = 'Line ' . ($iter + 1) . '. Error: ' . $status['error']; + ++$errorsCnt; } elseif (isset($status['ignore_filtered'])) { - $skippedFiltered++; + ++$skippedFiltered; } elseif (isset($status['ignore_new'])) { - $skippedNew++; + ++$skippedNew; } elseif (isset($status['ignore_existing'])) { - $skippedExisting++; + ++$skippedExisting; } elseif (isset($status['new'])) { - $importedNew++; + ++$importedNew; } elseif (isset($status['existing'])) { - $importedExisting++; + ++$importedExisting; } } } $items = []; - $items[] = 'Total lines processed: '.$total; + $items[] = 'Total lines processed: ' . $total; if ($importedNew) { - $items[] = 'Imported new objects: '.$importedNew; + $items[] = 'Imported new objects: ' . $importedNew; } if ($importedExisting) { - $items[] = 'Updates: '.$importedExisting; + $items[] = 'Updates: ' . $importedExisting; } if ($skippedNew) { - $items[] = 'Skipped new: '.$skippedNew; + $items[] = 'Skipped new: ' . $skippedNew; } if ($skippedExisting) { - $items[] = 'Skipped existing: '.$skippedExisting; + $items[] = 'Skipped existing: ' . $skippedExisting; } if ($skippedFiltered) { - $items[] = 'Filtered: '.$skippedFiltered; + $items[] = 'Filtered: ' . $skippedFiltered; } - $items[] = 'Errors count: '.$errorsCnt; + $items[] = 'Errors count: ' . $errorsCnt; if (count($errors)) { $items[] = 'Errors: '; @@ -122,7 +129,7 @@ public function generateReport(ProcessInterface $process, string $log): string protected function doReport($log) { - $lines = explode(PHP_EOL, $log); + $lines = explode(\PHP_EOL, $log); $result = [ 'currentObject' => 0, 'productStatus' => [], @@ -135,17 +142,12 @@ protected function doReport($log) return $result; } - /** - * @param $line - * @param $result - */ protected function processLine($line, &$result) { if ($this->checkForProgress($line, $result)) { return; } - if ($this->checkForTotal($line, $result)) { return; } @@ -157,11 +159,6 @@ protected function processLine($line, &$result) $this->processChecks($line, $result); } - /** - * @param $line - * @param $result - * @return bool - */ protected function checkForProgress($line, &$result): bool { if (str_contains($line, self::EVENT_PROGRESS)) { @@ -173,17 +170,12 @@ protected function checkForProgress($line, &$result): bool return false; } - /** - * @param $line - * @param $result - * @return bool - */ protected function checkForTotal($line, &$result): bool { $pos = strpos($line, self::EVENT_TOTAL); if ($pos) { $total = substr($line, $pos + strlen(self::EVENT_TOTAL)); - $result['total'] = (int)$total; + $result['total'] = (int) $total; return true; } @@ -191,18 +183,13 @@ protected function checkForTotal($line, &$result): bool return false; } - /** - * @param $line - * @param $result - * @return bool - */ protected function checkForError($line, &$result): bool { $pos = strpos($line, self::EVENT_STATUS_ERROR); if (false !== $pos) { $result['productStatus'][$result['currentObject']]['error'] = substr( $line, - $pos + strlen(self::EVENT_STATUS_ERROR) + $pos + strlen(self::EVENT_STATUS_ERROR), ); return true; @@ -211,10 +198,6 @@ protected function checkForError($line, &$result): bool return false; } - /** - * @param $line - * @param $result - */ protected function processChecks($line, &$result): void { foreach (self::CHECKS as $check) { diff --git a/src/DataDefinitionsBundle/ProcessManager/ProcessManagerExportListener.php b/src/DataDefinitionsBundle/ProcessManager/ProcessManagerExportListener.php index d7196259..48b8bb01 100644 --- a/src/DataDefinitionsBundle/ProcessManager/ProcessManagerExportListener.php +++ b/src/DataDefinitionsBundle/ProcessManager/ProcessManagerExportListener.php @@ -1,29 +1,29 @@ getDefinition(); - $this->processLogger->info($this->process, ImportDefinitionsReport::EVENT_FINISHED.$event->getSubject()); + $this->processLogger->info($this->process, ImportDefinitionsReport::EVENT_FINISHED . $event->getSubject()); $provider = $this->providerRegistry->get($definition->getProvider()); @@ -53,7 +53,7 @@ public function onFinishedEvent(DefinitionEventInterface $event): void $artifact = $provider->generateArtifact( $definition->getConfiguration(), $definition, - $event->getParams() + $event->getParams(), ); if (null === $artifact) { diff --git a/src/DataDefinitionsBundle/ProcessManager/ProcessManagerImportListener.php b/src/DataDefinitionsBundle/ProcessManager/ProcessManagerImportListener.php index 06004d83..8ec0438f 100644 --- a/src/DataDefinitionsBundle/ProcessManager/ProcessManagerImportListener.php +++ b/src/DataDefinitionsBundle/ProcessManager/ProcessManagerImportListener.php @@ -1,23 +1,23 @@ 0) { // there is at least one row - we can grab columns from it - $columns = array_keys((array)$data); + $columns = array_keys((array) $data); } foreach ($columns as $col) { @@ -59,12 +58,10 @@ public function getData( array $configuration, ImportDefinitionInterface $definition, array $params, - FilterInterface $filter = null + FilterInterface $filter = null, ): ImportDataSetInterface { $db = $this->getDb($configuration); return new ArrayImportDataSet($db->fetchAllAssociative($configuration['query'])); } } - - diff --git a/src/DataDefinitionsBundle/Provider/ArrayImportDataSet.php b/src/DataDefinitionsBundle/Provider/ArrayImportDataSet.php index 58084b09..2bc8545c 100644 --- a/src/DataDefinitionsBundle/Provider/ArrayImportDataSet.php +++ b/src/DataDefinitionsBundle/Provider/ArrayImportDataSet.php @@ -1,19 +1,18 @@ data = $data; $this->iterator = new \ArrayIterator($data); } /** * Return the current element - * @link https://php.net/manual/en/iterator.current.php + * + * @see https://php.net/manual/en/iterator.current.php + * * @return mixed Can return any type. + * * @since 5.0.0 */ public function current(): mixed { - return ($this->iterator->current()); + return $this->iterator->current(); } /** * Move forward to next element - * @link https://php.net/manual/en/iterator.next.php - * @return void Any returned value is ignored. + * + * @see https://php.net/manual/en/iterator.next.php * @since 5.0.0 */ public function next(): void @@ -53,8 +57,11 @@ public function next(): void /** * Return the key of the current element - * @link https://php.net/manual/en/iterator.key.php + * + * @see https://php.net/manual/en/iterator.key.php + * * @return mixed scalar on success, or null on failure. + * * @since 5.0.0 */ public function key(): mixed @@ -64,9 +71,12 @@ public function key(): mixed /** * Checks if current position is valid - * @link https://php.net/manual/en/iterator.valid.php - * @return boolean The return value will be casted to boolean and then evaluated. + * + * @see https://php.net/manual/en/iterator.valid.php + * + * @return bool The return value will be casted to boolean and then evaluated. * Returns true on success or false on failure. + * * @since 5.0.0 */ public function valid(): bool @@ -76,8 +86,8 @@ public function valid(): bool /** * Rewind the Iterator to the first element - * @link https://php.net/manual/en/iterator.rewind.php - * @return void Any returned value is ignored. + * + * @see https://php.net/manual/en/iterator.rewind.php * @since 5.0.0 */ public function rewind(): void @@ -87,11 +97,14 @@ public function rewind(): void /** * Count elements of an object - * @link https://php.net/manual/en/countable.count.php + * + * @see https://php.net/manual/en/countable.count.php + * * @return int The custom count as an integer. *

*

* The return value is cast to an integer. + * * @since 5.1.0 */ public function count(): int diff --git a/src/DataDefinitionsBundle/Provider/CsvProvider.php b/src/DataDefinitionsBundle/Provider/CsvProvider.php index 2d6a3642..e08d0327 100644 --- a/src/DataDefinitionsBundle/Provider/CsvProvider.php +++ b/src/DataDefinitionsBundle/Provider/CsvProvider.php @@ -1,32 +1,31 @@ offset((int)$offset); + $stmt = $stmt->offset((int) $offset); } if ($limit) { - $stmt = $stmt->limit((int)$limit); + $stmt = $stmt->limit((int) $limit); } $records = $stmt->process($csv); @@ -151,7 +150,7 @@ public function addExportData( array $data, array $configuration, ExportDefinitionInterface $definition, - array $params + array $params, ): void { $this->exportData[] = $data; } diff --git a/src/DataDefinitionsBundle/Provider/ExcelProvider.php b/src/DataDefinitionsBundle/Provider/ExcelProvider.php index f5671226..85d2c3c6 100644 --- a/src/DataDefinitionsBundle/Provider/ExcelProvider.php +++ b/src/DataDefinitionsBundle/Provider/ExcelProvider.php @@ -1,21 +1,26 @@ buildColumns(str_getcsv((string)$configuration['excelHeaders'])); + return $this->buildColumns(str_getcsv((string) $configuration['excelHeaders'])); } return []; @@ -72,7 +71,7 @@ public function getData( array $configuration, ImportDefinitionInterface $definition, array $params, - FilterInterface $filter = null + FilterInterface $filter = null, ): ImportDataSetInterface { $file = $this->getFile($params); @@ -97,7 +96,7 @@ public function getData( $rowCount = count($rowArray); if ($rowCount < $headersCount) { // append missing values - $rowArray = array_pad($rowArray, (int)$headersCount, null); + $rowArray = array_pad($rowArray, (int) $headersCount, null); } elseif ($rowCount >= $headersCount) { // remove overflow $rowArray = array_slice($rowArray, 0, $headersCount); @@ -111,7 +110,7 @@ public function addExportData( array $data, array $configuration, ExportDefinitionInterface $definition, - array $params + array $params, ): void { $headers = null; if (!isset($this->writer)) { @@ -122,7 +121,7 @@ public function addExportData( foreach ($data as $key => $item) { if (is_object($item)) { - $data[$key] = (string)$item; + $data[$key] = (string) $item; } } $writer->addRow(Row::fromValues(array_values($data))); diff --git a/src/DataDefinitionsBundle/Provider/ExportProviderInterface.php b/src/DataDefinitionsBundle/Provider/ExportProviderInterface.php index 21fc5fc1..822d337c 100644 --- a/src/DataDefinitionsBundle/Provider/ExportProviderInterface.php +++ b/src/DataDefinitionsBundle/Provider/ExportProviderInterface.php @@ -1,19 +1,18 @@ iterator = $iterator; $this->countAll = false; $this->processor = $processor ?? static function ($current) { - return $current; - }; + return $current; + }; } /** * Return the current element - * @link https://php.net/manual/en/iterator.current.php + * + * @see https://php.net/manual/en/iterator.current.php + * * @return mixed Can return any type. + * * @since 5.0.0 */ public function current(): mixed @@ -52,8 +53,8 @@ public function current(): mixed /** * Move forward to next element - * @link https://php.net/manual/en/iterator.next.php - * @return void Any returned value is ignored. + * + * @see https://php.net/manual/en/iterator.next.php * @since 5.0.0 */ public function next(): void @@ -63,8 +64,11 @@ public function next(): void /** * Return the key of the current element - * @link https://php.net/manual/en/iterator.key.php + * + * @see https://php.net/manual/en/iterator.key.php + * * @return mixed scalar on success, or null on failure. + * * @since 5.0.0 */ public function key(): mixed @@ -74,9 +78,12 @@ public function key(): mixed /** * Checks if current position is valid - * @link https://php.net/manual/en/iterator.valid.php - * @return boolean The return value will be casted to boolean and then evaluated. + * + * @see https://php.net/manual/en/iterator.valid.php + * + * @return bool The return value will be casted to boolean and then evaluated. * Returns true on success or false on failure. + * * @since 5.0.0 */ public function valid(): bool @@ -86,8 +93,8 @@ public function valid(): bool /** * Rewind the Iterator to the first element - * @link https://php.net/manual/en/iterator.rewind.php - * @return void Any returned value is ignored. + * + * @see https://php.net/manual/en/iterator.rewind.php * @since 5.0.0 */ public function rewind(): void @@ -97,11 +104,14 @@ public function rewind(): void /** * Count elements of an object - * @link https://php.net/manual/en/countable.count.php + * + * @see https://php.net/manual/en/countable.count.php + * * @return int The custom count as an integer. *

*

* The return value is cast to an integer. + * * @since 5.1.0 */ public function count(): int diff --git a/src/DataDefinitionsBundle/Provider/ImportDataSetInterface.php b/src/DataDefinitionsBundle/Provider/ImportDataSetInterface.php index 0055479b..8ebe9e65 100644 --- a/src/DataDefinitionsBundle/Provider/ImportDataSetInterface.php +++ b/src/DataDefinitionsBundle/Provider/ImportDataSetInterface.php @@ -1,19 +1,18 @@ getFile($params); @@ -113,7 +111,7 @@ public function addExportData( array $data, array $configuration, ExportDefinitionInterface $definition, - array $params + array $params, ): void { $this->exportData[] = $data; } diff --git a/src/DataDefinitionsBundle/Provider/RawProvider.php b/src/DataDefinitionsBundle/Provider/RawProvider.php index ddda3c39..0cf8548d 100644 --- a/src/DataDefinitionsBundle/Provider/RawProvider.php +++ b/src/DataDefinitionsBundle/Provider/RawProvider.php @@ -1,25 +1,24 @@ connection = $connection; } diff --git a/src/DataDefinitionsBundle/Provider/TraversableImportDataSet.php b/src/DataDefinitionsBundle/Provider/TraversableImportDataSet.php index 8f47d812..60e82940 100644 --- a/src/DataDefinitionsBundle/Provider/TraversableImportDataSet.php +++ b/src/DataDefinitionsBundle/Provider/TraversableImportDataSet.php @@ -1,47 +1,51 @@ count = iterator_count($iterator); $this->iterator = new \IteratorIterator($iterator); } /** * Return the current element - * @link https://php.net/manual/en/iterator.current.php + * + * @see https://php.net/manual/en/iterator.current.php + * * @return mixed Can return any type. + * * @since 5.0.0 */ public function current(): mixed { - return ($this->iterator->current()); + return $this->iterator->current(); } /** * Move forward to next element - * @link https://php.net/manual/en/iterator.next.php - * @return void Any returned value is ignored. + * + * @see https://php.net/manual/en/iterator.next.php * @since 5.0.0 */ public function next(): void @@ -51,8 +55,11 @@ public function next(): void /** * Return the key of the current element - * @link https://php.net/manual/en/iterator.key.php + * + * @see https://php.net/manual/en/iterator.key.php + * * @return mixed scalar on success, or null on failure. + * * @since 5.0.0 */ public function key(): mixed @@ -62,9 +69,12 @@ public function key(): mixed /** * Checks if current position is valid - * @link https://php.net/manual/en/iterator.valid.php - * @return boolean The return value will be casted to boolean and then evaluated. + * + * @see https://php.net/manual/en/iterator.valid.php + * + * @return bool The return value will be casted to boolean and then evaluated. * Returns true on success or false on failure. + * * @since 5.0.0 */ public function valid(): bool @@ -74,8 +84,8 @@ public function valid(): bool /** * Rewind the Iterator to the first element - * @link https://php.net/manual/en/iterator.rewind.php - * @return void Any returned value is ignored. + * + * @see https://php.net/manual/en/iterator.rewind.php * @since 5.0.0 */ public function rewind(): void @@ -85,7 +95,6 @@ public function rewind(): void /** * Return the number of elements in the Iterator - * @return int */ public function count(): int { diff --git a/src/DataDefinitionsBundle/Provider/XmlProvider.php b/src/DataDefinitionsBundle/Provider/XmlProvider.php index 060e02e4..3a46b5a2 100755 --- a/src/DataDefinitionsBundle/Provider/XmlProvider.php +++ b/src/DataDefinitionsBundle/Provider/XmlProvider.php @@ -1,46 +1,47 @@ xpath($xpath); $json = json_encode($xml); @@ -49,7 +50,7 @@ protected function convertXmlToArray($xml, $xpath) foreach ($array as &$arrayEntry) { if (array_key_exists('@attributes', $arrayEntry)) { foreach ($arrayEntry['@attributes'] as $key => $value) { - $arrayEntry['attr_'.$key] = $value; + $arrayEntry['attr_' . $key] = $value; } } } @@ -89,7 +90,7 @@ public function getData( array $configuration, ImportDefinitionInterface $definition, array $params, - FilterInterface $filter = null + FilterInterface $filter = null, ): ImportDataSetInterface { $file = $this->getFile($params); $xml = file_get_contents($file); @@ -101,7 +102,7 @@ public function addExportData( array $data, array $configuration, ExportDefinitionInterface $definition, - array $params + array $params, ): void { $writer = $this->getXMLWriter(); @@ -109,7 +110,7 @@ public function addExportData( $this->serializeCollection($writer, $data); $writer->endElement(); - $this->exportCounter++; + ++$this->exportCounter; if ($this->exportCounter >= 50) { $this->flush($writer); $this->exportCounter = 0; @@ -135,7 +136,7 @@ public function exportData(array $configuration, ExportDefinitionInterface $defi throw new RuntimeException(sprintf('Passed XSLT file "%1$s" not found', $path)); } - $extension = pathinfo($configuration['xsltPath'], PATHINFO_EXTENSION); + $extension = pathinfo($configuration['xsltPath'], \PATHINFO_EXTENSION); $workingPath = File::getLocalTempFilePath($extension); file_put_contents($workingPath, $storage->read($path)); @@ -202,7 +203,7 @@ private function getExportPath(): string private function flush(XMLWriter $writer): void { - file_put_contents($this->getExportPath(), $writer->flush(true), FILE_APPEND); + file_put_contents($this->getExportPath(), $writer->flush(true), \FILE_APPEND); } private function serialize(XMLWriter $writer, ?string $name, $data, ?int $key = null): void @@ -213,13 +214,13 @@ private function serialize(XMLWriter $writer, ?string $name, $data, ?int $key = $writer->writeAttribute('name', $name); } if (null !== $key) { - $writer->writeAttribute('key', (string)$key); + $writer->writeAttribute('key', (string) $key); } if (is_string($data)) { $writer->writeCdata($data); } else { // TODO: should be more elaborate/exact for "non-string" scalar values - $writer->text((string)$data); + $writer->text((string) $data); } $writer->endElement(); } else { @@ -229,20 +230,20 @@ private function serialize(XMLWriter $writer, ?string $name, $data, ?int $key = $writer->writeAttribute('name', $name); } if (null !== $key) { - $writer->writeAttribute('key', (string)$key); + $writer->writeAttribute('key', (string) $key); } $this->serializeCollection($writer, $data); $writer->endElement(); } else { - if ((string)$data) { + if ((string) $data) { $writer->startElement('property'); if (null !== $name) { $writer->writeAttribute('name', $name); } if (null !== $key) { - $writer->writeAttribute('key', (string)$key); + $writer->writeAttribute('key', (string) $key); } - $writer->writeCdata((string)$data); + $writer->writeCdata((string) $data); $writer->endElement(); } } diff --git a/src/DataDefinitionsBundle/Repository/DefinitionRepository.php b/src/DataDefinitionsBundle/Repository/DefinitionRepository.php index 431f851c..4145f799 100644 --- a/src/DataDefinitionsBundle/Repository/DefinitionRepository.php +++ b/src/DataDefinitionsBundle/Repository/DefinitionRepository.php @@ -1,19 +1,18 @@ expressionLanguage = $expressionLanguage; $this->container = $container; } @@ -37,13 +39,13 @@ public function apply( Concrete $concrete, $value, array $configuration, - array $params = [] + array $params = [], ) { $expression = $configuration['expression']; return $this->expressionLanguage->evaluate( $expression, - array_merge($params, ['container' => $this->container]) + array_merge($params, ['container' => $this->container]), ); } } diff --git a/src/DataDefinitionsBundle/Rules/Action/ImportRuleProcessorInterface.php b/src/DataDefinitionsBundle/Rules/Action/ImportRuleProcessorInterface.php index 842b9b2f..3e1cdc5c 100644 --- a/src/DataDefinitionsBundle/Rules/Action/ImportRuleProcessorInterface.php +++ b/src/DataDefinitionsBundle/Rules/Action/ImportRuleProcessorInterface.php @@ -1,23 +1,22 @@ expressionLanguage = $expressionLanguage; $this->container = $container; } @@ -36,13 +38,13 @@ public function isImportRuleValid( ImportRuleInterface $subject, Concrete $concrete, array $params, - array $configuration + array $configuration, ): bool { $expression = $configuration['expression']; return $this->expressionLanguage->evaluate( $expression, - array_merge($params, ['container' => $this->container]) + array_merge($params, ['container' => $this->container]), ); } } diff --git a/src/DataDefinitionsBundle/Rules/Condition/ImportRuleConditionCheckerInterface.php b/src/DataDefinitionsBundle/Rules/Condition/ImportRuleConditionCheckerInterface.php index b97929f3..183fda2d 100644 --- a/src/DataDefinitionsBundle/Rules/Condition/ImportRuleConditionCheckerInterface.php +++ b/src/DataDefinitionsBundle/Rules/Condition/ImportRuleConditionCheckerInterface.php @@ -1,24 +1,23 @@ add('expression', TextType::class); + ->add('expression', TextType::class) + ; } } diff --git a/src/DataDefinitionsBundle/Rules/Form/Type/Action/ObjectType.php b/src/DataDefinitionsBundle/Rules/Form/Type/Action/ObjectType.php index 6954f963..96e6a77c 100644 --- a/src/DataDefinitionsBundle/Rules/Form/Type/Action/ObjectType.php +++ b/src/DataDefinitionsBundle/Rules/Form/Type/Action/ObjectType.php @@ -1,19 +1,18 @@ add('object', TextType::class); + ->add('object', TextType::class) + ; } } diff --git a/src/DataDefinitionsBundle/Rules/Form/Type/Condition/ExpressionConditionType.php b/src/DataDefinitionsBundle/Rules/Form/Type/Condition/ExpressionConditionType.php index d0cbae85..6a5f161c 100644 --- a/src/DataDefinitionsBundle/Rules/Form/Type/Condition/ExpressionConditionType.php +++ b/src/DataDefinitionsBundle/Rules/Form/Type/Condition/ExpressionConditionType.php @@ -1,19 +1,18 @@ add('expression', TextType::class); + ->add('expression', TextType::class) + ; } } diff --git a/src/DataDefinitionsBundle/Rules/Form/Type/ImportRuleActionChoiceType.php b/src/DataDefinitionsBundle/Rules/Form/Type/ImportRuleActionChoiceType.php index 402aa660..82e69d9d 100755 --- a/src/DataDefinitionsBundle/Rules/Form/Type/ImportRuleActionChoiceType.php +++ b/src/DataDefinitionsBundle/Rules/Form/Type/ImportRuleActionChoiceType.php @@ -1,24 +1,22 @@ [ 'data-form-collection' => 'update', ], - ]); + ]) + ; } } diff --git a/src/DataDefinitionsBundle/Rules/Form/Type/ImportRuleConditionChoiceType.php b/src/DataDefinitionsBundle/Rules/Form/Type/ImportRuleConditionChoiceType.php index 36681d03..95a6f7a5 100755 --- a/src/DataDefinitionsBundle/Rules/Form/Type/ImportRuleConditionChoiceType.php +++ b/src/DataDefinitionsBundle/Rules/Form/Type/ImportRuleConditionChoiceType.php @@ -1,24 +1,22 @@ [ 'data-form-collection' => 'update', ], - ]); + ]) + ; } } diff --git a/src/DataDefinitionsBundle/Rules/Form/Type/ImportRuleType.php b/src/DataDefinitionsBundle/Rules/Form/Type/ImportRuleType.php index 6e58bb58..9d64bb6d 100644 --- a/src/DataDefinitionsBundle/Rules/Form/Type/ImportRuleType.php +++ b/src/DataDefinitionsBundle/Rules/Form/Type/ImportRuleType.php @@ -1,19 +1,18 @@ add('name', TextType::class) ->add('active', CheckboxType::class) ->add('conditions', ImportRuleConditionCollectionType::class) - ->add('actions', ImportRuleActionCollectionType::class); + ->add('actions', ImportRuleActionCollectionType::class) + ; } public function configureOptions(OptionsResolver $resolver): void diff --git a/src/DataDefinitionsBundle/Rules/Form/Type/ImportRulesInterpreterType.php b/src/DataDefinitionsBundle/Rules/Form/Type/ImportRulesInterpreterType.php index 084807f8..d4d6fdd5 100644 --- a/src/DataDefinitionsBundle/Rules/Form/Type/ImportRulesInterpreterType.php +++ b/src/DataDefinitionsBundle/Rules/Form/Type/ImportRulesInterpreterType.php @@ -1,19 +1,18 @@ ImportRuleType::class, 'allow_add' => true, 'allow_delete' => true, - ]); + ]) + ; } } diff --git a/src/DataDefinitionsBundle/Rules/Model/ImportRule.php b/src/DataDefinitionsBundle/Rules/Model/ImportRule.php index e6647016..f6b1f8be 100644 --- a/src/DataDefinitionsBundle/Rules/Model/ImportRule.php +++ b/src/DataDefinitionsBundle/Rules/Model/ImportRule.php @@ -1,19 +1,18 @@ ruleConditionsValidationProcessor = $ruleConditionsValidationProcessor; } @@ -36,7 +36,7 @@ public function isImportRuleValid( DataDefinitionInterface $definition, Concrete $object, ImportRuleInterface $importRule, - array $params + array $params, ): bool { $params['object'] = $object; @@ -49,7 +49,7 @@ public function isValid(ResourceInterface $subject, RuleInterface $rule, $params $subject, $rule, $rule->getConditions(), - $params + $params, ); } } diff --git a/src/DataDefinitionsBundle/Rules/Processor/ImportRuleValidationProcessorInterface.php b/src/DataDefinitionsBundle/Rules/Processor/ImportRuleValidationProcessorInterface.php index da989245..1ef9e633 100644 --- a/src/DataDefinitionsBundle/Rules/Processor/ImportRuleValidationProcessorInterface.php +++ b/src/DataDefinitionsBundle/Rules/Processor/ImportRuleValidationProcessorInterface.php @@ -1,25 +1,24 @@ actionServiceRegistry = $actionServiceRegistry; } diff --git a/src/DataDefinitionsBundle/Rules/Processor/RuleApplierInterface.php b/src/DataDefinitionsBundle/Rules/Processor/RuleApplierInterface.php index 47a97d82..0b545d02 100644 --- a/src/DataDefinitionsBundle/Rules/Processor/RuleApplierInterface.php +++ b/src/DataDefinitionsBundle/Rules/Processor/RuleApplierInterface.php @@ -1,23 +1,22 @@ getFieldConfiguration($localizedField); - $localizedField->setGroup('localizedfield.'.strtolower($language)); - $localizedField->setType('localizedfield.'.$language); + $localizedField->setGroup('localizedfield.' . strtolower($language)); + $localizedField->setType('localizedfield.' . $language); $localizedField->setIdentifier(sprintf('%s~%s', $localizedField->getIdentifier(), $language)); $localizedField->setSetter('localizedfield'); $localizedField->setConfig(['language' => $language]); @@ -85,15 +84,15 @@ public function getClassDefinition(DataObject\ClassDefinition $class): array foreach ($fields as $brickField) { $resultField = $this->getFieldConfiguration($brickField); - $resultField->setGroup('objectbrick.'.$key); + $resultField->setGroup('objectbrick.' . $key); $resultField->setType('objectbrick'); $resultField->setIdentifier( sprintf( 'objectbrick~%s~%s~%s', $field->getName(), $key, - $resultField->getIdentifier() - ) + $resultField->getIdentifier(), + ), ); $resultField->setSetter('objectbrick'); $resultField->setConfig(['class' => $key]); @@ -116,15 +115,15 @@ public function getClassDefinition(DataObject\ClassDefinition $class): array foreach ($fieldDefinition as $fieldcollectionField) { $resultField = $this->getFieldConfiguration($fieldcollectionField); - $resultField->setGroup('fieldcollection.'.$type); + $resultField->setGroup('fieldcollection.' . $type); $resultField->setType('fieldcollection'); $resultField->setIdentifier( sprintf( 'fieldcollection~%s~%s~%s', $field->getName(), $type, - $resultField->getIdentifier() - ) + $resultField->getIdentifier(), + ), ); $resultField->setSetter('fieldcollection'); $resultField->setConfig(['class' => $type]); @@ -139,8 +138,8 @@ public function getClassDefinition(DataObject\ClassDefinition $class): array if ($allowedGroupIds) { $list->setCondition( - 'ID in ('.implode(',', $allowedGroupIds).') AND storeId = ?', - [$field->getStoreId()] + 'ID in (' . implode(',', $allowedGroupIds) . ') AND storeId = ?', + [$field->getStoreId()], ); } else { $list->setCondition('storeId = ?', [$field->getStoreId()]); @@ -162,15 +161,15 @@ public function getClassDefinition(DataObject\ClassDefinition $class): array $toColumn = new ToColumn(); $toColumn->setGroup( - sprintf('classificationstore - %s (%s)', $config->getName(), $config->getId()) + sprintf('classificationstore - %s (%s)', $config->getName(), $config->getId()), ); $toColumn->setIdentifier( sprintf( 'classificationstore~%s~%s~%s', $field->getName(), $keyConfig->getId(), - $config->getId() - ) + $config->getId(), + ), ); $toColumn->setType('classificationstore'); $toColumn->setFieldtype($keyConfig->getType()); diff --git a/src/DataDefinitionsBundle/Service/StorageLocator.php b/src/DataDefinitionsBundle/Service/StorageLocator.php index b60d3599..9b998873 100644 --- a/src/DataDefinitionsBundle/Service/StorageLocator.php +++ b/src/DataDefinitionsBundle/Service/StorageLocator.php @@ -1,19 +1,18 @@ locator = $locator; } diff --git a/src/DataDefinitionsBundle/Setter/ClassificationStoreFieldGetter.php b/src/DataDefinitionsBundle/Setter/ClassificationStoreFieldGetter.php index 978fc67a..93547c1b 100644 --- a/src/DataDefinitionsBundle/Setter/ClassificationStoreFieldGetter.php +++ b/src/DataDefinitionsBundle/Setter/ClassificationStoreFieldGetter.php @@ -1,26 +1,25 @@ getLocalizedKeyValue( $groupId, $keyConfig->getId(), - $language + $language, ); - if (is_null($value)) { + if (null === $value) { continue; } diff --git a/src/DataDefinitionsBundle/Setter/ClassificationStoreSetter.php b/src/DataDefinitionsBundle/Setter/ClassificationStoreSetter.php index 252c01d1..d6f4e90d 100644 --- a/src/DataDefinitionsBundle/Setter/ClassificationStoreSetter.php +++ b/src/DataDefinitionsBundle/Setter/ClassificationStoreSetter.php @@ -1,25 +1,24 @@ getMapping()->getSetterConfig(); $fieldName = $mapConfig['field']; - $keyConfig = (int)$mapConfig['keyConfig']; - $groupConfig = (int)$mapConfig['groupConfig']; + $keyConfig = (int) $mapConfig['keyConfig']; + $groupConfig = (int) $mapConfig['groupConfig']; $classificationStoreGetter = sprintf('get%s', ucfirst($fieldName)); @@ -52,8 +51,8 @@ public function get(GetterContextInterface $context) { $mapConfig = $context->getMapping()->getGetterConfig(); $fieldName = $mapConfig['field']; - $keyConfig = (int)$mapConfig['keyConfig']; - $groupConfig = (int)$mapConfig['groupConfig']; + $keyConfig = (int) $mapConfig['keyConfig']; + $groupConfig = (int) $mapConfig['groupConfig']; $classificationStoreGetter = sprintf('get%s', ucfirst($fieldName)); diff --git a/src/DataDefinitionsBundle/Setter/CoreShop/StorePriceSetter.php b/src/DataDefinitionsBundle/Setter/CoreShop/StorePriceSetter.php index c21f79a4..f91602dc 100644 --- a/src/DataDefinitionsBundle/Setter/CoreShop/StorePriceSetter.php +++ b/src/DataDefinitionsBundle/Setter/CoreShop/StorePriceSetter.php @@ -1,36 +1,36 @@ storeRepository = $storeRepository; } diff --git a/src/DataDefinitionsBundle/Setter/CoreShop/StoreValuesSetter.php b/src/DataDefinitionsBundle/Setter/CoreShop/StoreValuesSetter.php index 27d0e3f0..c81583a4 100644 --- a/src/DataDefinitionsBundle/Setter/CoreShop/StoreValuesSetter.php +++ b/src/DataDefinitionsBundle/Setter/CoreShop/StoreValuesSetter.php @@ -1,36 +1,36 @@ storeRepository = $storeRepository; } diff --git a/src/DataDefinitionsBundle/Setter/FieldCollectionSetter.php b/src/DataDefinitionsBundle/Setter/FieldCollectionSetter.php index 7ed4bcda..482e50ea 100644 --- a/src/DataDefinitionsBundle/Setter/FieldCollectionSetter.php +++ b/src/DataDefinitionsBundle/Setter/FieldCollectionSetter.php @@ -1,26 +1,25 @@ isValidKey( - $mappedKeys, - $item, - $context->getDataRow() - )) { + $mappedKeys, + $item, + $context->getDataRow(), + )) { if ($item instanceof AbstractFieldCollection) { $item->setValue($field, $context->getValue()); } @@ -99,7 +98,7 @@ public function get(GetterContextInterface $context) $config = $context->getMapping()->getGetterConfig(); $fieldName = $config['field']; $class = $config['class']; - $fieldCollectionClass = 'Pimcore\Model\DataObject\Fieldcollection\Data\\'.ucfirst($class); + $fieldCollectionClass = 'Pimcore\Model\DataObject\Fieldcollection\Data\\' . ucfirst($class); $field = $keyParts[3]; $getter = sprintf('get%s', ucfirst($fieldName)); diff --git a/src/DataDefinitionsBundle/Setter/KeySetter.php b/src/DataDefinitionsBundle/Setter/KeySetter.php index 41d08cf0..1a18bc84 100644 --- a/src/DataDefinitionsBundle/Setter/KeySetter.php +++ b/src/DataDefinitionsBundle/Setter/KeySetter.php @@ -1,23 +1,22 @@ getObject(), $setter)) { - $context->getObject()->$setter(DataObject\Service::getValidKey($context->getValue(), "object")); + $context->getObject()->$setter(DataObject\Service::getValidKey($context->getValue(), 'object')); } } } diff --git a/src/DataDefinitionsBundle/Setter/LocalizedfieldSetter.php b/src/DataDefinitionsBundle/Setter/LocalizedfieldSetter.php index f91e4494..08511392 100644 --- a/src/DataDefinitionsBundle/Setter/LocalizedfieldSetter.php +++ b/src/DataDefinitionsBundle/Setter/LocalizedfieldSetter.php @@ -1,19 +1,18 @@ getObject()->setType(Concrete::OBJECT_TYPE_OBJECT); } } - - diff --git a/src/DataDefinitionsBundle/Setter/ObjectbrickSetter.php b/src/DataDefinitionsBundle/Setter/ObjectbrickSetter.php index 56850858..1808f8ef 100644 --- a/src/DataDefinitionsBundle/Setter/ObjectbrickSetter.php +++ b/src/DataDefinitionsBundle/Setter/ObjectbrickSetter.php @@ -1,26 +1,25 @@ $brickClassGetter(); if (!$brickFieldObject instanceof AbstractData) { - $brickFieldObjectClass = 'Pimcore\Model\DataObject\Objectbrick\Data\\'.$class; + $brickFieldObjectClass = 'Pimcore\Model\DataObject\Objectbrick\Data\\' . $class; $brickFieldObject = new $brickFieldObjectClass($context->getObject()); @@ -91,7 +90,7 @@ public function get(GetterContextInterface $context) $brickFieldObject = $brick->$brickClassGetter(); if (!$brickFieldObject instanceof AbstractData) { - $brickFieldObjectClass = 'Pimcore\Model\DataObject\Objectbrick\Data\\'.$class; + $brickFieldObjectClass = 'Pimcore\Model\DataObject\Objectbrick\Data\\' . $class; $brickFieldObject = new $brickFieldObjectClass($context->getObject()); diff --git a/src/DataDefinitionsBundle/Setter/RelationSetter.php b/src/DataDefinitionsBundle/Setter/RelationSetter.php index 98050a31..f3bad449 100644 --- a/src/DataDefinitionsBundle/Setter/RelationSetter.php +++ b/src/DataDefinitionsBundle/Setter/RelationSetter.php @@ -1,19 +1,18 @@ getValue(); @@ -45,7 +44,7 @@ public function set(SetterContextInterface $context): void // Add all values that does not already exist. foreach ($value as $newElement) { - $newKey = (string)$newElement; + $newKey = (string) $newElement; if (!in_array($newKey, $existingKeys)) { $existingElements[] = $newElement; } diff --git a/src/DataDefinitionsBundle/Setter/SetterInterface.php b/src/DataDefinitionsBundle/Setter/SetterInterface.php index cf88b195..bce5d14a 100644 --- a/src/DataDefinitionsBundle/Setter/SetterInterface.php +++ b/src/DataDefinitionsBundle/Setter/SetterInterface.php @@ -1,19 +1,18 @@