diff --git a/.github/workflows/php-cs-fixer.yaml b/.github/workflows/php-cs-fixer.yaml new file mode 100644 index 00000000..6d19d4f9 --- /dev/null +++ b/.github/workflows/php-cs-fixer.yaml @@ -0,0 +1,35 @@ +name: "PHP-CS-Fixer" + +on: + pull_request_target: + branches: + - "[0-9]+.[0-9]+" + - "[0-9]+.x" + - "feature-*" + push: + branches: + - "[0-9]+.[0-9]+" + - "[0-9]+.x" + - "*_actions" + - "feature-*" + +permissions: + contents: read + +jobs: + php-cs-fixer: + permissions: + contents: write # for stefanzweifel/git-auto-commit-action to push code in repo + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + + - name: PHP-CS-Fixer + uses: docker://oskarstark/php-cs-fixer-ga:latest + + - uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: Apply php-cs-fixer changes diff --git a/.github/workflows/php-style.yml b/.github/workflows/php-style.yml deleted file mode 100644 index 81fdbc88..00000000 --- a/.github/workflows/php-style.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: PHP Style - -on: [push] - -jobs: - php-cs-fixer: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - ref: ${{ github.head_ref }} - - - name: PHP-CS-Fixer - uses: docker://oskarstark/php-cs-fixer-ga:2.19.0 - with: - args: --config=.php_cs.dist --allow-risky yes - - - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: Apply php-cs-fixer changes diff --git a/.gitignore b/.gitignore index 7cca2135..5fa85148 100644 --- a/.gitignore +++ b/.gitignore @@ -12,7 +12,7 @@ Thumbs.db # PHP-CS-Fixer /.php_cs -/.php_cs.cache +/.php-cs-fixer.cache # composer /composer.lock diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php new file mode 100644 index 00000000..d0e1b8d2 --- /dev/null +++ b/.php-cs-fixer.dist.php @@ -0,0 +1,79 @@ +in([ + __DIR__ . '/src', + __DIR__ . '/tests', + ]) + + ->exclude([ + __DIR__ . '/tests/_output', + __DIR__ . '/tests/_support/_generated', + ]) +; + +// do not enable self_accessor as it breaks pimcore models relying on get_called_class() +$config = new PhpCsFixer\Config(); +$config->setRules([ + '@PSR1' => true, + '@PSR2' => true, + 'array_syntax' => ['syntax' => 'short'], + 'list_syntax' => ['syntax' => 'short'], + + 'header_comment' => [ + 'comment_type' => 'PHPDoc', + 'header' => 'Pimcore' . PHP_EOL . PHP_EOL . + 'This source file is available under two different licenses:' . PHP_EOL . + '- GNU General Public License version 3 (GPLv3)' . PHP_EOL . + '- Pimcore Commercial License (PCL)' . PHP_EOL . + 'Full copyright and license information is available in' . PHP_EOL . + 'LICENSE.md which is distributed with this source code.' . PHP_EOL . + PHP_EOL . + ' @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)' . PHP_EOL . + ' @license http://www.pimcore.org/license GPLv3 and PCL' + ], + + 'blank_line_before_statement' => true, + 'encoding' => true, + 'function_typehint_space' => true, + 'single_line_comment_style' => true, + 'lowercase_cast' => true, + 'magic_constant_casing' => true, + 'method_argument_space' => ['on_multiline' => 'ignore'], + 'class_attributes_separation' => true, + 'native_function_casing' => true, + 'no_blank_lines_after_class_opening' => true, + 'no_blank_lines_after_phpdoc' => true, + 'no_empty_comment' => true, + 'no_empty_phpdoc' => true, + 'no_empty_statement' => true, + 'no_extra_blank_lines' => true, + 'no_leading_import_slash' => true, + 'no_leading_namespace_whitespace' => true, + 'no_short_bool_cast' => true, + 'no_spaces_around_offset' => true, + 'no_superfluous_phpdoc_tags' => ['allow_mixed' => true, 'remove_inheritdoc' => true], + 'no_unneeded_control_parentheses' => true, + 'no_unused_imports' => true, + 'no_whitespace_before_comma_in_array' => true, + 'no_whitespace_in_blank_line' => true, + 'object_operator_without_whitespace' => true, + 'ordered_imports' => true, + 'phpdoc_indent' => true, + 'phpdoc_no_useless_inheritdoc' => true, + 'phpdoc_scalar' => true, + 'phpdoc_separation' => true, + 'phpdoc_single_line_var_spacing' => true, + 'return_type_declaration' => true, + 'short_scalar_cast' => true, + 'single_blank_line_before_namespace' => true, + 'single_quote' => true, + 'space_after_semicolon' => true, + 'standardize_not_equals' => true, + 'ternary_operator_spaces' => true, + 'trailing_comma_in_multiline' => true, + 'whitespace_after_comma_in_array' => true, +]); + +$config->setFinder($finder); +return $config; diff --git a/.php_cs.dist b/.php_cs.dist deleted file mode 100644 index fd1e5dda..00000000 --- a/.php_cs.dist +++ /dev/null @@ -1,71 +0,0 @@ -in([__DIR__ . '/src']) - - // do not fix views - ->notName('*.html.php'); - -return PhpCsFixer\Config::create() - ->setRules([ - '@PSR1' => true, - '@PSR2' => true, - 'array_syntax' => ['syntax' => 'short'], - - 'header_comment' => [ - 'commentType' => 'PHPDoc', - 'header' => 'Pimcore' . PHP_EOL . PHP_EOL . - 'This source file is available under two different licenses:' . PHP_EOL . - '- GNU General Public License version 3 (GPLv3)' . PHP_EOL . - '- Pimcore Commercial License (PCL)' . PHP_EOL . - 'Full copyright and license information is available in' . PHP_EOL . - 'LICENSE.md which is distributed with this source code.' . PHP_EOL . - PHP_EOL . - ' @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)' . PHP_EOL . - ' @license http://www.pimcore.org/license GPLv3 and PCL' - ], - - // keep aligned = and => operators as they are: do not force aligning, but do not remove it - 'binary_operator_spaces' => ['align_double_arrow' => null, 'align_equals' => null], - - 'blank_line_before_return' => true, - 'encoding' => true, - 'function_typehint_space' => true, - 'hash_to_slash_comment' => true, - 'lowercase_cast' => true, - 'magic_constant_casing' => true, - 'method_argument_space' => ['ensure_fully_multiline' => false], - 'method_separation' => true, - 'native_function_casing' => true, - 'no_blank_lines_after_class_opening' => true, - 'no_blank_lines_after_phpdoc' => true, - 'no_empty_comment' => true, - 'no_empty_phpdoc' => true, - 'no_empty_statement' => true, - 'no_extra_consecutive_blank_lines' => true, - 'no_leading_import_slash' => true, - 'no_leading_namespace_whitespace' => true, - 'no_short_bool_cast' => true, - 'no_spaces_around_offset' => true, - 'no_unneeded_control_parentheses' => true, - 'no_unused_imports' => true, - 'no_whitespace_before_comma_in_array' => true, - 'no_whitespace_in_blank_line' => true, - 'object_operator_without_whitespace' => true, - 'ordered_imports' => true, - 'phpdoc_indent' => true, - 'phpdoc_no_useless_inheritdoc' => true, - 'phpdoc_scalar' => true, - 'phpdoc_separation' => true, - 'phpdoc_single_line_var_spacing' => true, - 'return_type_declaration' => true, - 'self_accessor' => true, - 'short_scalar_cast' => true, - 'single_blank_line_before_namespace' => true, - 'single_quote' => true, - 'space_after_semicolon' => true, - 'standardize_not_equals' => true, - 'ternary_operator_spaces' => true, - 'whitespace_after_comma_in_array' => true, - ]) - ->setFinder($finder); diff --git a/README.md b/README.md index 115e3c0b..19009d02 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ For a first impression have a look at our [Demo](https://demo.pimcore.fun/). For The following sections provide shortcuts into the documentation to start working with the Customer Management Framework (CMF) for Pimcore: - See the [Getting Started](#getting-started) section for an overview of the CMF Framework architecture or information about the installation process. - See the [Customer-Related Data](#customer-related-data) section for details about the management of customer-related data with the CMF Framework. -- See the [Platform Topics](#platform-topics) section for documentation about services provided by the CMF Framework. +- See the [Provided Services](#provided-services) section for documentation about services provided by the CMF Framework. ### Getting Started * [Architecture Overview](./doc/01_Architecture-Overview.md) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index a5487955..308a2078 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,25 +1,5 @@ parameters: ignoreErrors: - - - message: "#^Call to an undefined method Knp\\\\Component\\\\Pager\\\\Pagination\\\\PaginationInterface\\:\\:getPaginationData\\(\\)\\.$#" - count: 1 - path: src/ActionTrigger/EventHandler/DefaultEventHandler.php - - - - message: "#^Call to an undefined method Knp\\\\Component\\\\Pager\\\\Pagination\\\\PaginationInterface\\:\\:getPaginationData\\(\\)\\.$#" - count: 1 - path: src/Controller/Admin/ActivitiesController.php - - - - message: "#^Call to an undefined method Knp\\\\Component\\\\Pager\\\\Pagination\\\\PaginationInterface\\:\\:getPaginationData\\(\\)\\.$#" - count: 2 - path: src/Controller/Admin/CustomersController.php - - - - message: "#^Call to an undefined method Knp\\\\Component\\\\Pager\\\\Pagination\\\\PaginationInterface\\:\\:getPaginationData\\(\\)\\.$#" - count: 1 - path: src/Controller/Admin/DuplicatesController.php - - message: "#^Parameter \\#1 \\$segments of class CustomerManagementFrameworkBundle\\\\CustomerList\\\\Filter\\\\CustomerSegment constructor expects array\\, array\\, CustomerManagementFrameworkBundle\\\\Model\\\\CustomerSegmentInterface\\> given\\.$#" reportUnmatched: false @@ -37,11 +17,6 @@ parameters: count: 1 path: src/CustomerView/DefaultCustomerView.php - - - message: "#^Call to an undefined method Knp\\\\Component\\\\Pager\\\\Pagination\\\\PaginationInterface\\:\\:getPaginationData\\(\\)\\.$#" - count: 1 - path: src/DuplicatesIndex/DefaultMariaDbDuplicatesIndex.php - - message: "#^Result of && is always false\\.$#" count: 1 @@ -107,41 +82,11 @@ parameters: count: 1 path: src/Newsletter/ProviderHandler/Mailchimp/CliSyncProcessor.php - - - message: "#^Call to an undefined method Knp\\\\Component\\\\Pager\\\\Pagination\\\\PaginationInterface\\:\\:getPaginationData\\(\\)\\.$#" - count: 2 - path: src/Newsletter/Queue/DefaultNewsletterQueue.php - - - - message: "#^Call to an undefined method Knp\\\\Component\\\\Pager\\\\Pagination\\\\PaginationInterface\\:\\:getPaginationData\\(\\)\\.$#" - count: 1 - path: src/RESTApi/CustomersHandler.php - - - - message: "#^Call to an undefined method Knp\\\\Component\\\\Pager\\\\Pagination\\\\PaginationInterface\\:\\:getPaginationData\\(\\)\\.$#" - count: 1 - path: src/RESTApi/SegmentGroupsHandler.php - - - - message: "#^Call to an undefined method Knp\\\\Component\\\\Pager\\\\Pagination\\\\PaginationInterface\\:\\:getPaginationData\\(\\)\\.$#" - count: 1 - path: src/RESTApi/SegmentsHandler.php - - message: "#^Call to an undefined method CustomerManagementFrameworkBundle\\\\RESTApi\\\\SegmentsOfCustomerHandler\\:\\:createRoute\\(\\)\\.$#" count: 1 path: src/RESTApi/SegmentsOfCustomerHandler.php - - - message: "#^Call to an undefined method Knp\\\\Component\\\\Pager\\\\Pagination\\\\PaginationInterface\\:\\:getPaginationData\\(\\)\\.$#" - count: 1 - path: src/SegmentBuilder/AgeSegmentBuilder.php - - - - message: "#^Call to an undefined method Knp\\\\Component\\\\Pager\\\\Pagination\\\\PaginationInterface\\:\\:getPaginationData\\(\\)\\.$#" - count: 1 - path: src/SegmentManager/SegmentBuilderExecutor/DefaultSegmentBuilderExecutor.php - - message: "#^If condition is always false\\.$#" count: 1 diff --git a/src/ActionTrigger/Action/AddTrackedSegment.php b/src/ActionTrigger/Action/AddTrackedSegment.php index 03f67a59..7df16980 100644 --- a/src/ActionTrigger/Action/AddTrackedSegment.php +++ b/src/ActionTrigger/Action/AddTrackedSegment.php @@ -24,7 +24,9 @@ class AddTrackedSegment extends AbstractAction { const OPTION_REMOVE_OTHER_SEGMENTS_FROM_SEGMENT_GROUP = 'removeOtherSegmentsFromGroup'; + const OPTION_INCREASE_SEGMENT_APPLICATION_COUNTER = 'increaseSegmentApplicationCounter'; + const OPTION_CONSIDER_PROFILING_CONSENT = 'considerProfilingConsent'; protected $name = 'AddTrackedSegment'; diff --git a/src/ActionTrigger/Action/ChangeFieldValue.php b/src/ActionTrigger/Action/ChangeFieldValue.php index 5d87ff82..66074b6f 100644 --- a/src/ActionTrigger/Action/ChangeFieldValue.php +++ b/src/ActionTrigger/Action/ChangeFieldValue.php @@ -21,6 +21,7 @@ class ChangeFieldValue extends AbstractAction { const OPTION_FIELD = 'field'; + const OPTION_VALUE = 'value'; public function process( diff --git a/src/ActionTrigger/Action/SendMail.php b/src/ActionTrigger/Action/SendMail.php index e0a69bbb..92f8f409 100644 --- a/src/ActionTrigger/Action/SendMail.php +++ b/src/ActionTrigger/Action/SendMail.php @@ -23,8 +23,11 @@ class SendMail extends AbstractAction { const OPTION_CONSIDER_PROFILING_CONSENT = 'considerProfilingConsent'; + const OPTION_EMAIL_DOCUMENT = 'emailDoc'; + const OPTION_SEND_TO_CUSTOMER = 'toCustomer'; + protected $name = 'SendMail'; public function process( diff --git a/src/ActionTrigger/Condition/ConditionDefinitionInterface.php b/src/ActionTrigger/Condition/ConditionDefinitionInterface.php index ac1b9ad3..31d7f43c 100644 --- a/src/ActionTrigger/Condition/ConditionDefinitionInterface.php +++ b/src/ActionTrigger/Condition/ConditionDefinitionInterface.php @@ -40,7 +40,6 @@ public function getDefinitionData(); public function getOptions(); /** - * @param array $options * * @return void */ diff --git a/src/ActionTrigger/Condition/ConditionInterface.php b/src/ActionTrigger/Condition/ConditionInterface.php index 0fb31950..b2ca2b99 100644 --- a/src/ActionTrigger/Condition/ConditionInterface.php +++ b/src/ActionTrigger/Condition/ConditionInterface.php @@ -24,14 +24,10 @@ interface ConditionInterface /** * ConditionInterface constructor. * - * @param LoggerInterface $logger */ public function __construct(LoggerInterface $logger); /** - * @param ConditionDefinitionInterface $conditionDefinition - * @param CustomerInterface $customer - * @param RuleEnvironmentInterface $environment * * @return bool */ @@ -42,7 +38,6 @@ public function check( ); /** - * @param ConditionDefinitionInterface $conditionDefinition * * @return string */ @@ -56,7 +51,6 @@ public function getDbCondition(ConditionDefinitionInterface $conditionDefinition public static function createConditionDefinitionFromEditmode($setting); /** - * @param ConditionDefinitionInterface $conditionDefinition * * @return array */ diff --git a/src/ActionTrigger/Condition/CountActivities.php b/src/ActionTrigger/Condition/CountActivities.php index 329c1bb7..2072d30b 100644 --- a/src/ActionTrigger/Condition/CountActivities.php +++ b/src/ActionTrigger/Condition/CountActivities.php @@ -23,7 +23,9 @@ class CountActivities extends AbstractMatchCondition { const OPTION_TYPE = 'type'; + const OPTION_COUNT = 'count'; + const OPTION_OPERATOR = 'operator'; public function check( diff --git a/src/ActionTrigger/Condition/CountTargetGroupWeight.php b/src/ActionTrigger/Condition/CountTargetGroupWeight.php index 5d937d9e..904452d0 100644 --- a/src/ActionTrigger/Condition/CountTargetGroupWeight.php +++ b/src/ActionTrigger/Condition/CountTargetGroupWeight.php @@ -22,7 +22,9 @@ class CountTargetGroupWeight extends AbstractMatchCondition { const OPTION_OPERATOR = 'operator'; + const OPTION_COUNT = 'count'; + const OPTION_TARGET_GROUP = 'targetGroup'; public function check( diff --git a/src/ActionTrigger/Condition/CountTrackedSegment.php b/src/ActionTrigger/Condition/CountTrackedSegment.php index 1bfae738..4fb2c1cb 100644 --- a/src/ActionTrigger/Condition/CountTrackedSegment.php +++ b/src/ActionTrigger/Condition/CountTrackedSegment.php @@ -23,12 +23,11 @@ class CountTrackedSegment extends AbstractMatchCondition { const OPTION_OPERATOR = 'operator'; + const OPTION_COUNT = 'count'; + const OPTION_SEGMENTS = 'segments'; - /** - * @inheritdoc - */ public function check( ConditionDefinitionInterface $conditionDefinition, CustomerInterface $customer, @@ -60,9 +59,6 @@ public function check( return $this->matchCondition($trackedCount, $options[self::OPTION_OPERATOR], (int)$options[self::OPTION_COUNT]); } - /** - * @inheritdoc - */ public function getDbCondition(ConditionDefinitionInterface $conditionDefinition) { //return a condition that does not match any customer since this condition can only be used @@ -70,9 +66,6 @@ public function getDbCondition(ConditionDefinitionInterface $conditionDefinition return '1=2'; } - /** - * @inheritdoc - */ public static function createConditionDefinitionFromEditmode($setting) { $segmentDataArray = $setting->options->segments; @@ -89,9 +82,6 @@ public static function createConditionDefinitionFromEditmode($setting) return new \CustomerManagementFrameworkBundle\Model\ActionTrigger\ConditionDefinition($setting); } - /** - * @inheritdoc - */ public static function getDataForEditmode(ConditionDefinitionInterface $conditionDefinition) { $segmentManager = \Pimcore::getContainer()->get('cmf.segment_manager'); @@ -105,7 +95,7 @@ public static function getDataForEditmode(ConditionDefinitionInterface $conditio if ($segment) { $dataSegments[] = [ $segment->getId(), - $segment->getFullPath() + $segment->getFullPath(), ]; } } diff --git a/src/ActionTrigger/Condition/Customer.php b/src/ActionTrigger/Condition/Customer.php index 752325c7..ba1c601e 100644 --- a/src/ActionTrigger/Condition/Customer.php +++ b/src/ActionTrigger/Condition/Customer.php @@ -23,7 +23,9 @@ class Customer extends AbstractCondition { const OPTION_CUSTOMER_ID = 'customerId'; + const OPTION_CUSTOMER = 'customer'; + const OPTION_NOT = 'not'; public function check( diff --git a/src/ActionTrigger/Condition/CustomerField.php b/src/ActionTrigger/Condition/CustomerField.php index f3e971c3..36034fcb 100644 --- a/src/ActionTrigger/Condition/CustomerField.php +++ b/src/ActionTrigger/Condition/CustomerField.php @@ -21,7 +21,9 @@ class CustomerField extends AbstractCondition { const OPTION_FIELDNAME = 'fieldname'; + const OPTION_FIELDVALUE = 'fieldvalue'; + const OPTION_NOT = 'not'; public function check( diff --git a/src/ActionTrigger/Condition/Segment.php b/src/ActionTrigger/Condition/Segment.php index fdff0e3e..489e86c1 100644 --- a/src/ActionTrigger/Condition/Segment.php +++ b/src/ActionTrigger/Condition/Segment.php @@ -22,7 +22,9 @@ class Segment extends AbstractCondition { const OPTION_SEGMENT_ID = 'segmentId'; + const OPTION_SEGMENT = 'segment'; + const OPTION_NOT = 'not'; public function check( diff --git a/src/ActionTrigger/Event/AfterTrackActivity.php b/src/ActionTrigger/Event/AfterTrackActivity.php index 48636fc1..d0f3d762 100644 --- a/src/ActionTrigger/Event/AfterTrackActivity.php +++ b/src/ActionTrigger/Event/AfterTrackActivity.php @@ -36,9 +36,6 @@ public function getActivity() return $this->activity; } - /** - * @param ActivityInterface $activity - */ public function setActivity(ActivityInterface $activity) { $this->activity = $activity; diff --git a/src/ActionTrigger/Event/NewActivity.php b/src/ActionTrigger/Event/NewActivity.php index 35e29c7d..f359cf6f 100644 --- a/src/ActionTrigger/Event/NewActivity.php +++ b/src/ActionTrigger/Event/NewActivity.php @@ -39,9 +39,6 @@ public function getActivity() return $this->activity; } - /** - * @param ActivityInterface $activity - */ public function setActivity(ActivityInterface $activity) { $this->activity = $activity; diff --git a/src/ActionTrigger/Event/SegmentTracked.php b/src/ActionTrigger/Event/SegmentTracked.php index 16a86174..645a9453 100644 --- a/src/ActionTrigger/Event/SegmentTracked.php +++ b/src/ActionTrigger/Event/SegmentTracked.php @@ -25,6 +25,7 @@ class SegmentTracked extends AbstractSingleCustomerEvent implements RuleEnvironmentAwareEventInterface { const EVENT_NAME = 'plugin.cmf.segment-tracked'; + const STORAGE_KEY = 'segment_tracked'; /** @@ -75,7 +76,7 @@ public function updateEnvironment(TriggerDefinitionInterface $trigger, RuleEnvir { $environment->set(self::STORAGE_KEY, [ 'id' => $this->segment->getId(), - 'count' => $this->count + 'count' => $this->count, ]); } } diff --git a/src/ActionTrigger/Event/TargetGroupAssigned.php b/src/ActionTrigger/Event/TargetGroupAssigned.php index 15a31431..ec76afce 100644 --- a/src/ActionTrigger/Event/TargetGroupAssigned.php +++ b/src/ActionTrigger/Event/TargetGroupAssigned.php @@ -26,9 +26,11 @@ class TargetGroupAssigned extends AbstractSingleCustomerEvent implements RuleEnvironmentAwareEventInterface { const EVENT_NAME = 'plugin.cmf.target-group-assigned'; + const STORAGE_KEY = 'target_group_assigned'; const ASSIGNMENT_TYPE_DOCUMENT = 'documents'; + const ASSIGNMENT_TYPE_TARGETING_RULE = 'targetingRules'; /** @@ -57,25 +59,16 @@ public static function create(CustomerInterface $customer, $assignmentType, Targ return $event; } - /** - * @return string - */ public function getAssignmentType(): string { return $this->assignmentType; } - /** - * @return TargetGroup - */ public function getTargetGroup(): TargetGroup { return $this->targetGroup; } - /** - * @return VisitorInfo - */ public function getVisitorInfo(): VisitorInfo { return $this->visitorInfo; @@ -107,7 +100,7 @@ public function updateEnvironment(TriggerDefinitionInterface $trigger, RuleEnvir $environment->set(self::STORAGE_KEY, [ 'targetGroupId' => $this->targetGroup->getId(), - 'targetGroupWeight' => $assignment->getCount() + 'targetGroupWeight' => $assignment->getCount(), ]); } } diff --git a/src/ActionTrigger/EventHandler/DefaultEventHandler.php b/src/ActionTrigger/EventHandler/DefaultEventHandler.php index 2d3bd6bc..2ee44889 100644 --- a/src/ActionTrigger/EventHandler/DefaultEventHandler.php +++ b/src/ActionTrigger/EventHandler/DefaultEventHandler.php @@ -26,6 +26,7 @@ use CustomerManagementFrameworkBundle\Model\ActionTrigger\Rule; use CustomerManagementFrameworkBundle\Model\CustomerInterface; use CustomerManagementFrameworkBundle\Traits\LoggerAware; +use Knp\Bundle\PaginatorBundle\Pagination\SlidingPaginationInterface; use Knp\Component\Pager\PaginatorInterface; use Pimcore; use Pimcore\Model\DataObject\Service; @@ -114,15 +115,17 @@ public function handleCustomerListEvent(CustomerListEventInterface $event, RuleE sprintf('handleCustomerListEvent: found %s matching customers', $paginator->getTotalItemCount()) ); - $totalPages = $paginator->getPaginationData()['totalCount']; - for ($i = 1; $i <= $totalPages; $i++) { - $paginator = $this->paginator->paginate($listing, $i, 100); + if ($paginator instanceof SlidingPaginationInterface) { + $totalPages = $paginator->getPaginationData()['totalCount']; + for ($i = 1; $i <= $totalPages; $i++) { + $paginator = $this->paginator->paginate($listing, $i, 100); - foreach ($paginator as $customer) { - $this->handleActionsForCustomer($rule, $customer, $environment); - } + foreach ($paginator as $customer) { + $this->handleActionsForCustomer($rule, $customer, $environment); + } - Pimcore::collectGarbage(); + Pimcore::collectGarbage(); + } } } } @@ -150,7 +153,6 @@ private function handleActionsForCustomer(Rule $rule, CustomerInterface $custome } /** - * @param EventInterface $event * @param bool $checkConditions * * @return Rule[] @@ -160,8 +162,8 @@ private function getAppliedRules(EventInterface $event, RuleEnvironmentInterface $appliedRules = []; if (isset($this->getRulesGroupedByEvents()[$event->getName()]) && sizeof( - $this->getRulesGroupedByEvents()[$event->getName()] - ) + $this->getRulesGroupedByEvents()[$event->getName()] + ) ) { $rules = $this->rulesGroupedByEvents[$event->getName()]; diff --git a/src/ActionTrigger/Queue/DefaultQueue.php b/src/ActionTrigger/Queue/DefaultQueue.php index 234befa5..18466216 100644 --- a/src/ActionTrigger/Queue/DefaultQueue.php +++ b/src/ActionTrigger/Queue/DefaultQueue.php @@ -52,7 +52,7 @@ public function addToQueue( 'actionId' => $action->getId(), 'creationDate' => $time, 'modificationDate' => $time, - 'environment' => serialize($environment) + 'environment' => serialize($environment), ] ); } diff --git a/src/ActionTrigger/RuleEnvironment.php b/src/ActionTrigger/RuleEnvironment.php index fdac5c31..4c78b85b 100644 --- a/src/ActionTrigger/RuleEnvironment.php +++ b/src/ActionTrigger/RuleEnvironment.php @@ -47,9 +47,6 @@ public function getIterator(): \ArrayIterator return new \ArrayIterator($this->data); } - /** - * @return bool - */ public function offsetExists($offset): bool { return isset($this->data[$offset]); diff --git a/src/ActivityManager/ActivityManagerInterface.php b/src/ActivityManager/ActivityManagerInterface.php index 51a5809b..11fafb00 100644 --- a/src/ActivityManager/ActivityManagerInterface.php +++ b/src/ActivityManager/ActivityManagerInterface.php @@ -23,7 +23,6 @@ interface ActivityManagerInterface * Add/update activity in activity store. * Each activity is only saved once. The activity will be updated if it already exists in the store. * - * @param ActivityInterface $activity * * @return void */ @@ -32,7 +31,6 @@ public function trackActivity(ActivityInterface $activity); /** * Delete activity from activity store. * - * @param ActivityInterface $activity * * @return void */ diff --git a/src/ActivityManager/DefaultActivityManager.php b/src/ActivityManager/DefaultActivityManager.php index 6cae382a..ec3f0df0 100644 --- a/src/ActivityManager/DefaultActivityManager.php +++ b/src/ActivityManager/DefaultActivityManager.php @@ -64,7 +64,6 @@ public function setDisableEvents($disableEvents) * Add/update activity in activity store. * Each activity is only saved once. The activity will be updated if it already exists in the store. * - * @param ActivityInterface $activity * * @return void * @@ -122,7 +121,6 @@ public function trackActivity(ActivityInterface $activity) /** * Delete an activity from the activty store. * - * @param ActivityInterface $activity * * @return void */ diff --git a/src/ActivityStore/ActivityStoreInterface.php b/src/ActivityStore/ActivityStoreInterface.php index 421d3299..4e9eeb69 100644 --- a/src/ActivityStore/ActivityStoreInterface.php +++ b/src/ActivityStore/ActivityStoreInterface.php @@ -30,15 +30,12 @@ interface ActivityStoreInterface { /** - * @param ActivityInterface $activity * * @return ActivityStoreEntryInterface */ public function insertActivityIntoStore(ActivityInterface $activity); /** - * @param ActivityInterface $activity - * @param ActivityStoreEntryInterface|null $entry * * @return ActivityStoreEntryInterface */ @@ -46,7 +43,6 @@ public function updateActivityInStore(ActivityInterface $activity, ActivityStore /** * - * @param ActivityStoreEntryInterface $entry * @param bool $updateAttributes * * @return void @@ -54,14 +50,12 @@ public function updateActivityInStore(ActivityInterface $activity, ActivityStore public function updateActivityStoreEntry(ActivityStoreEntryInterface $entry, $updateAttributes = false); /** - * @param ActivityInterface $activity * * @return ActivityStoreEntryInterface|null */ public function getEntryForActivity(ActivityInterface $activity); /** - * @param CustomerInterface $customer * * @return array */ @@ -73,7 +67,6 @@ public function getActivityDataForCustomer(CustomerInterface $customer); public function getActivityList(); /** - * @param ActivityInterface $activity * * @return bool */ @@ -87,7 +80,6 @@ public function deleteActivity(ActivityInterface $activity); public function getEntryById($id); /** - * @param ActivityStoreEntryInterface $entry * * @return void */ @@ -96,7 +88,6 @@ public function deleteEntry(ActivityStoreEntryInterface $entry); /** * Deletes all activities for $customer in the store. * - * @param CustomerInterface $customer * * @return void */ @@ -105,7 +96,6 @@ public function deleteCustomer(CustomerInterface $customer); /** * @param int $pageSize * @param int $page - * @param ExportActivitiesFilterParams $params * * @return PaginationInterface */ @@ -120,7 +110,6 @@ public function getActivitiesDataForWebservice($pageSize, $page, ExportActivitie public function getDeletionsData($type, $deletionsSinceTimestamp); /** - * @param CustomerInterface $customer * @param string|null $activityType * * @return int @@ -143,7 +132,6 @@ public function getCustomerIdsMatchingActivitiesCount($operator, $type, $count); public function getAvailableActivityTypes(); /** - * @param array $data * * @return ActivityStoreEntryInterface */ @@ -152,7 +140,6 @@ public function createEntryInstance(array $data); /** * Metadata items of entries are lazy loaded. This method loads the metadata items from the store. * - * @param ActivityStoreEntryInterface $entry * * @return void */ diff --git a/src/ActivityStore/MariaDb.php b/src/ActivityStore/MariaDb.php index 9000652b..82f508cc 100644 --- a/src/ActivityStore/MariaDb.php +++ b/src/ActivityStore/MariaDb.php @@ -41,7 +41,6 @@ protected function getActivityStoreConnection() } /** - * @param ActivityInterface $activity * * @return ActivityStoreEntryInterface */ @@ -64,8 +63,6 @@ public function insertActivityIntoStore(ActivityInterface $activity) } /** - * @param ActivityInterface $activity - * @param ActivityStoreEntryInterface $entry * * @return ActivityStoreEntryInterface * @@ -169,7 +166,7 @@ protected function saveActivityStoreEntry(ActivityStoreEntryInterface $entry, Ac $insertData = [ 'activityId' => $entry->getId(), 'key' => $key, - 'data' => $data + 'data' => $data, ]; $insertData = Helper::quoteDataIdentifiers($db, $insertData); @@ -189,7 +186,6 @@ protected function saveActivityStoreEntry(ActivityStoreEntryInterface $entry, Ac } /** - * @param ActivityInterface $activity * * @return ActivityStoreEntryInterface|null */ @@ -224,7 +220,6 @@ public function getEntryForActivity(ActivityInterface $activity) } /** - * @param CustomerInterface $customer * * @return array */ @@ -257,7 +252,6 @@ public function getActivityList() /** * @param int $pageSize * @param int $page - * @param ExportActivitiesFilterParams $params * * @return PaginationInterface */ @@ -310,8 +304,8 @@ public function getDeletionsData($entityType, $deletionsSinceTimestamp) $db = Db::get(); $sql = 'select * from '.self::DELETIONS_TABLE.' where entityType = '.$db->quote( - $entityType - ).' and creationDate >= '.$db->quote($deletionsSinceTimestamp); + $entityType + ).' and creationDate >= '.$db->quote($deletionsSinceTimestamp); $data = $db->fetchAllAssociative($sql); @@ -326,7 +320,6 @@ public function getDeletionsData($entityType, $deletionsSinceTimestamp) } /** - * @param ActivityInterface $activity * * @return bool */ @@ -342,7 +335,6 @@ public function deleteActivity(ActivityInterface $activity) } /** - * @param ActivityStoreEntryInterface $entry * * @return void */ @@ -374,9 +366,6 @@ public function deleteEntry(ActivityStoreEntryInterface $entry) } } - /** - * @param CustomerInterface $customer - */ public function deleteCustomer(CustomerInterface $customer) { $db = Db::get(); @@ -406,7 +395,6 @@ public function getEntryById($id) } /** - * @param CustomerInterface $customer * @param string|null $activityType * * @return int @@ -445,8 +433,8 @@ public function getCustomerIdsMatchingActivitiesCount($operator, $type, $count) $operator = in_array($operator, ['<', '>', '=']) ? $operator : '='; $sql = 'select customerId from '.self::ACTIVITIES_TABLE.$where.' group by customerId having count(*) '.$operator.intval( - $count - ); + $count + ); return $db->fetchFirstColumn($sql); } @@ -490,7 +478,6 @@ protected function getAttributeInsertData(ActivityInterface $activity) } /** - * @param array $data * * @return ActivityStoreEntryInterface */ @@ -509,9 +496,6 @@ public function createEntryInstance(array $data) return $entry; } - /** - * @inheritdoc - */ public function lazyLoadMetadataOfEntry(ActivityStoreEntryInterface $entry) { if (!$entry->getId()) { diff --git a/src/ActivityStore/MySQL.php b/src/ActivityStore/MySQL.php index e42c0902..1c881153 100644 --- a/src/ActivityStore/MySQL.php +++ b/src/ActivityStore/MySQL.php @@ -56,7 +56,6 @@ public function getActivityList() } /** - * @param ActivityInterface $activity * * @return ActivityStoreEntryInterface|null * @@ -166,9 +165,6 @@ public function getActivitiesDataForWebservice($pageSize, $page, ExportActivitie return $paginator; } - /** - * @inheritdoc - */ public function lazyLoadMetadataOfEntry(ActivityStoreEntryInterface $entry) { if (!$entry->getId()) { diff --git a/src/ActivityStore/SqlActivityStore.php b/src/ActivityStore/SqlActivityStore.php index 29885424..e0b13c2d 100644 --- a/src/ActivityStore/SqlActivityStore.php +++ b/src/ActivityStore/SqlActivityStore.php @@ -34,7 +34,9 @@ abstract class SqlActivityStore use PrimaryKeyTrait; const ACTIVITIES_TABLE = 'plugin_cmf_activities'; + const ACTIVITIES_METADATA_TABLE = 'plugin_cmf_activities_metadata'; + const DELETIONS_TABLE = 'plugin_cmf_deletions'; /** @@ -42,9 +44,6 @@ abstract class SqlActivityStore */ protected $paginator; - /** - * @param PaginatorInterface $paginator - */ public function __construct(PaginatorInterface $paginator) { $this->paginator = $paginator; @@ -69,7 +68,6 @@ public function insertActivityIntoStore(ActivityInterface $activity) } /** - * @param ActivityInterface $activity * * @return mixed any data which the activity repository / service can save */ @@ -140,7 +138,7 @@ protected function saveActivityStoreEntry(ActivityStoreEntryInterface $entry, Ac $insertData = [ 'activityId' => $entry->getId(), 'key' => $key, - 'data' => $data + 'data' => $data, ]; $insertData = Helper::quoteDataIdentifiers($db, $insertData); @@ -170,8 +168,6 @@ public function getAvailableActivityTypes() } /** - * @param ActivityInterface $activity - * @param ActivityStoreEntryInterface|null $entry * * @return null|ActivityStoreEntryInterface * @@ -193,7 +189,6 @@ public function updateActivityInStore(ActivityInterface $activity, ActivityStore } /** - * @param ActivityStoreEntryInterface $entry * @param bool $updateAttributes * * @throws \Exception @@ -221,7 +216,6 @@ public function updateActivityStoreEntry(ActivityStoreEntryInterface $entry, $up } /** - * @param array $data * * @return ActivityStoreEntryInterface * @@ -265,9 +259,6 @@ public function getCustomerIdsMatchingActivitiesCount($operator, $type, $count) return $db->fetchFirstColumn($sql); } - /** - * @param CustomerInterface $customer - */ public function deleteCustomer(CustomerInterface $customer) { $db = Db::get(); @@ -278,6 +269,7 @@ public function deleteEntry(ActivityStoreEntryInterface $entry) { $db = Db::get(); $db->beginTransaction(); + try { $db->executeQuery('DELETE FROM '.self::ACTIVITIES_TABLE.' WHERE id = ?', [$entry->getId()]); @@ -302,7 +294,6 @@ public function deleteEntry(ActivityStoreEntryInterface $entry) } /** - * @param ActivityInterface $activity * * @return bool * @@ -324,8 +315,8 @@ public function getDeletionsData($entityType, $deletionsSinceTimestamp) $db = Db::get(); $sql = 'select * from '.self::DELETIONS_TABLE.' where entityType = '.$db->quote( - $entityType - ).' and creationDate >= '.$db->quote($deletionsSinceTimestamp); + $entityType + ).' and creationDate >= '.$db->quote($deletionsSinceTimestamp); $data = $db->fetchAllAssociative($sql); @@ -340,7 +331,6 @@ public function getDeletionsData($entityType, $deletionsSinceTimestamp) } /** - * @param CustomerInterface $customer * @param string|null $activityType * * @return int @@ -361,7 +351,6 @@ public function countActivitiesOfCustomer(CustomerInterface $customer, $activity } /** - * @param ActivityInterface $activity * * @return ActivityStoreEntryInterface|null */ diff --git a/src/ActivityUrlTracker/ActivityUrlTrackerInterface.php b/src/ActivityUrlTracker/ActivityUrlTrackerInterface.php index f1caba98..2acde613 100644 --- a/src/ActivityUrlTracker/ActivityUrlTrackerInterface.php +++ b/src/ActivityUrlTracker/ActivityUrlTrackerInterface.php @@ -20,7 +20,6 @@ interface ActivityUrlTrackerInterface /** * @param string $customerIdEncoded * @param string $activityCode - * @param array $params * * @return void */ diff --git a/src/ActivityUrlTracker/DefaultActivityUrlTracker.php b/src/ActivityUrlTracker/DefaultActivityUrlTracker.php index f6970848..8d59100a 100644 --- a/src/ActivityUrlTracker/DefaultActivityUrlTracker.php +++ b/src/ActivityUrlTracker/DefaultActivityUrlTracker.php @@ -45,7 +45,6 @@ public function __construct(CustomerProviderInterface $customerProvider, Activit /** * @param string $customerIdEncoded * @param string $activityCode - * @param array $params * * @return void */ diff --git a/src/ActivityView/ActivityViewInterface.php b/src/ActivityView/ActivityViewInterface.php index c77982c9..fc7ad8b3 100644 --- a/src/ActivityView/ActivityViewInterface.php +++ b/src/ActivityView/ActivityViewInterface.php @@ -20,21 +20,18 @@ interface ActivityViewInterface { /** - * @param ActivityStoreEntryInterface $activityEntry * * @return array|false */ public function getOverviewAdditionalData(ActivityStoreEntryInterface $activityEntry); /** - * @param ActivityStoreEntryInterface $activityEntry * * @return array */ public function getDetailviewData(ActivityStoreEntryInterface $activityEntry); /** - * @param ActivityStoreEntryInterface $activityEntry * * @return string|false */ @@ -42,8 +39,6 @@ public function getDetailviewTemplate(ActivityStoreEntryInterface $activityEntry /** * @param string $implementationClass - * @param array $attributes - * @param array $visibleKeys * * @return array */ diff --git a/src/ActivityView/DefaultActivityView.php b/src/ActivityView/DefaultActivityView.php index d4aa140a..c5be8ac0 100644 --- a/src/ActivityView/DefaultActivityView.php +++ b/src/ActivityView/DefaultActivityView.php @@ -30,16 +30,12 @@ class DefaultActivityView implements ActivityViewInterface */ protected $viewFormatter; - /** - * @param ViewFormatterInterface $viewFormatter - */ public function __construct(ViewFormatterInterface $viewFormatter) { $this->viewFormatter = $viewFormatter; } /** - * @param ActivityStoreEntryInterface $activityEntry * * @return array|false */ @@ -56,7 +52,6 @@ public function getOverviewAdditionalData(ActivityStoreEntryInterface $activityE } /** - * @param ActivityStoreEntryInterface $activityEntry * * @return array */ @@ -75,7 +70,6 @@ public function getDetailviewData(ActivityStoreEntryInterface $activityEntry) } /** - * @param ActivityStoreEntryInterface $activityEntry * * @return string|false */ @@ -93,8 +87,6 @@ public function getDetailviewTemplate(ActivityStoreEntryInterface $activityEntry /** * @param string $implementationClass - * @param array $attributes - * @param array $visibleKeys * * @return array */ @@ -119,11 +111,13 @@ public function formatAttributes($implementationClass, array $attributes, array foreach ($attributes as $key => $value) { if (!is_scalar($value)) { unset($attributes[$key]); + continue; } if ($class && $fd = $class->getFieldDefinition($key)) { $result[$vf->getLabelByFieldDefinition($fd)] = $vf->formatValueByFieldDefinition($fd, $value); + continue; } elseif (isset($dataTypes[$key])) { if ($dataTypes[$key] == ActivityInterface::DATATYPE_BOOL) { @@ -172,8 +166,6 @@ public function createPimcoreElementLink($id, $elementType, $buttonCssClass = 'b } /** - * @param array $attributes - * @param array $visibleKeys * * @return array */ diff --git a/src/Command/ActionTriggerQueueCommand.php b/src/Command/ActionTriggerQueueCommand.php index 1fb4a09a..f94b2b50 100644 --- a/src/Command/ActionTriggerQueueCommand.php +++ b/src/Command/ActionTriggerQueueCommand.php @@ -32,7 +32,6 @@ class ActionTriggerQueueCommand extends AbstractCommand protected $actionTriggerQueue; /** - * @param QueueInterface $actionTriggerQueue * @required */ public function setActionTriggerQueue(QueueInterface $actionTriggerQueue): void @@ -47,8 +46,6 @@ protected function configure() } /** - * @param InputInterface $input - * @param OutputInterface $output * * @return int */ diff --git a/src/Command/BuildSegmentsCommand.php b/src/Command/BuildSegmentsCommand.php index 63c41049..d2cfc864 100644 --- a/src/Command/BuildSegmentsCommand.php +++ b/src/Command/BuildSegmentsCommand.php @@ -79,8 +79,6 @@ protected function configure() } /** - * @param InputInterface $input - * @param OutputInterface $output * * @return int */ diff --git a/src/Command/CronTriggerCommand.php b/src/Command/CronTriggerCommand.php index a18fa3ef..2f74f46c 100644 --- a/src/Command/CronTriggerCommand.php +++ b/src/Command/CronTriggerCommand.php @@ -28,7 +28,6 @@ class CronTriggerCommand extends AbstractCommand protected $actionTriggerListener; /** - * @param EventHandlerInterface $actionTriggerListener * @required */ public function setActionTriggerListener(EventHandlerInterface $actionTriggerListener): void @@ -43,8 +42,6 @@ protected function configure() } /** - * @param InputInterface $input - * @param OutputInterface $output * * @return int */ diff --git a/src/Command/DuplicatesIndexCommand.php b/src/Command/DuplicatesIndexCommand.php index 83e87192..cbee5f07 100644 --- a/src/Command/DuplicatesIndexCommand.php +++ b/src/Command/DuplicatesIndexCommand.php @@ -27,7 +27,6 @@ class DuplicatesIndexCommand extends AbstractCommand protected $duplicatesIndex; /** - * @param DuplicatesIndexInterface $duplicatesIndex * @required */ public function setDuplicatesIndex(DuplicatesIndexInterface $duplicatesIndex): void @@ -45,8 +44,6 @@ protected function configure() } /** - * @param InputInterface $input - * @param OutputInterface $output * * @return int */ diff --git a/src/Command/MaintenanceCommand.php b/src/Command/MaintenanceCommand.php index f485b8e2..d3b8c837 100644 --- a/src/Command/MaintenanceCommand.php +++ b/src/Command/MaintenanceCommand.php @@ -27,7 +27,6 @@ class MaintenanceCommand extends AbstractCommand protected $maintenanceWorker; /** - * @param MaintenanceWorker $maintenanceWorker * @required */ public function setMaintenanceWorker(MaintenanceWorker $maintenanceWorker): void @@ -46,9 +45,6 @@ protected function configure() * * @see MaintenanceWorker * - * @param InputInterface $input - * @param OutputInterface $output - * * @return int */ protected function execute(InputInterface $input, OutputInterface $output)//: int diff --git a/src/Command/SegmentAssignmentIndexCommand.php b/src/Command/SegmentAssignmentIndexCommand.php index 966e41a4..d2604cce 100644 --- a/src/Command/SegmentAssignmentIndexCommand.php +++ b/src/Command/SegmentAssignmentIndexCommand.php @@ -27,7 +27,6 @@ class SegmentAssignmentIndexCommand extends AbstractCommand protected $indexer; /** - * @param IndexerInterface $indexer * @required */ public function setIndexer(IndexerInterface $indexer): void @@ -42,8 +41,6 @@ protected function configure() } /** - * @param InputInterface $input - * @param OutputInterface $output * * @return int */ diff --git a/src/Controller/Admin.php b/src/Controller/Admin.php index e2a8c6b4..6da7233d 100644 --- a/src/Controller/Admin.php +++ b/src/Controller/Admin.php @@ -49,9 +49,6 @@ public function __construct(JsConfigService $jsConfigService, PaginatorInterface $this->paginator = $paginator; } - /** - * @param ControllerEvent $event - */ public function onKernelControllerEvent(ControllerEvent $event): void { $this->initJsConfig(); @@ -70,9 +67,6 @@ protected function initJsConfig() } } - /** - * @return JsConfigService - */ protected function getJsConfigService(): JsConfigService { return $this->jsConfigService; @@ -81,7 +75,6 @@ protected function getJsConfigService(): JsConfigService /** * Features to enable * - * @return array */ protected function getJsConfigFeatures(): array { diff --git a/src/Controller/Admin/ActivitiesController.php b/src/Controller/Admin/ActivitiesController.php index 05835754..47ab299a 100644 --- a/src/Controller/Admin/ActivitiesController.php +++ b/src/Controller/Admin/ActivitiesController.php @@ -17,6 +17,7 @@ use CustomerManagementFrameworkBundle\ActivityStore\MariaDb; use CustomerManagementFrameworkBundle\CustomerProvider\CustomerProviderInterface; +use Knp\Bundle\PaginatorBundle\Pagination\SlidingPaginationInterface; use Knp\Component\Pager\PaginatorInterface; use Pimcore\Controller\KernelControllerEventInterface; use Pimcore\Controller\UserAwareController; @@ -78,7 +79,7 @@ public function listAction(Request $request, CustomerProviderInterface $customer 'types' => $types, 'selectedType' => $type, 'activities' => $paginator, - 'paginationVariables' => $paginator->getPaginationData(), + 'paginationVariables' => $paginator instanceof SlidingPaginationInterface ? $paginator->getPaginationData() : [], 'customer' => $customer, 'activityView' => \Pimcore::getContainer()->get('cmf.activity_view'), ] diff --git a/src/Controller/Admin/Customers/FilterDefinitionController.php b/src/Controller/Admin/Customers/FilterDefinitionController.php index 0d038735..74748791 100644 --- a/src/Controller/Admin/Customers/FilterDefinitionController.php +++ b/src/Controller/Admin/Customers/FilterDefinitionController.php @@ -53,6 +53,7 @@ public function deleteAction(Request $request): RedirectResponse return $this->getRedirectToFilter($filterDefinition->getId()); } + // try to delete the FilterDefinition try { $filterDefinition->delete(); @@ -81,6 +82,7 @@ public function saveAction(Request $request, CustomerViewInterface $customerView return $this->getRedirectToFilter(0, $errors); } + try { $filterDefinition->save(); } catch (\Exception $e) { @@ -89,6 +91,7 @@ public function saveAction(Request $request, CustomerViewInterface $customerView return $this->getRedirectToFilter(0, $errors); } + // redirect to filter view with new FilterDefinition selected return $this->getRedirectToFilter($filterDefinition->getId()); } @@ -125,6 +128,7 @@ public function updateAction(Request $request, CustomerViewInterface $customerVi return $this->getRedirectToFilter(0, $errors); } + try { $filterDefinition->save(); } catch (\Exception $e) { @@ -133,6 +137,7 @@ public function updateAction(Request $request, CustomerViewInterface $customerVi return $this->getRedirectToFilter(0, $errors); } + // redirect to filter view with new FilterDefinition selected return $this->getRedirectToFilter($filterDefinition->getId()); } @@ -161,6 +166,7 @@ public function shareAction(Request $request, CustomerViewInterface $customerVie return $this->getRedirectToFilter(0, $errors); } + // try to update the FilterDefinition try { // add new allowed user ids @@ -173,6 +179,7 @@ public function shareAction(Request $request, CustomerViewInterface $customerVie return $this->getRedirectToFilter(); } + // redirect to filter view with new FilterDefinition selected return $this->getRedirectToFilter($filterDefinition->getId()); } diff --git a/src/Controller/Admin/CustomersController.php b/src/Controller/Admin/CustomersController.php index e093060f..279a4bfb 100644 --- a/src/Controller/Admin/CustomersController.php +++ b/src/Controller/Admin/CustomersController.php @@ -27,6 +27,7 @@ use CustomerManagementFrameworkBundle\Model\CustomerInterface; use CustomerManagementFrameworkBundle\Model\CustomerSegmentInterface; use CustomerManagementFrameworkBundle\Model\CustomerView\FilterDefinition; +use Knp\Bundle\PaginatorBundle\Pagination\SlidingPaginationInterface; use Pimcore\Db; use Pimcore\Model\DataObject\AbstractObject; use Pimcore\Model\DataObject\Concrete; @@ -96,9 +97,9 @@ public function listAction(Request $request): Response if ($request->isXmlHttpRequest()) { return $this->render($customerView->getOverviewWrapperTemplate(), [ 'paginator' => $paginator, - 'paginationVariables' => $paginator->getPaginationData(), + 'paginationVariables' => $paginator instanceof SlidingPaginationInterface ? $paginator->getPaginationData() : [], 'customerView' => $customerView, - 'idField' => Service::getVersionDependentDatabaseColumnName('id') + 'idField' => Service::getVersionDependentDatabaseColumnName('id'), ]); } else { return $this->render( @@ -108,7 +109,7 @@ public function listAction(Request $request): Response 'filters' => $filters, 'errors' => $errors, 'paginator' => $paginator, - 'paginationVariables' => $paginator->getPaginationData(), + 'paginationVariables' => $paginator instanceof SlidingPaginationInterface ? $paginator->getPaginationData() : [], 'customerView' => $customerView, 'searchBarFields' => $this->getSearchHelper()->getConfiguredSearchBarFields(), 'request' => $request, @@ -116,7 +117,7 @@ public function listAction(Request $request): Response 'filterDefinition' => $this->getFilterDefinition($request), 'accessToTempCustomerFolder' => boolval($this->hasUserAccessToTempCustomerFolder()), 'hideAdvancedFilterSettings' => boolval($request->get('segmentId')), - 'idField' => Service::getVersionDependentDatabaseColumnName('id') + 'idField' => Service::getVersionDependentDatabaseColumnName('id'), ] ); } @@ -496,6 +497,7 @@ protected function getFilterDefinitions(): array $FilterDefinitionListing = new FilterDefinition\Listing(); // build user ids condition for filter definition $FilterDefinitionListing->setUserIdsCondition($this->getUserIds()); + // return loaded filter definitions array return $FilterDefinitionListing->load(); } @@ -529,6 +531,7 @@ protected function getFilterDefinition(Request $request): ?FilterDefinition // user is not allowed to use FilterDefinition return $DefaultFilterDefinition; } + // return FilterDefinition definition return $filterDefinition; } @@ -568,6 +571,7 @@ protected function addFilterDefinitionCustomer(Request $request, array $filters) // filter of user more important than filter definition $filters = array_merge($filterDefinitionCustomer, $filters); } + // return merged filters array return $filters; } diff --git a/src/Controller/Admin/DuplicatesController.php b/src/Controller/Admin/DuplicatesController.php index 55b1b2a2..6aec9a9b 100644 --- a/src/Controller/Admin/DuplicatesController.php +++ b/src/Controller/Admin/DuplicatesController.php @@ -18,6 +18,7 @@ use CustomerManagementFrameworkBundle\Controller\Admin; use CustomerManagementFrameworkBundle\CustomerList\SearchHelper; use CustomerManagementFrameworkBundle\DuplicatesIndex\DuplicatesIndexInterface; +use Knp\Bundle\PaginatorBundle\Pagination\SlidingPaginationInterface; use Pimcore\Model\DataObject\AbstractObject; use Pimcore\Model\DataObject\Service; use Symfony\Component\HttpFoundation\JsonResponse; @@ -76,7 +77,7 @@ public function listAction(Request $request, DuplicatesIndexInterface $duplicate '@PimcoreCustomerManagementFramework/admin/duplicates/list.html.twig', [ 'paginator' => $paginator, - 'paginationVariables' => $paginator->getPaginationData(), + 'paginationVariables' => $paginator instanceof SlidingPaginationInterface ? $paginator->getPaginationData() : [], 'duplicates' => $paginator->getItems(), 'duplicatesView' => \Pimcore::getContainer()->get('cmf.customer_duplicates_view'), 'searchBarFields' => $this->getSearchHelper()->getConfiguredSearchBarFields(), diff --git a/src/Controller/Admin/HelperController.php b/src/Controller/Admin/HelperController.php index 2e03c4c2..e486941c 100644 --- a/src/Controller/Admin/HelperController.php +++ b/src/Controller/Admin/HelperController.php @@ -106,7 +106,7 @@ public function groupedSegmentsAction(SegmentManagerInterface $segmentManager): 'id' => $groupSegment->getId(), 'name' => $groupSegment->getName(), 'groupId' => $group->getId(), - 'groupName' => $group->getName() + 'groupName' => $group->getName(), ]; } } @@ -124,7 +124,7 @@ public function settingJsonAction(): Response 'duplicatesViewEnabled' => $this->getParameter('pimcore_customer_management_framework.customer_duplicates_services.duplicates_view.enabled'), 'segmentAssignment' => $this->getParameter('pimcore_customer_management_framework.segment_assignment_classes.types'), 'customerClassName' => $this->getParameter('pimcore_customer_management_framework.general.customerPimcoreClass'), - 'shortcutFilterDefinitions' => FilterDefinition::prepareDataForMenu(FilterDefinition::getAllShortcutAvailableForUser($this->getPimcoreUser())) + 'shortcutFilterDefinitions' => FilterDefinition::prepareDataForMenu(FilterDefinition::getAllShortcutAvailableForUser($this->getPimcoreUser())), ]; $content = ' @@ -158,7 +158,7 @@ public function possibleNewsletterFilterFlagsAction(CustomerProviderInterface $c } return $this->json([ - 'data' => $possibleFlags + 'data' => $possibleFlags, ]); } } diff --git a/src/Controller/Admin/RulesController.php b/src/Controller/Admin/RulesController.php index 5629331c..eb4022f7 100644 --- a/src/Controller/Admin/RulesController.php +++ b/src/Controller/Admin/RulesController.php @@ -41,7 +41,6 @@ public function onKernelControllerEvent(ControllerEvent $event): void /** * get saved action trigger rules * - * @param Request $request * @Route("/list") */ public function listAction(Request $request): JsonResponse diff --git a/src/Controller/Admin/SegmentAssignmentController.php b/src/Controller/Admin/SegmentAssignmentController.php index c989e10c..83f73521 100644 --- a/src/Controller/Admin/SegmentAssignmentController.php +++ b/src/Controller/Admin/SegmentAssignmentController.php @@ -62,7 +62,7 @@ public function inheritableSegments(Request $request, SegmentManagerInterface $s $parentId = $db->fetchOne($parentIdStatement, [ 'parentIdField' => $parentIdField, 'idField' => $idField, - 'value' => $id + 'value' => $id, ]); $segments = $segmentManager->getSegmentsForElementId($parentId, $type); diff --git a/src/Controller/Admin/SettingsController.php b/src/Controller/Admin/SettingsController.php index 4de63d5e..b22dd27c 100644 --- a/src/Controller/Admin/SettingsController.php +++ b/src/Controller/Admin/SettingsController.php @@ -80,7 +80,7 @@ public function userManagementAction(Request $request, CsrfProtectionHandler $cs 'lastname' => $user->getLastname(), 'email' => $user->getEmail(), 'apiKey' => $apiKeys[$user->getId()] ?? '', - 'image' => '/admin/user/get-image?id=' . $user->getId() + 'image' => '/admin/user/get-image?id=' . $user->getId(), ]; } diff --git a/src/Controller/Rest/AbstractRestController.php b/src/Controller/Rest/AbstractRestController.php index 4777de15..3d72f92d 100644 --- a/src/Controller/Rest/AbstractRestController.php +++ b/src/Controller/Rest/AbstractRestController.php @@ -30,29 +30,21 @@ abstract class AbstractRestController extends UserAwareController { use JsonHelperTrait; -// public function __construct(protected LoggerInterface $pimcoreApiLogger) -// { -// } + // public function __construct(protected LoggerInterface $pimcoreApiLogger) + // { + // } /** * @var Stopwatch */ protected $stopwatch; - /** - * @inheritDoc - * - * @return bool - */ public function needsSessionDoubleAuthenticationCheck(): bool { // do not double-check session as api key auth is possible return false; } - /** - * @inheritDoc - */ protected function checkPermission($permission): void { try { @@ -123,7 +115,6 @@ protected function createSuccessResponse($data = null, $wrapInDataProperty = tru } /** - * @param array $data * @param int $status * * @return JsonResponse @@ -150,9 +141,6 @@ protected function createErrorResponse($data = null, $status = Response::HTTP_BA ); } - /** - * @inheritDoc - */ protected function createNotFoundResponseException($message = null, \Exception $previous = null) { return new ResponseException($this->createErrorResponse( @@ -164,7 +152,6 @@ protected function createNotFoundResponseException($message = null, \Exception $ /** * Get decoded JSON request data * - * @param Request $request * * @return array * @@ -203,7 +190,6 @@ protected function getJsonData(Request $request) /** * Get ID either as parameter or from request * - * @param Request $request * @param int|null $id * * @return mixed|null @@ -293,7 +279,6 @@ protected function checkCondition($condition) } /** - * @param Request $request * * @throws \Exception * diff --git a/src/Controller/Rest/Api/ActivitiesController.php b/src/Controller/Rest/Api/ActivitiesController.php index c2861aa7..dc420a43 100644 --- a/src/Controller/Rest/Api/ActivitiesController.php +++ b/src/Controller/Rest/Api/ActivitiesController.php @@ -24,9 +24,6 @@ */ class ActivitiesController extends CrudHandlerController { - /** - * @return ActivitiesHandler - */ protected function getHandler(): ActivitiesHandler { return \Pimcore::getContainer()->get('cmf.rest.activities_handler'); diff --git a/src/Controller/Rest/Api/CustomersController.php b/src/Controller/Rest/Api/CustomersController.php index 2e4881ce..eb44211e 100644 --- a/src/Controller/Rest/Api/CustomersController.php +++ b/src/Controller/Rest/Api/CustomersController.php @@ -24,9 +24,6 @@ */ class CustomersController extends CrudHandlerController { - /** - * @return CustomersHandler - */ protected function getHandler(): CustomersHandler { return \Pimcore::getContainer()->get('cmf.rest.customers_handler'); diff --git a/src/Controller/Rest/Api/DeletionsController.php b/src/Controller/Rest/Api/DeletionsController.php index 086ad801..157dc5d4 100644 --- a/src/Controller/Rest/Api/DeletionsController.php +++ b/src/Controller/Rest/Api/DeletionsController.php @@ -48,9 +48,6 @@ public function listRecords(Request $request): JsonResponse | Response return $response; } - /** - * @return DeletionsHandler - */ protected function getHandler(): DeletionsHandler { return \Pimcore::getContainer()->get('cmf.rest.deletions_handler'); diff --git a/src/Controller/Rest/Api/SegmentGroupsController.php b/src/Controller/Rest/Api/SegmentGroupsController.php index db2fbba0..c9a1591a 100644 --- a/src/Controller/Rest/Api/SegmentGroupsController.php +++ b/src/Controller/Rest/Api/SegmentGroupsController.php @@ -24,9 +24,6 @@ */ class SegmentGroupsController extends CrudHandlerController { - /** - * @return SegmentGroupsHandler - */ protected function getHandler(): SegmentGroupsHandler { return \Pimcore::getContainer()->get('cmf.rest.segment_groups_handler'); diff --git a/src/Controller/Rest/Api/SegmentsController.php b/src/Controller/Rest/Api/SegmentsController.php index d9b59ce9..d0aab15f 100644 --- a/src/Controller/Rest/Api/SegmentsController.php +++ b/src/Controller/Rest/Api/SegmentsController.php @@ -24,9 +24,6 @@ */ class SegmentsController extends CrudHandlerController { - /** - * @return SegmentsHandler - */ protected function getHandler(): SegmentsHandler { return \Pimcore::getContainer()->get('cmf.rest.segments_handler'); diff --git a/src/Controller/Rest/Api/SegmentsOfCustomersController.php b/src/Controller/Rest/Api/SegmentsOfCustomersController.php index 103bf2d9..a912e976 100644 --- a/src/Controller/Rest/Api/SegmentsOfCustomersController.php +++ b/src/Controller/Rest/Api/SegmentsOfCustomersController.php @@ -48,9 +48,6 @@ public function updateRecordsAction(Request $request): JsonResponse | Response return $response; } - /** - * @return SegmentsOfCustomerHandler - */ protected function getHandler(): SegmentsOfCustomerHandler { return \Pimcore::getContainer()->get('cmf.rest.segments_of_customer_handler'); diff --git a/src/CustomReport/Adapter/TermSegmentBuilder.php b/src/CustomReport/Adapter/TermSegmentBuilder.php index 9a6d7578..3ecd6e41 100644 --- a/src/CustomReport/Adapter/TermSegmentBuilder.php +++ b/src/CustomReport/Adapter/TermSegmentBuilder.php @@ -108,8 +108,9 @@ protected function getBaseQuery( switch ($operator) { case 'like': $condition[] = $db->quoteIdentifier($filter['property']).' LIKE '.$db->quote( - '%'.$value.'%' - ); + '%'.$value.'%' + ); + break; case 'lt': case 'gt': @@ -122,11 +123,13 @@ protected function getBaseQuery( ]; $condition[] = $db->quoteIdentifier( - $filter['property'] - ).' '.$compMapping[$operator].' '.$db->quote($value); + $filter['property'] + ).' '.$compMapping[$operator].' '.$db->quote($value); + break; case '=': $condition[] = $db->quoteIdentifier($filter['property']).' = '.$db->quote($value); + break; } } diff --git a/src/CustomerDuplicatesService/CustomerDuplicatesServiceInterface.php b/src/CustomerDuplicatesService/CustomerDuplicatesServiceInterface.php index 0e28825a..3bd7454e 100644 --- a/src/CustomerDuplicatesService/CustomerDuplicatesServiceInterface.php +++ b/src/CustomerDuplicatesService/CustomerDuplicatesServiceInterface.php @@ -23,7 +23,6 @@ interface CustomerDuplicatesServiceInterface * Returns a list of duplicates for the given customer. * Which fields should be used for matching duplicates could be defined in the config of the CMF plugin. * - * @param CustomerInterface $customer * @param int $limit * * @return \Pimcore\Model\DataObject\Listing\Concrete|null @@ -33,8 +32,6 @@ public function getDuplicatesOfCustomer(CustomerInterface $customer, $limit = 0) /** * Returns a list of duplicates for the given customer. Duplicates are matched by the fields given in $fields. * - * @param CustomerInterface $customer - * @param array $fields * @param int $limit * * @return \Pimcore\Model\DataObject\Listing\Concrete|null @@ -44,7 +41,6 @@ public function getDuplicatesOfCustomerByFields(CustomerInterface $customer, arr /** * Returns a list of duplicates/customers which are matching the given data. * - * @param array $data * @param int $limit * * @return \Pimcore\Model\DataObject\Listing\Concrete|null @@ -61,7 +57,6 @@ public function getMatchedDuplicateFields(); /** * Update the duplicate index for the given customer. * - * @param CustomerInterface $customer * * @return void */ diff --git a/src/CustomerDuplicatesService/DefaultCustomerDuplicatesService.php b/src/CustomerDuplicatesService/DefaultCustomerDuplicatesService.php index 6c2be6ae..7ab3d2d6 100644 --- a/src/CustomerDuplicatesService/DefaultCustomerDuplicatesService.php +++ b/src/CustomerDuplicatesService/DefaultCustomerDuplicatesService.php @@ -49,7 +49,6 @@ public function __construct(array $duplicateCheckFields = [], array $duplicateCh * Returns a list of duplicates for the given customer. * Which fields should be used for matching duplicates could be defined in the config of the CMF plugin. * - * @param CustomerInterface $customer * @param int $limit * * @return \Pimcore\Model\DataObject\Listing\Concrete|null @@ -75,7 +74,6 @@ public function getDuplicatesOfCustomer(CustomerInterface $customer, $limit = 0) * Returns a list of duplicates/customers which are matching the given data. * Which fields should be used for matching duplicates could be defined in the config of the CMF plugin. * - * @param array $data * @param int $limit * * @return \Pimcore\Model\DataObject\Listing\Concrete|null @@ -116,8 +114,6 @@ public function getDuplicatesByData(array $data, $limit = 0) /** * Returns a list of duplicates for the given customer. Duplicates are matched by the fields given in $fields. * - * @param CustomerInterface $customer - * @param array $fields * @param int $limit * * @return \Pimcore\Model\DataObject\Listing\Concrete|null @@ -167,7 +163,6 @@ public function getMatchedDuplicateFields() /** * Update the duplicate index for the given customer. * - * @param CustomerInterface $customer * * @return void */ @@ -178,7 +173,6 @@ public function updateDuplicateIndexForCustomer(CustomerInterface $customer) } /** - * @param Concrete $list * @param string $field * @param mixed $value * @@ -221,13 +215,13 @@ protected function addNormalizedMysqlCompareCondition(Concrete &$list, $field, $ } $type = gettype($value) == 'object' ? get_class($value) : gettype($value); + throw new \Exception( sprintf('duplicate check for type of field %s not implemented (type of value: %s)', $field, $type) ); } /** - * @param Concrete $list * @param string $field * @param string $value */ @@ -242,7 +236,6 @@ protected function addNormalizedMysqlCompareConditionForStringFields(Concrete &$ } /** - * @param Concrete $list * @param string $field * @param \DateTime $value */ @@ -252,7 +245,6 @@ protected function addNormalizedMysqlCompareConditionForDateFields(Concrete &$li } /** - * @param Concrete $list * @param string $field * @param ElementInterface $value */ @@ -262,7 +254,6 @@ protected function addNormalizedMysqlCompareConditionForSingleRelationFields(Con } /** - * @param Concrete $list * @param string $field * @param ElementInterface[] $value */ diff --git a/src/CustomerDuplicatesView/CustomerDuplicatesViewInterface.php b/src/CustomerDuplicatesView/CustomerDuplicatesViewInterface.php index c5b6c482..b3d8d2fd 100644 --- a/src/CustomerDuplicatesView/CustomerDuplicatesViewInterface.php +++ b/src/CustomerDuplicatesView/CustomerDuplicatesViewInterface.php @@ -26,7 +26,6 @@ interface CustomerDuplicatesViewInterface public function getViewFormatter(); /** - * @param CustomerInterface $customer * * @return array */ diff --git a/src/CustomerDuplicatesView/DefaultCustomerDuplicatesView.php b/src/CustomerDuplicatesView/DefaultCustomerDuplicatesView.php index 4df63dcd..30fe2aa4 100644 --- a/src/CustomerDuplicatesView/DefaultCustomerDuplicatesView.php +++ b/src/CustomerDuplicatesView/DefaultCustomerDuplicatesView.php @@ -31,9 +31,6 @@ class DefaultCustomerDuplicatesView implements CustomerDuplicatesViewInterface */ protected $viewFormatter; - /** - * @param ViewFormatterInterface $viewFormatter - */ public function __construct(array $listFields, ViewFormatterInterface $viewFormatter) { $this->listFields = $listFields; diff --git a/src/CustomerList/Exporter/AbstractExporter.php b/src/CustomerList/Exporter/AbstractExporter.php index 9e364996..3da417dc 100644 --- a/src/CustomerList/Exporter/AbstractExporter.php +++ b/src/CustomerList/Exporter/AbstractExporter.php @@ -52,12 +52,13 @@ abstract class AbstractExporter implements ExporterInterface protected $segmentColumnOrder = []; const COLUMNS = 'columns'; + const ROWS = 'rows'; + const SEGMENT_IDS = 'segmentIds'; /** * @param string $name - * @param array $properties * @param bool $exportSegmentsAsColumns */ public function __construct($name, array $properties, $exportSegmentsAsColumns) @@ -91,9 +92,6 @@ public function getProperties() return $this->properties; } - /** - * @param array $properties - */ public function setProperties(array $properties) { $this->properties = $properties; @@ -107,9 +105,6 @@ public function getListing() return $this->listing; } - /** - * @param Concrete $listing - */ public function setListing(Concrete $listing) { $this->listing = $listing; @@ -157,7 +152,7 @@ public function getExportData() return [ self::ROWS => $rows, - self::SEGMENT_IDS => array_unique($allSegmentIds) + self::SEGMENT_IDS => array_unique($allSegmentIds), ]; } @@ -178,7 +173,6 @@ public function setExportSegmentsAsColumns($exportSegmentsAsColumns) } /** - * @param array $exportData * * @return array */ @@ -221,7 +215,6 @@ protected function getHeaderTitles(array $exportData) } /** - * @param array $exportData * * @return array */ diff --git a/src/CustomerList/Exporter/Csv.php b/src/CustomerList/Exporter/Csv.php index 19ef9bce..f6c82378 100644 --- a/src/CustomerList/Exporter/Csv.php +++ b/src/CustomerList/Exporter/Csv.php @@ -85,7 +85,6 @@ protected function render(array $exportData) } /** - * @param array $exportData * * @return $this */ @@ -99,7 +98,6 @@ protected function renderHeader(array $exportData) } /** - * @param array $row * * @return $this */ diff --git a/src/CustomerList/Exporter/ExporterInterface.php b/src/CustomerList/Exporter/ExporterInterface.php index 62dd0978..88cfac25 100644 --- a/src/CustomerList/Exporter/ExporterInterface.php +++ b/src/CustomerList/Exporter/ExporterInterface.php @@ -34,9 +34,6 @@ public function setName($name); */ public function getProperties(); - /** - * @param array $properties - */ public function setProperties(array $properties); /** @@ -44,9 +41,6 @@ public function setProperties(array $properties); */ public function getListing(); - /** - * @param Concrete $listing - */ public function setListing(Concrete $listing); /** @@ -80,7 +74,6 @@ public function getExportData(); /** * Generates the export file from given export data. * - * @param array $exportData * * @return mixed */ diff --git a/src/CustomerList/Exporter/Xlsx.php b/src/CustomerList/Exporter/Xlsx.php index 3ae02ee0..7a8f5ed3 100644 --- a/src/CustomerList/Exporter/Xlsx.php +++ b/src/CustomerList/Exporter/Xlsx.php @@ -102,7 +102,6 @@ protected function render(array $exportData) } /** - * @param array $exportData * * @return $this */ @@ -119,7 +118,6 @@ protected function renderHeader(array $exportData) } /** - * @param array $row * * @return $this */ diff --git a/src/CustomerList/ExporterManager.php b/src/CustomerList/ExporterManager.php index 3448c529..9d35f76a 100644 --- a/src/CustomerList/ExporterManager.php +++ b/src/CustomerList/ExporterManager.php @@ -48,7 +48,6 @@ public function hasExporter($key) /** * @param string $key - * @param Listing\Concrete|null $listing * * @return ExporterInterface */ @@ -72,7 +71,6 @@ public function buildExporter($key, Listing\Concrete $listing = null) } /** - * @param Request $request * * @return array * @@ -95,7 +93,6 @@ public function getExportTmpData(Request $request) /** * @param string $jobId - * @param array $data */ public function saveExportTmpData($jobId, array $data) { diff --git a/src/CustomerList/ExporterManagerInterface.php b/src/CustomerList/ExporterManagerInterface.php index dfe86573..301e6422 100644 --- a/src/CustomerList/ExporterManagerInterface.php +++ b/src/CustomerList/ExporterManagerInterface.php @@ -35,14 +35,12 @@ public function hasExporter($key); /** * @param string $key - * @param Listing\Concrete|null $listing * * @return ExporterInterface */ public function buildExporter($key, Listing\Concrete $listing = null); /** - * @param Request $request * * @return array * @@ -52,7 +50,6 @@ public function getExportTmpData(Request $request); /** * @param string $jobId - * @param array $data * * @return void */ diff --git a/src/CustomerList/Filter/CustomerSegment.php b/src/CustomerList/Filter/CustomerSegment.php index 7a0ce9e3..3bf9fcad 100644 --- a/src/CustomerList/Filter/CustomerSegment.php +++ b/src/CustomerList/Filter/CustomerSegment.php @@ -63,7 +63,6 @@ class CustomerSegment extends AbstractFilter implements OnCreateQueryFilterInter /** * @param DataObject\CustomerSegment[] $segments - * @param DataObject\CustomerSegmentGroup|null $segmentGroup * @param string $type */ public function __construct(array $segments, DataObject\CustomerSegmentGroup $segmentGroup = null, $type = self::OPERATOR_AND) @@ -86,7 +85,6 @@ public function getRelationNames() } /** - * @param array $relationNames * * @return $this */ @@ -101,7 +99,6 @@ public function setRelationNames(array $relationNames) * Build an unique identifier for this filter which acts as join name. Needed in case multiple segment filters for the * same segment group are applied. * - * @param DataObject\CustomerSegmentGroup $segmentGroup * * @return string */ @@ -115,7 +112,6 @@ protected function buildIdentifier(DataObject\CustomerSegmentGroup $segmentGroup } /** - * @param DataObject\CustomerSegment $segment * * @return $this */ @@ -148,8 +144,6 @@ public function applyOnCreateQuery(CoreListing\Concrete $listing, QueryBuilder $ /** * Add a single join with a IN() conditions. If any of the segment IDs matches, the row will be returned * - * @param CoreListing\Concrete $listing - * @param QueryBuilder $queryBuilder */ protected function applyOrQuery(CoreListing\Concrete $listing, QueryBuilder $queryBuilder) { @@ -172,8 +166,6 @@ function (DataObject\CustomerSegment $segment) { /** * Add one join per ID we want to search. If any of the joins does not match, the query will fail * - * @param CoreListing\Concrete $listing - * @param QueryBuilder $queryBuilder */ protected function applyAndQuery(CoreListing\Concrete $listing, QueryBuilder $queryBuilder) { @@ -193,8 +185,6 @@ protected function applyAndQuery(CoreListing\Concrete $listing, QueryBuilder $qu /** * Add the actual INNER JOIN acting as filter * - * @param CoreListing\Concrete $listing - * @param QueryBuilder $queryBuilder * @param string $joinName * @param int|array $conditionValue */ diff --git a/src/CustomerList/Filter/SearchQuery.php b/src/CustomerList/Filter/SearchQuery.php index 1fbc6d9a..07e5e525 100644 --- a/src/CustomerList/Filter/SearchQuery.php +++ b/src/CustomerList/Filter/SearchQuery.php @@ -43,7 +43,6 @@ class SearchQuery extends AbstractFilter implements OnCreateQueryFilterInterface protected $query; /** - * @param array $fields * @param string $query */ public function __construct(array $fields, $query) @@ -68,7 +67,7 @@ public function applyOnCreateQuery(CoreListing\Concrete $listing, QueryBuilder $ $parserQueryBuilder = new Doctrine( $this->fields, [ - 'stripWildcards' => false // allow LIKE wildcards + 'stripWildcards' => false, // allow LIKE wildcards ] ); @@ -91,7 +90,6 @@ protected function parseQuery($queryString) } /** - * @param \Exception $e * * @throws SearchQueryException */ diff --git a/src/CustomerList/SearchHelper.php b/src/CustomerList/SearchHelper.php index f40a4e11..e08715bc 100644 --- a/src/CustomerList/SearchHelper.php +++ b/src/CustomerList/SearchHelper.php @@ -29,13 +29,12 @@ class SearchHelper { private $segmentManager; + private $customerProvider; /** * SearchHelper constructor. * - * @param SegmentManagerInterface $segmentManager - * @param CustomerProviderInterface $customerProvider */ public function __construct(SegmentManagerInterface $segmentManager, CustomerProviderInterface $customerProvider) { @@ -46,7 +45,6 @@ public function __construct(SegmentManagerInterface $segmentManager, CustomerPro /** * Fetch segment manager * - * @return SegmentManagerInterface */ public function getSegmentManager(): SegmentManagerInterface { @@ -56,7 +54,6 @@ public function getSegmentManager(): SegmentManagerInterface /** * Fetch the CustomerProvider * - * @return CustomerProviderInterface */ public function getCustomerProvider(): CustomerProviderInterface { @@ -84,9 +81,6 @@ public function getConfiguredSearchBarFields() } /** - * @param Concrete $listing - * @param array $filters - * @param User $adminUser * * @throws \Exception */ diff --git a/src/CustomerMerger/CustomerMergerInterface.php b/src/CustomerMerger/CustomerMergerInterface.php index a1b0b3bc..b0988ab2 100644 --- a/src/CustomerMerger/CustomerMergerInterface.php +++ b/src/CustomerMerger/CustomerMergerInterface.php @@ -23,8 +23,6 @@ interface CustomerMergerInterface * Adds all values from source customer to target customer and returns merged target customer instance. * Afterwards the source customer will be set to inactive and unpublished. * - * @param CustomerInterface $sourceCustomer - * @param CustomerInterface $targetCustomer * @param bool $mergeAttributes * * @return CustomerInterface diff --git a/src/CustomerMerger/DefaultCustomerMerger.php b/src/CustomerMerger/DefaultCustomerMerger.php index a25dfde3..d1343379 100644 --- a/src/CustomerMerger/DefaultCustomerMerger.php +++ b/src/CustomerMerger/DefaultCustomerMerger.php @@ -41,8 +41,6 @@ public function __construct(CustomerSaveManagerInterface $customerSaveManager) * Adds all values from source customer to target customer and returns merged target customer instance. * Afterwards the source customer will be set to inactive and unpublished. * - * @param CustomerInterface $sourceCustomer - * @param CustomerInterface $targetCustomer * @param bool $mergeAttributes * * @return CustomerInterface @@ -98,8 +96,6 @@ public function mergeCustomers( } /** - * @param CustomerInterface $sourceCustomer - * @param CustomerInterface $targetCustomer * @param bool $mergeAttributes */ private function mergeCustomerValues( @@ -133,10 +129,6 @@ private function mergeCustomerValues( } } - /** - * @param CustomerInterface $sourceCustomer - * @param CustomerInterface $targetCustomer - */ private function mergeActivities(CustomerInterface $sourceCustomer, CustomerInterface $targetCustomer) { $list = \Pimcore::getContainer()->get('cmf.activity_store')->getActivityList(); diff --git a/src/CustomerProvider/CustomerProviderInterface.php b/src/CustomerProvider/CustomerProviderInterface.php index 5ffb2274..ce95fb33 100644 --- a/src/CustomerProvider/CustomerProviderInterface.php +++ b/src/CustomerProvider/CustomerProviderInterface.php @@ -43,7 +43,6 @@ public function getList(); /** * Create a published customer instance and sets it's values from given data * - * @param array $data * * @return CustomerInterface */ @@ -59,8 +58,6 @@ public function createCustomerInstance(); /** * Update a customer instance * - * @param CustomerInterface $customer - * @param array $data * * @return CustomerInterface */ @@ -69,7 +66,6 @@ public function update(CustomerInterface $customer, array $data = []); /** * Delete a customer instance * - * @param CustomerInterface $customer * * @return $this */ @@ -99,7 +95,6 @@ public function getActiveCustomerByEmail($email); /** * Sets the correct parent folder and object key for the given customer. * - * @param CustomerInterface $customer * * @return void */ diff --git a/src/CustomerProvider/DefaultCustomerProvider.php b/src/CustomerProvider/DefaultCustomerProvider.php index 8c3514ce..dcb5886d 100644 --- a/src/CustomerProvider/DefaultCustomerProvider.php +++ b/src/CustomerProvider/DefaultCustomerProvider.php @@ -58,7 +58,6 @@ class DefaultCustomerProvider implements CustomerProviderInterface * * @param string $pimcoreClass * @param string $parentPath - * @param ObjectNamingSchemeInterface $namingScheme */ public function __construct($pimcoreClass, $parentPath, ObjectNamingSchemeInterface $namingScheme, Factory $modelFactory) { @@ -151,7 +150,6 @@ public function getList() /** * Create a customer instance * - * @param array $data * * @return CustomerInterface */ @@ -181,8 +179,6 @@ public function createCustomerInstance() } /** - * @param CustomerInterface $customer - * @param array $data * * @return CustomerInterface */ @@ -195,7 +191,6 @@ public function update(CustomerInterface $customer, array $data = []) } /** - * @param CustomerInterface $customer * * @return $this */ @@ -252,7 +247,6 @@ public function getActiveCustomerByEmail($email) /** * Sets the correct parent folder and object key for the given customer. * - * @param CustomerInterface $customer * * @return void */ @@ -289,7 +283,6 @@ public function setParentPath($parentPath) /** * @param string $method - * @param array $arguments * * @return mixed */ diff --git a/src/CustomerProvider/ObjectNamingScheme/DefaultObjectNamingScheme.php b/src/CustomerProvider/ObjectNamingScheme/DefaultObjectNamingScheme.php index 56e9838c..0087451b 100644 --- a/src/CustomerProvider/ObjectNamingScheme/DefaultObjectNamingScheme.php +++ b/src/CustomerProvider/ObjectNamingScheme/DefaultObjectNamingScheme.php @@ -115,7 +115,7 @@ public function cleanupEmptyFolders() [ str_replace('//', '/', $this->parentPath.'/%'), str_replace('//', '/', $archiveDir .'/%'), - $timestamp + $timestamp, ] ); @@ -128,7 +128,6 @@ public function cleanupEmptyFolders() } /** - * @param CustomerInterface $customer * * @return string */ @@ -143,7 +142,6 @@ private function correctPath($path) } /** - * @param CustomerInterface $customer * @param string $namingScheme * * @return array diff --git a/src/CustomerProvider/ObjectNamingScheme/ObjectNamingSchemeInterface.php b/src/CustomerProvider/ObjectNamingScheme/ObjectNamingSchemeInterface.php index 2292382b..0e44e459 100644 --- a/src/CustomerProvider/ObjectNamingScheme/ObjectNamingSchemeInterface.php +++ b/src/CustomerProvider/ObjectNamingScheme/ObjectNamingSchemeInterface.php @@ -20,7 +20,6 @@ interface ObjectNamingSchemeInterface { /** - * @param CustomerInterface $customer * * @return void */ diff --git a/src/CustomerSaveHandler/AbstractCustomerSaveHandler.php b/src/CustomerSaveHandler/AbstractCustomerSaveHandler.php index ba3caec3..604d0960 100644 --- a/src/CustomerSaveHandler/AbstractCustomerSaveHandler.php +++ b/src/CustomerSaveHandler/AbstractCustomerSaveHandler.php @@ -58,7 +58,6 @@ public function getOriginalCustomer() /** * setter for the originalCustomer property * - * @param CustomerInterface|null $originalCustomer * * @return void */ @@ -70,7 +69,6 @@ public function setOriginalCustomer(CustomerInterface $originalCustomer = null) /** * called in preAdd and preUpdate hook of customer objects * - * @param CustomerInterface $customer * * @return void */ @@ -81,7 +79,6 @@ public function preSave(CustomerInterface $customer) /** * called in postAdd and postUpdate hook of customer objects * - * @param CustomerInterface $customer * * @return void */ @@ -92,7 +89,6 @@ public function postSave(CustomerInterface $customer) /** * called in preAdd hook of customer objects * - * @param CustomerInterface $customer * * @return void */ @@ -103,7 +99,6 @@ public function preAdd(CustomerInterface $customer) /** * called in postAdd hook of customer objects * - * @param CustomerInterface $customer * * @return void */ @@ -114,7 +109,6 @@ public function postAdd(CustomerInterface $customer) /** * called in preUpdate hook of customer objects * - * @param CustomerInterface $customer * * @return void */ @@ -125,7 +119,6 @@ public function preUpdate(CustomerInterface $customer) /** * called in postUpdate hook of customer objects * - * @param CustomerInterface $customer * * @return void */ @@ -136,7 +129,6 @@ public function postUpdate(CustomerInterface $customer) /** * called in preDelete hook of customer objects * - * @param CustomerInterface $customer * * @return void */ @@ -147,7 +139,6 @@ public function preDelete(CustomerInterface $customer) /** * called in postDelete hook of customer objects * - * @param CustomerInterface $customer * * @return void */ diff --git a/src/CustomerSaveHandler/AttributeLogic.php b/src/CustomerSaveHandler/AttributeLogic.php index c75169c3..42474afd 100644 --- a/src/CustomerSaveHandler/AttributeLogic.php +++ b/src/CustomerSaveHandler/AttributeLogic.php @@ -57,16 +57,12 @@ public function __construct(... $fieldMapping) $this->fieldMapping = $fieldMapping; } - /** - * @inheritdoc - */ public function isOriginalCustomerNeeded() { return true; } /** - * @param CustomerInterface $customer * * @return void */ @@ -88,7 +84,6 @@ public function preSave(CustomerInterface $customer) } /** - * @param CustomerInterface $customer * @param string $from * @param string $to * @param bool $overwriteIfNotEmpty @@ -124,7 +119,6 @@ protected function checkIfOverwriteIsNeeded(CustomerInterface $customer, $from, } /** - * @param CustomerInterface $customer * @param string $from * @param string $to */ diff --git a/src/CustomerSaveHandler/Cleanup/Email.php b/src/CustomerSaveHandler/Cleanup/Email.php index 56374966..0b0f0677 100644 --- a/src/CustomerSaveHandler/Cleanup/Email.php +++ b/src/CustomerSaveHandler/Cleanup/Email.php @@ -37,7 +37,6 @@ public function __construct($emailField = 'email') } /** - * @param CustomerInterface $customer * * @return void */ diff --git a/src/CustomerSaveHandler/CustomerSaveHandlerInterface.php b/src/CustomerSaveHandler/CustomerSaveHandlerInterface.php index 62bfb9bf..0f2b0336 100644 --- a/src/CustomerSaveHandler/CustomerSaveHandlerInterface.php +++ b/src/CustomerSaveHandler/CustomerSaveHandlerInterface.php @@ -37,7 +37,6 @@ public function getOriginalCustomer(); /** * Setter for the originalCustomer property * - * @param CustomerInterface|null $originalCustomer * * @return void */ @@ -46,7 +45,6 @@ public function setOriginalCustomer(CustomerInterface $originalCustomer = null); /** * Called in preAdd and preUpdate hook of customer objects * - * @param CustomerInterface $customer * * @return void */ @@ -55,7 +53,6 @@ public function preSave(CustomerInterface $customer); /** * Called in postAdd and postUpdate hook of customer objects * - * @param CustomerInterface $customer * * @return void */ @@ -64,7 +61,6 @@ public function postSave(CustomerInterface $customer); /** * Called in preAdd hook of customer objects * - * @param CustomerInterface $customer * * @return void */ @@ -73,7 +69,6 @@ public function preAdd(CustomerInterface $customer); /** * Called in postAdd hook of customer objects * - * @param CustomerInterface $customer * * @return void */ @@ -82,7 +77,6 @@ public function postAdd(CustomerInterface $customer); /** * Called in preUpdate hook of customer objects * - * @param CustomerInterface $customer * * @return void */ @@ -91,7 +85,6 @@ public function preUpdate(CustomerInterface $customer); /** * Called in postUpdate hook of customer objects * - * @param CustomerInterface $customer * * @return void */ @@ -100,7 +93,6 @@ public function postUpdate(CustomerInterface $customer); /** * Called in preDelete hook of customer objects * - * @param CustomerInterface $customer * * @return void */ @@ -109,7 +101,6 @@ public function preDelete(CustomerInterface $customer); /** * Called in postDelete hook of customer objects * - * @param CustomerInterface $customer * * @return void */ diff --git a/src/CustomerSaveHandler/MarkEmailAddressAsValid.php b/src/CustomerSaveHandler/MarkEmailAddressAsValid.php index 36ff7239..01a89fde 100644 --- a/src/CustomerSaveHandler/MarkEmailAddressAsValid.php +++ b/src/CustomerSaveHandler/MarkEmailAddressAsValid.php @@ -36,7 +36,6 @@ public function __construct($markValidField = 'emailOk') } /** - * @param CustomerInterface $customer * * @return void */ diff --git a/src/CustomerSaveHandler/NormalizeZip.php b/src/CustomerSaveHandler/NormalizeZip.php index 4ea02ad7..423d182b 100644 --- a/src/CustomerSaveHandler/NormalizeZip.php +++ b/src/CustomerSaveHandler/NormalizeZip.php @@ -47,7 +47,6 @@ public function __construct(array $countryTransformers = []) } /** - * @param CustomerInterface $customer * * @return void */ diff --git a/src/CustomerSaveHandler/RemoveBlacklistedEmails.php b/src/CustomerSaveHandler/RemoveBlacklistedEmails.php index f3f2582d..6aed589e 100644 --- a/src/CustomerSaveHandler/RemoveBlacklistedEmails.php +++ b/src/CustomerSaveHandler/RemoveBlacklistedEmails.php @@ -25,7 +25,6 @@ class RemoveBlacklistedEmails extends AbstractCustomerSaveHandler { /** - * @param CustomerInterface $customer * * @return void */ diff --git a/src/CustomerSaveHandler/SalutationToGender.php b/src/CustomerSaveHandler/SalutationToGender.php index fde7410c..d8991f86 100644 --- a/src/CustomerSaveHandler/SalutationToGender.php +++ b/src/CustomerSaveHandler/SalutationToGender.php @@ -41,7 +41,6 @@ public function __construct($salutationField = 'salutation', $genderMap = ['mr' } /** - * @param CustomerInterface $customer * * @return void */ diff --git a/src/CustomerSaveManager/CustomerSaveManagerInterface.php b/src/CustomerSaveManager/CustomerSaveManagerInterface.php index 4d2cfc00..0e8e76e6 100644 --- a/src/CustomerSaveManager/CustomerSaveManagerInterface.php +++ b/src/CustomerSaveManager/CustomerSaveManagerInterface.php @@ -21,49 +21,42 @@ interface CustomerSaveManagerInterface { /** - * @param CustomerInterface $customer * * @return void */ public function preAdd(CustomerInterface $customer); /** - * @param CustomerInterface $customer * * @return void */ public function postAdd(CustomerInterface $customer); /** - * @param CustomerInterface $customer * * @return void */ public function preUpdate(CustomerInterface $customer); /** - * @param CustomerInterface $customer * * @return void */ public function postUpdate(CustomerInterface $customer); /** - * @param CustomerInterface $customer * * @return void */ public function preDelete(CustomerInterface $customer); /** - * @param CustomerInterface $customer * * @return void */ public function postDelete(CustomerInterface $customer); /** - * @param CustomerInterface $customer * @param bool $withDuplicatesCheck * * @return bool @@ -82,14 +75,9 @@ public function getDefaultSaveOptions(); */ public function getSaveOptions($clone = false); - /** - * @param SaveOptions $saveOptions - */ public function setSaveOptions(SaveOptions $saveOptions); /** - * @param CustomerInterface $customer - * @param SaveOptions $options * @param bool $disableVersions * * @return mixed @@ -99,7 +87,6 @@ public function saveWithOptions(CustomerInterface $customer, SaveOptions $option /** * Dirty / quick save customer w/o invoking any hooks, save-handlers, version and alike * - * @param CustomerInterface $customer * * @return mixed */ @@ -116,7 +103,6 @@ public function getSaveHandlers(); public function setSaveHandlers(array $saveHandlers); /** - * @param CustomerSaveHandlerInterface $saveHandler * * @return void */ diff --git a/src/CustomerSaveManager/DefaultCustomerSaveManager.php b/src/CustomerSaveManager/DefaultCustomerSaveManager.php index 687888a8..8008a4f8 100644 --- a/src/CustomerSaveManager/DefaultCustomerSaveManager.php +++ b/src/CustomerSaveManager/DefaultCustomerSaveManager.php @@ -113,6 +113,7 @@ protected function rememberOriginalCustomer(CustomerInterface $customer) foreach ($this->getSaveHandlers() as $saveHandler) { if ($saveHandler->isOriginalCustomerNeeded()) { $originalCustomerNeeded = true; + break; } } @@ -260,7 +261,6 @@ public function validateOnSave(CustomerInterface $customer, $withDuplicatesCheck } /** - * @param CustomerInterface $customer * @param string $operation */ protected function handleNewsletterQueue(CustomerInterface $customer, $operation) @@ -327,7 +327,6 @@ protected function applySaveHandlers(CustomerInterface $customer, $saveHandlerMe /** * @param CustomerSaveHandlerInterface[] $saveHandlers - * @param CustomerInterface $customer */ protected function reinitSaveHandlers(array $saveHandlers, CustomerInterface $customer) { @@ -341,7 +340,6 @@ protected function reinitSaveHandlers(array $saveHandlers, CustomerInterface $cu } /** - * @param CustomerInterface $customer * * @return mixed */ @@ -382,8 +380,6 @@ protected function createDirtyOptions() } /** - * @param CustomerInterface $customer - * @param SaveOptions $options * @param bool $disableVersions * * @return mixed @@ -441,7 +437,6 @@ public function getDefaultSaveOptions() /** * Restore options * - * @param SaveOptions $options */ protected function applySaveOptions(SaveOptions $options) { diff --git a/src/CustomerSaveManager/LegacyTrait.php b/src/CustomerSaveManager/LegacyTrait.php index b991272d..59519508 100644 --- a/src/CustomerSaveManager/LegacyTrait.php +++ b/src/CustomerSaveManager/LegacyTrait.php @@ -205,7 +205,6 @@ public function setDisableQueue($disableQueue) } /** - * @param CustomerInterface $customer * @param bool $disableVersions * * @return mixed diff --git a/src/CustomerSaveValidator/CustomerSaveValidatorInterface.php b/src/CustomerSaveValidator/CustomerSaveValidatorInterface.php index 0a9dd1d4..7843d694 100644 --- a/src/CustomerSaveValidator/CustomerSaveValidatorInterface.php +++ b/src/CustomerSaveValidator/CustomerSaveValidatorInterface.php @@ -28,7 +28,6 @@ interface CustomerSaveValidatorInterface { /** - * @param CustomerInterface $customer * * @return bool * diff --git a/src/CustomerSaveValidator/DefaultCustomerSaveValidator.php b/src/CustomerSaveValidator/DefaultCustomerSaveValidator.php index 623d9bbc..51ae4bf2 100644 --- a/src/CustomerSaveValidator/DefaultCustomerSaveValidator.php +++ b/src/CustomerSaveValidator/DefaultCustomerSaveValidator.php @@ -34,7 +34,6 @@ class DefaultCustomerSaveValidator implements CustomerSaveValidatorInterface /** * DefaultCustomerSaveValidator constructor. * - * @param array $requiredFields * @param bool $checkForDuplicates */ public function __construct(array $requiredFields, $checkForDuplicates) @@ -44,7 +43,6 @@ public function __construct(array $requiredFields, $checkForDuplicates) } /** - * @param CustomerInterface $customer * @param bool $withDuplicatesCheck * * @return bool @@ -65,7 +63,6 @@ public function validate(CustomerInterface $customer, $withDuplicatesCheck = tru } /** - * @param CustomerInterface $customer * * @return bool * @@ -109,7 +106,6 @@ protected function validateRequiredFields(CustomerInterface $customer) } /** - * @param CustomerInterface $customer * * @return bool * @@ -137,7 +133,6 @@ protected function validateDuplicates(CustomerInterface $customer) } /** - * @param CustomerInterface $customer * @param string $field * @param bool $throwException * diff --git a/src/CustomerView/CustomerViewInterface.php b/src/CustomerView/CustomerViewInterface.php index 17dd3fd9..125a24ca 100644 --- a/src/CustomerView/CustomerViewInterface.php +++ b/src/CustomerView/CustomerViewInterface.php @@ -27,7 +27,6 @@ interface CustomerViewInterface extends TranslatorInterface public function getViewFormatter(); /** - * @param CustomerInterface $customer * * @return string|null */ @@ -56,21 +55,18 @@ public function getSegmentsFilterTemplate(); /** * Determines if customer has a detail view or if pimcore object should be openend directly * - * @param CustomerInterface $customer * * @return bool */ public function hasDetailView(CustomerInterface $customer); /** - * @param CustomerInterface $customer * * @return string|null */ public function getDetailviewTemplate(CustomerInterface $customer); /** - * @param CustomerInterface $customer * * @return array */ diff --git a/src/CustomerView/DefaultCustomerView.php b/src/CustomerView/DefaultCustomerView.php index 8f3bdd88..ae23ec44 100644 --- a/src/CustomerView/DefaultCustomerView.php +++ b/src/CustomerView/DefaultCustomerView.php @@ -26,9 +26,6 @@ class DefaultCustomerView implements CustomerViewInterface */ protected $viewFormatter; - /** - * @param ViewFormatterInterface $viewFormatter - */ public function __construct(ViewFormatterInterface $viewFormatter) { $this->viewFormatter = $viewFormatter; @@ -43,7 +40,6 @@ public function getViewFormatter() } /** - * @param CustomerInterface $customer * * @return string|null */ @@ -78,7 +74,6 @@ public function getSegmentsFilterTemplate() /** * Determines if customer has a detail view or if pimcore object should be openend directly * - * @param CustomerInterface $customer * * @return bool */ @@ -88,7 +83,6 @@ public function hasDetailView(CustomerInterface $customer) } /** - * @param CustomerInterface $customer * * @return string|null */ @@ -98,7 +92,6 @@ public function getDetailviewTemplate(CustomerInterface $customer) } /** - * @param CustomerInterface $customer * * @return array */ @@ -139,9 +132,6 @@ protected function wrapObject($object) return new ObjectWrapper($object); } - /** - * @inheritDoc - */ public function translate($messageId, $parameters = []) { return $this->viewFormatter->translate($messageId, $parameters); diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index ed200e55..18068dff 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -243,7 +243,7 @@ private function buildCustomerListNode() 'countryCode', 'idEncoded', ], - 'exportSegmentsAsColumns' => true + 'exportSegmentsAsColumns' => true, ], 'xlsx' => [ @@ -264,7 +264,7 @@ private function buildCustomerListNode() 'countryCode', 'idEncoded', ], - 'exportSegmentsAsColumns' => true + 'exportSegmentsAsColumns' => true, ], ]; @@ -275,13 +275,13 @@ private function buildCustomerListNode() $defaultFilterPropertiesSearch = [ 'email' => [ - 'email' + 'email', ], 'firstname' => [ - 'firstname' + 'firstname', ], 'lastname' => [ - 'lastname' + 'lastname', ], 'search' => [ Service::getVersionDependentDatabaseColumnName('id'), @@ -290,8 +290,8 @@ private function buildCustomerListNode() 'lastname', 'email', 'zip', - 'city' - ] + 'city', + ], ]; $customerList @@ -346,7 +346,7 @@ private function buildCustomerDuplicatesServicesNode() ['email'], ['firstname', 'lastname'], ['street'], - ['zip', 'city'] + ['zip', 'city'], ]; $customerList diff --git a/src/DependencyInjection/PimcoreCustomerManagementFrameworkExtension.php b/src/DependencyInjection/PimcoreCustomerManagementFrameworkExtension.php index 9aacf391..6438c59a 100644 --- a/src/DependencyInjection/PimcoreCustomerManagementFrameworkExtension.php +++ b/src/DependencyInjection/PimcoreCustomerManagementFrameworkExtension.php @@ -34,9 +34,6 @@ class PimcoreCustomerManagementFrameworkExtension extends ConfigurableExtension implements PrependExtensionInterface { - /** - * @param ContainerBuilder $container - */ public function prepend(ContainerBuilder $container) { $loader = new YamlFileLoader( diff --git a/src/DuplicatesIndex/DefaultMariaDbDuplicatesIndex.php b/src/DuplicatesIndex/DefaultMariaDbDuplicatesIndex.php index f1bc3b83..d9eb73c5 100644 --- a/src/DuplicatesIndex/DefaultMariaDbDuplicatesIndex.php +++ b/src/DuplicatesIndex/DefaultMariaDbDuplicatesIndex.php @@ -21,6 +21,7 @@ use CustomerManagementFrameworkBundle\Factory; use CustomerManagementFrameworkBundle\Model\CustomerInterface; use CustomerManagementFrameworkBundle\Traits\LoggerAware; +use Knp\Bundle\PaginatorBundle\Pagination\SlidingPaginationInterface; use Knp\Component\Pager\PaginatorInterface; use Pimcore\Db; use Pimcore\Logger; @@ -34,8 +35,11 @@ class DefaultMariaDbDuplicatesIndex implements DuplicatesIndexInterface use LoggerAware; const DUPLICATESINDEX_TABLE = 'plugin_cmf_duplicatesindex'; + const DUPLICATESINDEX_CUSTOMERS_TABLE = 'plugin_cmf_duplicatesindex_customers'; + const POTENTIAL_DUPLICATES_TABLE = 'plugin_cmf_potential_duplicates'; + const FALSE_POSITIVES_TABLE = 'plugin_cmf_duplicates_false_positives'; /** @@ -66,10 +70,7 @@ class DefaultMariaDbDuplicatesIndex implements DuplicatesIndexInterface /** * DefaultMariaDbDuplicatesIndex constructor. * - * @param PaginatorInterface $paginator * @param bool $enableDuplicatesIndex - * @param array $duplicateCheckFields - * @param array $dataTransformers */ public function __construct( PaginatorInterface $paginator, @@ -107,18 +108,20 @@ public function recreateIndex() $paginator = $this->paginator->paginate($customerList); $paginator->setItemNumberPerPage(200); - $totalPages = $paginator->getPaginationData()['pageCount']; - for ($pageNumber = 1; $pageNumber <= $totalPages; $pageNumber++) { - $logger->notice(sprintf('execute page %s of %s', $pageNumber, $totalPages)); - $paginator = $this->paginator->paginate($customerList, $pageNumber, 200); + if ($paginator instanceof SlidingPaginationInterface) { + $totalPages = $paginator->getPaginationData()['pageCount']; + for ($pageNumber = 1; $pageNumber <= $totalPages; $pageNumber++) { + $logger->notice(sprintf('execute page %s of %s', $pageNumber, $totalPages)); + $paginator = $this->paginator->paginate($customerList, $pageNumber, 200); - foreach ($paginator as $customer) { - $logger->notice(sprintf('update index for %s', (string)$customer)); + foreach ($paginator as $customer) { + $logger->notice(sprintf('update index for %s', (string)$customer)); - $this->updateDuplicateIndexForCustomer($customer, true); - } + $this->updateDuplicateIndexForCustomer($customer, true); + } - \Pimcore::collectGarbage(); + \Pimcore::collectGarbage(); + } } } @@ -317,9 +320,9 @@ public function getFalsePositives($page, $pageSize = 200) $select ->from(self::FALSE_POSITIVES_TABLE) ->select('row1', - 'row2', - 'row1Details', - 'row2Details' + 'row2', + 'row1Details', + 'row2Details' ) ->addOrderBy('row1', 'asc'); @@ -519,6 +522,7 @@ protected function getCombinations($base, $n) foreach ($base as $key => $b) { if ($b == $lastEl) { $found = true; + continue; //last element found } @@ -592,6 +596,7 @@ protected function twoRowsAreSimilar(array $row1, array $row2, array $fieldCombi foreach ($fieldCombinationConfig as $field => $options) { if ($options['similarity']) { $applies = true; + break; } } @@ -671,6 +676,7 @@ protected function getFieldCombinationConfig($fieldCombinationCommaSeparated) if ($matched) { $this->fieldCombinationConfig[$fieldCombinationCommaSeparated] = $fields; + break; } } @@ -683,6 +689,7 @@ protected function updateDuplicateIndex($customerId, array $duplicateDataRows, a { $db = Db::get(); $db->beginTransaction(); + try { $db->executeQuery('delete from '.self::DUPLICATESINDEX_CUSTOMERS_TABLE.' where customer_id = ?', [$customerId]); @@ -691,6 +698,7 @@ protected function updateDuplicateIndex($customerId, array $duplicateDataRows, a foreach ($duplicateDataRow as $val) { if (!trim($val)) { $valid = false; + break; } } diff --git a/src/DuplicatesIndex/DuplicatesIndexInterface.php b/src/DuplicatesIndex/DuplicatesIndexInterface.php index 2cb93cc9..97fc3b47 100644 --- a/src/DuplicatesIndex/DuplicatesIndexInterface.php +++ b/src/DuplicatesIndex/DuplicatesIndexInterface.php @@ -28,28 +28,24 @@ interface DuplicatesIndexInterface public function recreateIndex(); /** - * @param CustomerInterface $customer * * @return void */ public function updateDuplicateIndexForCustomer(CustomerInterface $customer); /** - * @param CustomerInterface $customer * * @return void */ public function deleteCustomerFromDuplicateIndex(CustomerInterface $customer); /** - * @param CustomerInterface $customer * * @return bool */ public function isRelevantForDuplicateIndex(CustomerInterface $customer); /** - * @param OutputInterface $output * * @return void */ @@ -71,7 +67,6 @@ public function getAnalyzeFalsePositives(); * @param int $page * @param int $pageSize * @param bool $declined - * @param Concrete|null $filterCustomerList * * @return PaginationInterface */ diff --git a/src/Encryption/DefaultEncryptionService.php b/src/Encryption/DefaultEncryptionService.php index 579113b1..6c03ad3e 100644 --- a/src/Encryption/DefaultEncryptionService.php +++ b/src/Encryption/DefaultEncryptionService.php @@ -73,7 +73,6 @@ public function getDefaultKey() * Encrypt data with key (will fall back to default key if none given) * * @param string $plaintext - * @param Key|null $key * @param bool $rawBinary * * @return string @@ -97,7 +96,6 @@ public function encrypt($plaintext, Key $key = null, $rawBinary = false) * Decrypt ciphertext with key (will fall back to default key if none given) * * @param string $ciphertext - * @param Key|null $key * @param bool $rawBinary * * @return string diff --git a/src/Encryption/EncryptionServiceInterface.php b/src/Encryption/EncryptionServiceInterface.php index 8ce41511..e3f7880b 100644 --- a/src/Encryption/EncryptionServiceInterface.php +++ b/src/Encryption/EncryptionServiceInterface.php @@ -30,7 +30,6 @@ public function getDefaultKey(); * Encrypt data with key (will fall back to default key if none given) * * @param string $plaintext - * @param Key|null $key * @param bool $rawBinary * * @return string @@ -41,7 +40,6 @@ public function encrypt($plaintext, Key $key = null, $rawBinary = false); * Decrypt ciphertext with key (will fall back to default key if none given) * * @param string $ciphertext - * @param Key|null $key * @param bool $rawBinary * * @return string diff --git a/src/Event/Frontend/UrlActivityTracker.php b/src/Event/Frontend/UrlActivityTracker.php index 38098419..1955fe94 100644 --- a/src/Event/Frontend/UrlActivityTracker.php +++ b/src/Event/Frontend/UrlActivityTracker.php @@ -27,7 +27,7 @@ class UrlActivityTracker implements EventSubscriberInterface protected $allreadyTracked = false; /** - * @inheritDoc + * * * @return array */ @@ -41,7 +41,6 @@ public static function getSubscribedEvents()//: array /** * Checks for request params cmfa + cmfc and tracks activity if needed * - * @param RequestEvent $event */ public function onKernelRequest(RequestEvent $event) { diff --git a/src/Event/Newsletter/Mailchimp/TemplateExportResolveProviderHandlerEvent.php b/src/Event/Newsletter/Mailchimp/TemplateExportResolveProviderHandlerEvent.php index dc1cad3c..b5ec3bda 100644 --- a/src/Event/Newsletter/Mailchimp/TemplateExportResolveProviderHandlerEvent.php +++ b/src/Event/Newsletter/Mailchimp/TemplateExportResolveProviderHandlerEvent.php @@ -33,9 +33,6 @@ class TemplateExportResolveProviderHandlerEvent extends Event */ private $document; - /** - * @param Document\PageSnippet $document - */ public function __construct(Document\PageSnippet $document) { $this->document = $document; @@ -46,25 +43,16 @@ public function getName() return self::NAME; } - /** - * @return Mailchimp|null - */ public function getProviderHandler(): ?Mailchimp { return $this->providerHandler; } - /** - * @return Document\PageSnippet - */ public function getDocument(): Document\PageSnippet { return $this->document; } - /** - * @param Mailchimp $providerHandler - */ public function setProviderHandler(Mailchimp $providerHandler) { $this->providerHandler = $providerHandler; diff --git a/src/Event/PimcoreElementRemovalListener.php b/src/Event/PimcoreElementRemovalListener.php index 82adf385..3f33fdd4 100644 --- a/src/Event/PimcoreElementRemovalListener.php +++ b/src/Event/PimcoreElementRemovalListener.php @@ -36,51 +36,32 @@ class PimcoreElementRemovalListener implements PimcoreElementRemovalListenerInte */ private $typeMapper = null; - /** - * @param SegmentAssignerInterface $segmentAssigner - * @param TypeMapperInterface $typeMapper - */ public function __construct(SegmentAssignerInterface $segmentAssigner, TypeMapperInterface $typeMapper) { $this->setSegmentAssigner($segmentAssigner); $this->setTypeMapper($typeMapper); } - /** - * @return SegmentAssignerInterface - */ public function getSegmentAssigner(): SegmentAssignerInterface { return $this->segmentAssigner; } - /** - * @param SegmentAssignerInterface $segmentAssigner - */ public function setSegmentAssigner(SegmentAssignerInterface $segmentAssigner) { $this->segmentAssigner = $segmentAssigner; } - /** - * @return TypeMapperInterface - */ public function getTypeMapper(): TypeMapperInterface { return $this->typeMapper; } - /** - * @param TypeMapperInterface $typeMapper - */ public function setTypeMapper(TypeMapperInterface $typeMapper) { $this->typeMapper = $typeMapper; } - /** - * @inheritdoc - */ public function onPostDelete(ElementEventInterface $event) { $id = $event->getElement()->getId(); diff --git a/src/Event/PimcoreElementRemovalListenerInterface.php b/src/Event/PimcoreElementRemovalListenerInterface.php index 5bcd1057..d56c6cfa 100644 --- a/src/Event/PimcoreElementRemovalListenerInterface.php +++ b/src/Event/PimcoreElementRemovalListenerInterface.php @@ -23,7 +23,6 @@ interface PimcoreElementRemovalListenerInterface * performs cleaning up when Pimcore elements are deleted, * namely removes segment assignments from assignment, queue and index tables * - * @param ElementEventInterface $event * * @return void */ diff --git a/src/Factory.php b/src/Factory.php index 0a0156ea..086a23a4 100644 --- a/src/Factory.php +++ b/src/Factory.php @@ -38,7 +38,6 @@ public static function getInstance() /** * @param string $className * @param string|null $needsToBeSubclassOf - * @param array $constructorParams * * @return object * diff --git a/src/Filter/ExportActivitiesFilterParams.php b/src/Filter/ExportActivitiesFilterParams.php index 6f52d153..d8f7a181 100644 --- a/src/Filter/ExportActivitiesFilterParams.php +++ b/src/Filter/ExportActivitiesFilterParams.php @@ -25,7 +25,6 @@ class ExportActivitiesFilterParams private $type; /** - * @param Request $request * * @return static */ diff --git a/src/Filter/ExportCustomersFilterParams.php b/src/Filter/ExportCustomersFilterParams.php index 10f29f5b..34a37e06 100644 --- a/src/Filter/ExportCustomersFilterParams.php +++ b/src/Filter/ExportCustomersFilterParams.php @@ -40,7 +40,6 @@ class ExportCustomersFilterParams private $modificationTimestamp; /** - * @param Request $request * * @return static */ @@ -109,17 +108,11 @@ public function setSegments($segments) } } - /** - * @return int - */ public function getModificationTimestamp(): int { return $this->modificationTimestamp; } - /** - * @param int $modificationTimestamp - */ public function setModificationTimestamp(int $modificationTimestamp): void { $this->modificationTimestamp = $modificationTimestamp; diff --git a/src/GDPR/DataProvider/Customers.php b/src/GDPR/DataProvider/Customers.php index 384b6038..8d0e7a61 100644 --- a/src/GDPR/DataProvider/Customers.php +++ b/src/GDPR/DataProvider/Customers.php @@ -67,30 +67,21 @@ public function __construct(CustomerProviderInterface $customerProvider, Activit $config['include'] = true; $this->config = [ 'classes' => [ - $this->customerClassName => $config - ] + $this->customerClassName => $config, + ], ]; } - /** - * @inheritdoc - */ public function getName(): string { return 'customers'; } - /** - * @inheritdoc - */ public function getJsClassName(): string { return 'pimcore.plugin.GDPRDataExtractorBundle.dataproviders.customers'; } - /** - * @inheritdoc - */ public function getSortPriority(): int { return 5; @@ -99,9 +90,7 @@ public function getSortPriority(): int /** * Exports data of given object as json including all references that are configured to be included * - * @param AbstractObject $object * - * @return array */ public function doExportData(AbstractObject $object): array { @@ -118,7 +107,7 @@ public function doExportData(AbstractObject $object): array $object = Concrete::getById($id); if (!empty($object)) { $data = [ - 'className' => $object->getClass()->getName() + 'className' => $object->getClass()->getName(), ]; $data['data'] = $objectToArrayHelper->toArray($object); @@ -143,17 +132,6 @@ public function doExportData(AbstractObject $object): array return $exportResult; } - /** - * @param int $id - * @param string $firstname - * @param string $lastname - * @param string $email - * @param int $start - * @param int $limit - * @param string|null $sort - * - * @return array - */ public function searchData(int $id, string $firstname, string $lastname, string $email, int $start, int $limit, string $sort = null): array { $listing = $this->customerProvider->getList(); diff --git a/src/Helper/JsConfigService.php b/src/Helper/JsConfigService.php index 7e7831ee..00ce7104 100644 --- a/src/Helper/JsConfigService.php +++ b/src/Helper/JsConfigService.php @@ -48,9 +48,6 @@ class JsConfigService */ protected $scriptTag = true; - /** - * @param array $config - */ public function __construct(array $config = []) { $this->config = $config; @@ -60,9 +57,7 @@ public function __construct(array $config = []) * Returns the service instance. If a var name is set, it changes * the current variable to the given var before returning the instance. * - * @param string|null $varName * - * @return self */ public function __invoke(string $varName = null): self { @@ -76,9 +71,7 @@ public function __invoke(string $varName = null): self /** * Get helper instance scoped to given variable name * - * @param string $varName * - * @return self */ public function jsConfig(string $varName = self::DEFAULT_VAR_NAME): self { @@ -97,7 +90,6 @@ public function jsConfig(string $varName = self::DEFAULT_VAR_NAME): self * * @param mixed $key * @param mixed $value - * @param null|string $varName */ public function add($key, $value = '', string $varName = null) { @@ -120,9 +112,6 @@ public function add($key, $value = '', string $varName = null) } } - /** - * @param bool $scriptTag - */ public function generateScriptTag(bool $scriptTag): void { $this->scriptTag = $scriptTag; diff --git a/src/Helper/Notes.php b/src/Helper/Notes.php index 0c430fef..11a267cb 100644 --- a/src/Helper/Notes.php +++ b/src/Helper/Notes.php @@ -20,7 +20,6 @@ class Notes { /** - * @param ElementInterface $element * @param string $type * @param string $title * @param string|null $description diff --git a/src/Helper/Objects.php b/src/Helper/Objects.php index 26141cf3..650e6a0e 100644 --- a/src/Helper/Objects.php +++ b/src/Helper/Objects.php @@ -79,8 +79,6 @@ private static function checkObjectKeyHelper(Concrete $object, $origKey = null, * - returns false if no data in array was changed * - returns array with added objects if object where added * - * @param array $array - * @param array $addObjects * * @return false|array */ @@ -100,6 +98,7 @@ public static function addObjectsToArray(array &$array, array $addObjects) if ($addObject->getId() == $object->getId()) { $found = true; + break; } } @@ -120,8 +119,6 @@ public static function addObjectsToArray(array &$array, array $addObjects) * - returns false if no data in array was changed * - returns array with removed objects if object where removed * - * @param array $array - * @param array $removeObjects * * @return false|array */ @@ -167,7 +164,6 @@ public static function objectArrayUnique($array) /** * Returns IDs of an array of objects * - * @param array $array * * @return array */ @@ -186,7 +182,6 @@ public static function getIdsFromArray(array &$array) * Objects with metdata are only matched by object IDs (not by metadata or concrete instances). * * @param mixed $object - * @param array $objects * * @return bool; */ diff --git a/src/Installer.php b/src/Installer.php index e9b9e8b6..bea6e98e 100644 --- a/src/Installer.php +++ b/src/Installer.php @@ -40,11 +40,6 @@ public function install(): void parent::install(); } - /** - * {@inheritdoc} - * - * @return bool - */ public function needsReloadAfterInstall(): bool { return true; @@ -219,11 +214,11 @@ public function installDatabaseTables() $sqlFiles = [ __DIR__ . '/Resources/sql/filterDefinition/' => [ - 'datamodel.sql' + 'datamodel.sql', ], __DIR__ . '/Resources/sql/activityMetadata/' => [ - 'datamodel.sql' - ] + 'datamodel.sql', + ], ]; $storedFunctions = [ diff --git a/src/LinkGenerator/LinkActivityDefinitionLinkGenerator.php b/src/LinkGenerator/LinkActivityDefinitionLinkGenerator.php index e3aa6fff..be604a9d 100644 --- a/src/LinkGenerator/LinkActivityDefinitionLinkGenerator.php +++ b/src/LinkGenerator/LinkActivityDefinitionLinkGenerator.php @@ -32,9 +32,7 @@ public function __construct($cmfcPlaceholder = '*|ID_ENCODED|*') /** * @param LinkActivityDefinition $object - * @param array $params * - * @return string */ public function generate(object $object, array $params = []): string { diff --git a/src/Listing/Filter/AbstractFieldBetween.php b/src/Listing/Filter/AbstractFieldBetween.php index 5054d4ae..76826471 100644 --- a/src/Listing/Filter/AbstractFieldBetween.php +++ b/src/Listing/Filter/AbstractFieldBetween.php @@ -22,6 +22,7 @@ abstract class AbstractFieldBetween extends AbstractFilter implements OnCreateQueryFilterInterface { const TYPE_FROM = 'from'; + const TYPE_TO = 'to'; /** diff --git a/src/Listing/Filter/AbstractFieldValue.php b/src/Listing/Filter/AbstractFieldValue.php index 907a4d81..1f224938 100644 --- a/src/Listing/Filter/AbstractFieldValue.php +++ b/src/Listing/Filter/AbstractFieldValue.php @@ -99,8 +99,6 @@ public function applyOnCreateQuery(CoreListing\Concrete $listing, QueryBuilder $ * * @param string $field * @param mixed $value - * @param CoreListing\Concrete $listing - * @param QueryBuilder $queryBuilder * @param string $operator */ protected function applyFieldCondition( diff --git a/src/Listing/Filter/BoolCombinator.php b/src/Listing/Filter/BoolCombinator.php index fbc049f1..50bd1c46 100644 --- a/src/Listing/Filter/BoolCombinator.php +++ b/src/Listing/Filter/BoolCombinator.php @@ -33,7 +33,6 @@ class BoolCombinator extends AbstractFilter implements OnCreateQueryFilterInterf /** * @param OnCreateQueryFilterInterface[] $filters - * @param string $operator */ public function __construct(array $filters, string $operator = 'AND') { diff --git a/src/Listing/Filter/DateBetween.php b/src/Listing/Filter/DateBetween.php index c3611519..50fad082 100644 --- a/src/Listing/Filter/DateBetween.php +++ b/src/Listing/Filter/DateBetween.php @@ -29,8 +29,6 @@ class DateBetween extends AbstractFieldBetween /** * @param string $field - * @param \DateTime|null $from - * @param \DateTime|null $to */ public function __construct($field, \DateTime $from = null, \DateTime $to = null) { @@ -41,7 +39,6 @@ public function __construct($field, \DateTime $from = null, \DateTime $to = null } /** - * @param \DateTime|null $from * * @return $this */ @@ -58,7 +55,6 @@ public function setFrom(\DateTime $from = null) } /** - * @param \DateTime|null $to * * @return $this */ diff --git a/src/Listing/Filter/OnCreateQueryFilterInterface.php b/src/Listing/Filter/OnCreateQueryFilterInterface.php index 2689b9f1..fed63eea 100644 --- a/src/Listing/Filter/OnCreateQueryFilterInterface.php +++ b/src/Listing/Filter/OnCreateQueryFilterInterface.php @@ -24,8 +24,6 @@ interface OnCreateQueryFilterInterface extends FilterInterface /** * Apply filter directly to query * - * @param CoreListing\Concrete $listing - * @param QueryBuilder $queryBuilder */ public function applyOnCreateQuery(CoreListing\Concrete $listing, QueryBuilder $queryBuilder); } diff --git a/src/Listing/Filter/Permission.php b/src/Listing/Filter/Permission.php index 27f9b685..a210c21f 100644 --- a/src/Listing/Filter/Permission.php +++ b/src/Listing/Filter/Permission.php @@ -29,7 +29,6 @@ class Permission extends AbstractFilter implements OnCreateQueryFilterInterface /** * Permission constructor. * - * @param User $user */ public function __construct(User $user) { @@ -56,13 +55,13 @@ protected function getWorkspacesOfUser() /** @var User\Role $role */ $role = User\Role::getById($roleId); foreach ($role->getWorkspacesObject() as $workspace) { - /* @var User\Workspace\AbstractWorkspace $workspace */ + // @var User\Workspace\AbstractWorkspace $workspace $workspaces[$workspace->getCpath()] = $workspace; } } // fetch workspaces of user directly foreach ($this->user->getWorkspacesObject() as $workspace) { - /* @var User\Workspace\AbstractWorkspace $workspace */ + // @var User\Workspace\AbstractWorkspace $workspace $workspaces[$workspace->getCpath()] = $workspace; } krsort($workspaces); @@ -73,7 +72,6 @@ protected function getWorkspacesOfUser() /** * Add user directory permissions to filter only for accessible customers * - * @param QueryBuilder $queryBuilder */ protected function addPermissionFilters(QueryBuilder $queryBuilder) { diff --git a/src/Listing/FilterHandler.php b/src/Listing/FilterHandler.php index 4cd48271..063153a1 100644 --- a/src/Listing/FilterHandler.php +++ b/src/Listing/FilterHandler.php @@ -65,9 +65,6 @@ public function addFilters(array $filters) } } - /** - * @param FilterInterface $filter - */ public function addFilter(FilterInterface $filter) { $this->filters[] = $filter; diff --git a/src/Listing/FilterInterface.php b/src/Listing/FilterInterface.php index 1bf8f283..eb766007 100644 --- a/src/Listing/FilterInterface.php +++ b/src/Listing/FilterInterface.php @@ -18,5 +18,6 @@ interface FilterInterface { const OPERATOR_AND = 'AND'; + const OPERATOR_OR = 'OR'; } diff --git a/src/Listing/ListingFilterInterface.php b/src/Listing/ListingFilterInterface.php index 1b9f942c..7a7b5712 100644 --- a/src/Listing/ListingFilterInterface.php +++ b/src/Listing/ListingFilterInterface.php @@ -22,7 +22,6 @@ interface ListingFilterInterface extends FilterInterface /** * Apply filter to listing * - * @param CoreListing\Concrete $listing */ public function applyToListing(CoreListing\Concrete $listing); } diff --git a/src/Maintenance/MaintenanceWorker.php b/src/Maintenance/MaintenanceWorker.php index b2fea370..4763bb7d 100644 --- a/src/Maintenance/MaintenanceWorker.php +++ b/src/Maintenance/MaintenanceWorker.php @@ -35,17 +35,11 @@ public function __construct(array $serviceConfiguration) $this->setServiceConfiguration($serviceConfiguration); } - /** - * @return array - */ public function getServiceConfiguration(): array { return $this->serviceConfiguration; } - /** - * @param array $serviceConfiguration - */ public function setServiceConfiguration(array $serviceConfiguration) { $this->serviceConfiguration = $serviceConfiguration; diff --git a/src/Migrations/PimcoreX/Version20210305134111.php b/src/Migrations/PimcoreX/Version20210305134111.php index 8632db8b..d4756e25 100644 --- a/src/Migrations/PimcoreX/Version20210305134111.php +++ b/src/Migrations/PimcoreX/Version20210305134111.php @@ -28,17 +28,11 @@ protected function getBundleName(): string return 'PimcoreCustomerManagementFrameworkBundle'; } - /** - * @param Schema $schema - */ public function up(Schema $schema): void { // nothing to do } - /** - * @param Schema $schema - */ public function down(Schema $schema): void { // nothing to do diff --git a/src/Migrations/PimcoreX/Version20221229215900.php b/src/Migrations/PimcoreX/Version20221229215900.php index a87d7ddf..562a1e96 100644 --- a/src/Migrations/PimcoreX/Version20221229215900.php +++ b/src/Migrations/PimcoreX/Version20221229215900.php @@ -25,9 +25,6 @@ protected function getBundleName(): string return 'PimcoreCustomerManagementFrameworkBundle'; } - /** - * @param Schema $schema - */ public function up(Schema $schema): void { $deletionsTable = $schema->getTable('plugin_cmf_deletions'); @@ -41,9 +38,6 @@ public function up(Schema $schema): void $this->addSql('SET foreign_key_checks = 1'); } - /** - * @param Schema $schema - */ public function down(Schema $schema): void { $deletionsTable = $schema->getTable('plugin_cmf_deletions'); diff --git a/src/Model/AbstractActivity.php b/src/Model/AbstractActivity.php index 06b75766..e4c6ea0d 100644 --- a/src/Model/AbstractActivity.php +++ b/src/Model/AbstractActivity.php @@ -60,7 +60,6 @@ public function cmfUpdateData(array $data) } /** - * @param array $data * @param bool $fromWebservice * * @return bool @@ -81,7 +80,6 @@ public static function cmfGetOverviewData(ActivityStoreEntryInterface $entry) } /** - * @param ActivityStoreEntryInterface $entry * * @return array */ @@ -91,7 +89,6 @@ public static function cmfGetDetailviewData(ActivityStoreEntryInterface $entry) } /** - * @param ActivityStoreEntryInterface $entry * * @return bool */ diff --git a/src/Model/AbstractObjectActivity.php b/src/Model/AbstractObjectActivity.php index b7a61520..c8b11bf8 100644 --- a/src/Model/AbstractObjectActivity.php +++ b/src/Model/AbstractObjectActivity.php @@ -48,9 +48,6 @@ public function cmfGetType() return $this->getClassName(); } - /** - * @inheritdoc - */ public function cmfToArray() { $result = ObjectToArray::getInstance()->toArray($this); diff --git a/src/Model/AbstractTermSegmentBuilderDefinition.php b/src/Model/AbstractTermSegmentBuilderDefinition.php index f32f76de..224bbf31 100644 --- a/src/Model/AbstractTermSegmentBuilderDefinition.php +++ b/src/Model/AbstractTermSegmentBuilderDefinition.php @@ -72,7 +72,6 @@ public function getAllPhrases() } /** - * @param array $phrases * * @return array */ @@ -86,11 +85,13 @@ public function getMatchingPhrases(array $phrases) foreach ($allPhrases as $_term) { if ($term == $_term) { $result[] = $term; + break; } if (@preg_match($_term, $term)) { $result[] = $term; + break; } } @@ -104,7 +105,6 @@ public function getMatchingPhrases(array $phrases) /** * Adds/deletes CustomerSegment objects within given $customerSegmentGroup depending on defined terms within this TermSegmentBuilderDefinition. * - * @param CustomerSegmentGroup $customerSegmentGroup * * @return void; */ @@ -130,6 +130,7 @@ public function updateCustomerSegments(CustomerSegmentGroup $customerSegmentGrou foreach ($updatedSegments as $updatedSegment) { if ($currentSegment->getId() == $updatedSegment->getId()) { unset($currentSegments[$key]); + break; } } diff --git a/src/Model/ActionTrigger/ActionDefinition/Dao.php b/src/Model/ActionTrigger/ActionDefinition/Dao.php index bcb5d56f..0ff39585 100644 --- a/src/Model/ActionTrigger/ActionDefinition/Dao.php +++ b/src/Model/ActionTrigger/ActionDefinition/Dao.php @@ -68,12 +68,14 @@ public function save() public function delete() { $this->db->beginTransaction(); + try { $this->db->executeQuery('DELETE FROM ' . self::TABLE_NAME . ' WHERE id = ?', [$this->model->getId()]); $this->db->commit(); } catch (\Exception $e) { $this->db->rollBack(); + throw $e; } } diff --git a/src/Model/ActionTrigger/Rule/Dao.php b/src/Model/ActionTrigger/Rule/Dao.php index 9b3f7d7d..3a703e7d 100644 --- a/src/Model/ActionTrigger/Rule/Dao.php +++ b/src/Model/ActionTrigger/Rule/Dao.php @@ -104,6 +104,7 @@ public function save() if ($this->model->getId()) { $this->db->beginTransaction(); + try { $this->saveActions(); @@ -121,6 +122,7 @@ public function save() $creationDate = time(); $data['creationDate'] = $creationDate; $this->db->beginTransaction(); + try { $data = Helper::quoteDataIdentifiers($this->db, $data); @@ -161,12 +163,14 @@ private function saveActions() public function delete() { $this->db->beginTransaction(); + try { $this->db->executeQuery('DELETE FROM ' . self::TABLE_NAME . ' WHERE id = ?', [$this->model->getId()]); $this->db->commit(); } catch (\Exception $e) { $this->db->rollBack(); + throw $e; } } diff --git a/src/Model/ActionTrigger/Rule/Listing.php b/src/Model/ActionTrigger/Rule/Listing.php index 006c221d..96574afe 100644 --- a/src/Model/ActionTrigger/Rule/Listing.php +++ b/src/Model/ActionTrigger/Rule/Listing.php @@ -27,7 +27,6 @@ class Listing extends AbstractListing /** * @param string $key * - * @return bool */ public function isValidOrderKey(/* string */ $key): bool { diff --git a/src/Model/ActionTrigger/Rule/Listing/Dao.php b/src/Model/ActionTrigger/Rule/Listing/Dao.php index c48fa864..cb1fe66d 100644 --- a/src/Model/ActionTrigger/Rule/Listing/Dao.php +++ b/src/Model/ActionTrigger/Rule/Listing/Dao.php @@ -43,7 +43,6 @@ public function load(): array } /** - * @return int * * @throws Exception */ diff --git a/src/Model/Activity/GenericActivity.php b/src/Model/Activity/GenericActivity.php index a3b5d6ff..0974ae15 100644 --- a/src/Model/Activity/GenericActivity.php +++ b/src/Model/Activity/GenericActivity.php @@ -77,7 +77,6 @@ public function cmfUpdateData(array $data) } /** - * @param array $data * @param bool $fromWebservice * * @return static @@ -92,9 +91,6 @@ public function cmfGetType() return $this->data['type']; } - /** - * @inheritdoc - */ public function cmfToArray() { return $this->data['attributes']; diff --git a/src/Model/Activity/MailchimpStatusChangeActivity.php b/src/Model/Activity/MailchimpStatusChangeActivity.php index 47d1d681..abba6908 100644 --- a/src/Model/Activity/MailchimpStatusChangeActivity.php +++ b/src/Model/Activity/MailchimpStatusChangeActivity.php @@ -43,7 +43,6 @@ class MailchimpStatusChangeActivity extends AbstractActivity /** * MailchimpStatusChangeActivity constructor. * - * @param CustomerInterface $customer * @param string $status * @param int $activityDate */ @@ -64,9 +63,6 @@ public function cmfGetType() return self::TYPE; } - /** - * @inheritdoc - */ public function cmfToArray() { $attributes = $this->additionalAttributes; @@ -86,7 +82,6 @@ public function cmfWebserviceUpdateAllowed() } /** - * @param array $data * @param bool $fromWebservice * * @return false diff --git a/src/Model/Activity/TargetGroupAssignActivity.php b/src/Model/Activity/TargetGroupAssignActivity.php index 209a0346..04ed2acc 100644 --- a/src/Model/Activity/TargetGroupAssignActivity.php +++ b/src/Model/Activity/TargetGroupAssignActivity.php @@ -47,8 +47,6 @@ class TargetGroupAssignActivity extends AbstractActivity /** * TargetGroupAssignActivity constructor. * - * @param CustomerInterface $customer - * @param TargetGroup $targetGroup * @param int $weight * @param int $totalWeight * @param int|null $activityDate @@ -76,17 +74,11 @@ public function cmfGetType() return self::TYPE; } - /** - * @inheritdoc - */ public function cmfToArray() { return ['targetGroup' => $this->targetGroup->getId(), 'targetGroupName' => $this->targetGroup->getName(), 'weight' => $this->weight, 'totalWeight' => $this->totalWeight]; } - /** - * @inheritdoc - */ public static function cmfGetOverviewData(ActivityStoreEntryInterface $entry) { return $entry->getAttributes(); diff --git a/src/Model/Activity/TrackedUrlActivity.php b/src/Model/Activity/TrackedUrlActivity.php index 8176bddc..fe313696 100644 --- a/src/Model/Activity/TrackedUrlActivity.php +++ b/src/Model/Activity/TrackedUrlActivity.php @@ -23,6 +23,7 @@ class TrackedUrlActivity extends AbstractActivity { protected $customer; + private $activityDefinition; public function __construct(CustomerInterface $customer, LinkActivityDefinition $activityDefinition) @@ -36,9 +37,6 @@ public function cmfGetType() return $this->activityDefinition->getAttributeType(); } - /** - * @inheritdoc - */ public function cmfToArray() { $attributes = [ @@ -67,7 +65,6 @@ public function cmfWebserviceUpdateAllowed() } /** - * @param array $data * @param bool $fromWebservice * * @return static|false diff --git a/src/Model/ActivityInterface.php b/src/Model/ActivityInterface.php index bc19640f..8e2c001e 100644 --- a/src/Model/ActivityInterface.php +++ b/src/Model/ActivityInterface.php @@ -21,8 +21,11 @@ interface ActivityInterface { const DATATYPE_STRING = 'string'; + const DATATYPE_INTEGER = 'integer'; + const DATATYPE_DOUBLE = 'double'; + const DATATYPE_BOOL = 'bool'; /** @@ -63,7 +66,6 @@ public static function cmfGetAttributeDataTypes(); /** * Updates the data of the activity instance but doesn't save it. * - * @param array $data * * @throws \Exception */ @@ -72,7 +74,6 @@ public function cmfUpdateData(array $data); /** * Create an activity object instance from an array of data. * - * @param array $data * @param bool $fromWebservice * * @return static|false @@ -105,7 +106,6 @@ public function setCustomer($customer); /** * Returns an associative array with data which should be shown additional to the type and activity date within the ActivityView overview list. * - * @param ActivityStoreEntryInterface $entry * * @return array|false */ @@ -114,7 +114,6 @@ public static function cmfGetOverviewData(ActivityStoreEntryInterface $entry); /** * Returns an associative array with data which should be shown ActivityView detail page. * - * @param ActivityStoreEntryInterface $entry * * @return array */ @@ -123,7 +122,6 @@ public static function cmfGetDetailviewData(ActivityStoreEntryInterface $entry); /** * Optional: Returns a template file which should be used for the ActivityView detail page. With this it's possible to implement completely individual detail pages for each activity type. * - * @param ActivityStoreEntryInterface $entry * * @return string|bool */ diff --git a/src/Model/ActivityList/DefaultMariaDbActivityList.php b/src/Model/ActivityList/DefaultMariaDbActivityList.php index a36a7574..e25d4a9d 100644 --- a/src/Model/ActivityList/DefaultMariaDbActivityList.php +++ b/src/Model/ActivityList/DefaultMariaDbActivityList.php @@ -170,11 +170,6 @@ public function load(): array return $activities; } - /** - * @param string $key - * - * @return bool - */ public function isValidOrderKey(string $key): bool { return true; diff --git a/src/Model/ActivityList/DefaultMariaDbActivityList/MariaDbDao.php b/src/Model/ActivityList/DefaultMariaDbActivityList/MariaDbDao.php index e60427f7..a3cbf968 100644 --- a/src/Model/ActivityList/DefaultMariaDbActivityList/MariaDbDao.php +++ b/src/Model/ActivityList/DefaultMariaDbActivityList/MariaDbDao.php @@ -121,7 +121,6 @@ public function load() } /** - * @param QueryBuilder $select * * @return $this */ diff --git a/src/Model/ActivityList/DefaultMariaDbActivityList/MySqlDao.php b/src/Model/ActivityList/DefaultMariaDbActivityList/MySqlDao.php index 0dcae052..b4b4b080 100644 --- a/src/Model/ActivityList/DefaultMariaDbActivityList/MySqlDao.php +++ b/src/Model/ActivityList/DefaultMariaDbActivityList/MySqlDao.php @@ -125,7 +125,6 @@ public function load() } /** - * @param QueryBuilder $select * * @return $this */ diff --git a/src/Model/ActivityStoreEntry/ActivityStoreEntryInterface.php b/src/Model/ActivityStoreEntry/ActivityStoreEntryInterface.php index d4958dbd..ec8825a5 100644 --- a/src/Model/ActivityStoreEntry/ActivityStoreEntryInterface.php +++ b/src/Model/ActivityStoreEntry/ActivityStoreEntryInterface.php @@ -51,7 +51,6 @@ public function getCustomer(); public function getCustomerId(); /** - * @param CustomerInterface $customer * * @return void */ @@ -87,7 +86,6 @@ public function setType($type); public function getRelatedItem(); /** - * @param ActivityInterface $item * * @return void */ @@ -151,13 +149,9 @@ public function getAttributes(); */ public function getData(); - /** - * @return array - */ public function getMetadata(): array; /** - * @param array $metadata * * @return void */ diff --git a/src/Model/ActivityStoreEntry/DefaultActivityStoreEntry.php b/src/Model/ActivityStoreEntry/DefaultActivityStoreEntry.php index 220a37b7..5f7ad2bc 100644 --- a/src/Model/ActivityStoreEntry/DefaultActivityStoreEntry.php +++ b/src/Model/ActivityStoreEntry/DefaultActivityStoreEntry.php @@ -158,9 +158,6 @@ public function getCustomerId() return $this->customerId; } - /** - * @param CustomerInterface $customer - */ public function setCustomer(CustomerInterface $customer) { $this->customer = $customer; @@ -221,9 +218,6 @@ public function getRelatedItem() return $this->relatedItem; } - /** - * @param ActivityInterface $relatedItem - */ public function setRelatedItem(ActivityInterface $relatedItem) { $this->relatedItem = $relatedItem; @@ -301,9 +295,6 @@ public function getAttributes() return $this->attributes; } - /** - * @param array $attributes - */ public function setAttributes(array $attributes) { $this->attributes = $attributes; diff --git a/src/Model/CustomerDuplicates/PotentialDuplicateItem.php b/src/Model/CustomerDuplicates/PotentialDuplicateItem.php index f6fb07bc..f3dabf4a 100644 --- a/src/Model/CustomerDuplicates/PotentialDuplicateItem.php +++ b/src/Model/CustomerDuplicates/PotentialDuplicateItem.php @@ -18,10 +18,15 @@ class PotentialDuplicateItem implements PotentialDuplicateItemInterface { private $id; + private $duplicateCustomers; + private $fieldCombinations; + private $declined; + private $modificationDate; + private $creationDate; public function getId() diff --git a/src/Model/CustomerDuplicates/PotentialDuplicateItemInterface.php b/src/Model/CustomerDuplicates/PotentialDuplicateItemInterface.php index 9b56040a..a8bb1b08 100644 --- a/src/Model/CustomerDuplicates/PotentialDuplicateItemInterface.php +++ b/src/Model/CustomerDuplicates/PotentialDuplicateItemInterface.php @@ -49,7 +49,6 @@ public function setDuplicateCustomers(array $duplicateCustomers); public function getFieldCombinations(); /** - * @param array $fieldCombinations * * @return void */ diff --git a/src/Model/CustomerInterface.php b/src/Model/CustomerInterface.php index e92888ea..196f492d 100644 --- a/src/Model/CustomerInterface.php +++ b/src/Model/CustomerInterface.php @@ -38,121 +38,81 @@ public static function classId(); */ public function getPublished(); - /** - * @return bool|null - */ public function getActive(): ?bool; /** - * @param bool|null $active * * @return $this */ public function setActive(?bool $active); - /** - * @return string|null - */ public function getGender(): ?string; /** - * @param string|null $gender * * @return $this */ public function setGender(?string $gender); - /** - * @return string|null - */ public function getFirstname(): ?string; /** - * @param string|null $firstname * * @return $this */ public function setFirstname(?string $firstname); - /** - * @return string|null - */ public function getLastname(): ?string; /** - * @param string|null $lastname * * @return $this */ public function setLastname(?string $lastname); - /** - * @return string|null - */ public function getStreet(): ?string; /** - * @param string|null $street * * @return $this */ public function setStreet(?string $street); - /** - * @return string|null - */ public function getZip(): ?string; /** - * @param string|null $zip * * @return $this */ public function setZip(?string $zip); - /** - * @return string|null - */ public function getCity(): ?string; /** - * @param string|null $city * * @return $this */ public function setCity(?string $city); - /** - * @return string|null - */ public function getCountryCode(): ?string; /** - * @param string|null $countryCode * * @return $this */ public function setCountryCode(?string $countryCode); - /** - * @return string|null - */ public function getEmail(): ?string; /** - * @param string|null $email * * @return $this */ public function setEmail(?string $email); - /** - * @return string|null - */ public function getPhone(): ?string; /** - * @param string|null $phone * * @return $this */ @@ -169,7 +129,6 @@ public function getCustomerLanguage(); public function getManualSegments(): array; /** - * @param array|null $segments * * @return $this */ @@ -181,7 +140,6 @@ public function setManualSegments(?array $segments); public function getCalculatedSegments(): array; /** - * @param array|null $segments * * @return $this */ @@ -192,13 +150,9 @@ public function setCalculatedSegments(?array $segments); */ public function getAllSegments(); - /** - * @return string|null - */ public function getIdEncoded(): ?string; /** - * @param string|null $idEncoded * * @return void */ @@ -224,7 +178,6 @@ public function getRelatedCustomerGroups(); public function saveDirty($disableVersions = true); /** - * @param SaveOptions $saveOptions * @param bool $disableVersions * * @return mixed diff --git a/src/Model/CustomerSegmentInterface.php b/src/Model/CustomerSegmentInterface.php index 846b1694..5b39d952 100644 --- a/src/Model/CustomerSegmentInterface.php +++ b/src/Model/CustomerSegmentInterface.php @@ -21,25 +21,17 @@ interface CustomerSegmentInterface extends ElementInterface { - /** - * @return string|null - */ public function getName(): ?string; /** - * @param string|null $name * * @return $this */ public function setName(?string $name); - /** - * @return string|null - */ public function getReference(): ?string; /** - * @param string|null $reference * * @return $this */ @@ -57,30 +49,19 @@ public function getGroup(): ?AbstractElement; */ public function setGroup(?AbstractElement $group); - /** - * @return bool|null - */ public function getCalculated(): ?bool; /** - * @param bool $calculated * * @return $this */ public function setCalculated(bool $calculated); - /** - * @return bool|null - */ public function getUseAsTargetGroup(): ?bool; - /** - * @return string|null - */ public function getTargetGroup(): ?string; /** - * @param string|null $targetGroup * * @return $this */ diff --git a/src/Model/CustomerView/FilterDefinition.php b/src/Model/CustomerView/FilterDefinition.php index 8f048131..9bb1fc5d 100644 --- a/src/Model/CustomerView/FilterDefinition.php +++ b/src/Model/CustomerView/FilterDefinition.php @@ -77,25 +77,16 @@ public function setId($id) return $this; } - /** - * @return int - */ public function getOwnerId(): int { return $this->ownerId; } - /** - * @param int $ownerId - */ public function setOwnerId(int $ownerId) { $this->ownerId = $ownerId; } - /** - * @return string - */ public function getName(): string { return $this->name; @@ -113,16 +104,12 @@ public function setName($name): self return $this; } - /** - * @return array - */ public function getDefinition(): array { return $this->definition; } /** - * @param array $definition * * @return $this */ @@ -133,9 +120,6 @@ public function setDefinition(array $definition): self return $this; } - /** - * @return array - */ public function getAllowedUserIds(): array { return $this->allowedUserIds; @@ -144,7 +128,6 @@ public function getAllowedUserIds(): array /** * Set allowed user ids. Also removes duplicates and sorts ids ascending * - * @param array $allowedUserIds * * @return $this */ @@ -165,13 +148,13 @@ public function setAllowedUserIds(array $allowedUserIds) /** * Add single user id to allowed user ids array * - * @param int $allowedUserId * * @return $this */ public function addAllowedUserId(int $allowedUserId) { $this->setAllowedUserIds(array_merge($this->allowedUserIds, [$allowedUserId])); + // return current object return $this; } @@ -179,27 +162,23 @@ public function addAllowedUserId(int $allowedUserId) /** * Add multiple user ids to allowed user ids array * - * @param array $allowedUserIds * * @return $this */ public function addAllowedUserIds(array $allowedUserIds) { $this->setAllowedUserIds(array_merge($this->allowedUserIds, $allowedUserIds)); + // return current object return $this; } - /** - * @return array - */ public function getShowSegments(): array { return $this->getDefinition()['showSegments'] ?? []; } /** - * @param array $showSegments * * @return $this */ @@ -210,16 +189,12 @@ public function setShowSegments(array $showSegments) return $this; } - /** - * @return bool - */ public function isReadOnly(): bool { return boolval($this->readOnly); } /** - * @param bool $readOnly * * @return $this */ @@ -230,16 +205,12 @@ public function setReadOnly(bool $readOnly): self return $this; } - /** - * @return bool - */ public function isShortcutAvailable(): bool { return boolval($this->shortcutAvailable); } /** - * @param bool $shortcutAvailable * * @return $this */ @@ -260,6 +231,7 @@ public function setShortcutAvailable(bool $shortcutAvailable): self public static function getById($id) { $cacheKey = 'cmf_customerlist_filterdefinition_'.$id; + try { $filterDefinition = RuntimeCache::get($cacheKey); if (!$filterDefinition) { @@ -286,7 +258,6 @@ public static function getById($id) /** * Load FilterDefinition object by id * - * @param string $name * * @return self|null */ @@ -346,17 +317,11 @@ public function setModificationDate($modificationDate) return $this; } - /** - * @return bool - */ public function isDirty(): bool { return $this->isDirty; } - /** - * @param bool $isDirty - */ public function setIsDirty(bool $isDirty) { $this->isDirty = $isDirty; @@ -385,7 +350,6 @@ public function delete() /** * Check if single user id is allowed to use the FilterDefinition. Must be referenced in allowedUsers or must be owner * - * @param User $user * * @return bool */ @@ -397,7 +361,6 @@ public function isUserAllowed(User $user) /** * Check if single user id is allowed to use the FilterDefinition. Must be referenced in allowedUsers or must be owner * - * @param int $userId * * @return bool */ @@ -409,7 +372,6 @@ public function isUserIdAllowed(int $userId) /** * Check if any of the given user ids is allowed to use the FilterDefinition * - * @param array $userIds * * @return bool */ @@ -422,6 +384,7 @@ public function isAnyUserAllowed(array $userIds) return true; } } + // none of the user ids is allowed return false; } @@ -499,6 +462,7 @@ public function cleanUp($saveOnChange = true) if ($isChanged && $saveOnChange) { $this->save(); } + // return if object changed return $isChanged; } @@ -524,6 +488,7 @@ protected function cleanUpDefinition() unset($segments[$groupId]); // set object needs to be saved $this->setIsDirty(true); + // skip segment ids continue; } @@ -662,7 +627,6 @@ public static function getAllShortcutAvailable() /** * Fetch all FilterDefinition objects with shortcut for specific user * - * @param User $user * * @return array */ @@ -670,8 +634,8 @@ public static function getAllShortcutAvailableForUser(User $user) { $filterDefinitions = []; foreach (self::getAllShortcutAvailable() as $filterDefinition) { - if (/*$user->isAdmin() || */ - $filterDefinition->isUserAllowed($user)) { + if (// $user->isAdmin() || + $filterDefinition->isUserAllowed($user)) { $filterDefinitions[] = $filterDefinition; } } @@ -682,7 +646,6 @@ public static function getAllShortcutAvailableForUser(User $user) /** * Prepare FilterDefinition objects for menu representation with id and name * - * @param array $filterDefinitions * * @return array */ @@ -717,6 +680,7 @@ public function getOwner() if (!$user) { return null; } + // return found user return $user; } @@ -724,7 +688,6 @@ public function getOwner() /** * Check if user is owner of filter * - * @param User $user * * @return bool */ @@ -740,7 +703,6 @@ public function isOwner(User $user) /** * Check if user is able to update existing filter definition * - * @param User $user * * @return bool Returns true if user is owner of filter or filter admin */ @@ -752,7 +714,6 @@ public function isUserAllowedToUpdate(User $user) /** * Check if user is allowed to share the filter * - * @param User $user * * @return bool */ @@ -764,7 +725,6 @@ public function isUserAllowedToShare(User $user) /** * Fetch all user ids of current user * - * @param User $user * * @return array */ @@ -774,6 +734,7 @@ protected function getUserIds(User $user) $userIds = $user->getRoles(); // fetch id of user $userIds[] = $user->getId(); + // return user ids return $userIds; } @@ -781,7 +742,6 @@ protected function getUserIds(User $user) /** * Check if user is filter admin * - * @param User $user * * @return bool */ @@ -793,7 +753,6 @@ public static function isFilterAdmin(User $user) /** * Check if user has permission to share * - * @param User $user * * @return bool */ diff --git a/src/Model/CustomerView/FilterDefinition/Dao.php b/src/Model/CustomerView/FilterDefinition/Dao.php index 1e00ce09..e8bbf5d3 100644 --- a/src/Model/CustomerView/FilterDefinition/Dao.php +++ b/src/Model/CustomerView/FilterDefinition/Dao.php @@ -42,13 +42,21 @@ class Dao extends AbstractDao const TABLE_NAME = 'plugin_cmf_customer_filter_definition'; const ATTRIBUTE_ID = 'id'; + const ATTRIBUTE_OWNER_ID = 'ownerId'; + const ATTRIBUTE_NAME = 'name'; + const ATTRIBUTE_DEFINITION = 'definition'; + const ATTRIBUTE_ALLOWED_USER_IDS = 'allowedUserIds'; + const ATTRIBUTE_READ_ONLY = 'readOnly'; + const ATTRIBUTE_SHORTCUT_AVAILABLE = 'shortcutAvailable'; + const ATTRIBUTE_CREATION_DATE = 'creationDate'; + const ATTRIBUTE_MODIFICATION_DATE = 'modificationDate'; /** @@ -66,7 +74,6 @@ public function getById($id = null): void } /** - * @param string $name * * @throws \Exception Throws exception if object with id not found */ @@ -146,6 +153,7 @@ public function delete(): bool ]); } catch (\Exception $e) { Logger::alert('Could not delete filter definition. Not found in database.', ['id' => $this->model->getId()]); + throw $e; } diff --git a/src/Model/CustomerView/FilterDefinition/Listing.php b/src/Model/CustomerView/FilterDefinition/Listing.php index 2edddd5e..42a002d9 100644 --- a/src/Model/CustomerView/FilterDefinition/Listing.php +++ b/src/Model/CustomerView/FilterDefinition/Listing.php @@ -58,7 +58,6 @@ public function setFilterDefinitions($filterDefinitions) /** * @param string $key * - * @return bool */ public function isValidOrderKey(/* string */ $key): bool { @@ -75,9 +74,6 @@ public function load() return $dao->load(); } - /** - * @param array $userIds - */ public function setUserIdsCondition(array $userIds) { // check if no user ids provided diff --git a/src/Model/NewsletterAwareCustomerInterface.php b/src/Model/NewsletterAwareCustomerInterface.php index 39c605a2..f4e007bb 100644 --- a/src/Model/NewsletterAwareCustomerInterface.php +++ b/src/Model/NewsletterAwareCustomerInterface.php @@ -24,7 +24,6 @@ interface NewsletterAwareCustomerInterface extends CustomerInterface * Otherwise the provider handler will delete the customer in the target system if it exists. * To ensure a consistent handling inactive or unpublished customers should never be exported. * - * @param NewsletterProviderHandlerInterface $newsletterProviderHandler * * @return bool */ diff --git a/src/Model/SegmentAssignment/SegmentAssignment.php b/src/Model/SegmentAssignment/SegmentAssignment.php index 4689f1ca..09f9cb6f 100644 --- a/src/Model/SegmentAssignment/SegmentAssignment.php +++ b/src/Model/SegmentAssignment/SegmentAssignment.php @@ -44,17 +44,11 @@ class SegmentAssignment implements SegmentAssignmentInterface */ private $breaksInheritance = false; - /** - * @inheritDoc - */ public function getSegmentIds(): array { return $this->segmentIds; } - /** - * @inheritDoc - */ public function getSegments(): array { if ([] === $this->segments) { @@ -64,33 +58,21 @@ public function getSegments(): array return $this->segments; } - /** - * @inheritDoc - */ public function getElementId(): string { return $this->elementId; } - /** - * @inheritDoc - */ public function getElementType(): string { return $this->elementType; } - /** - * @inheritDoc - */ public function breaksInheritance(): bool { return $this->breaksInheritance; } - /** - * @inheritDoc - */ public function setSegmentIds(array $segmentIds): SegmentAssignmentInterface { $this->segmentIds = $segmentIds; @@ -98,9 +80,6 @@ public function setSegmentIds(array $segmentIds): SegmentAssignmentInterface return $this; } - /** - * @inheritDoc - */ public function setSegments(array $segments): SegmentAssignmentInterface { $this->segments = $segments; @@ -108,9 +87,6 @@ public function setSegments(array $segments): SegmentAssignmentInterface return $this; } - /** - * @inheritDoc - */ public function setElementId(string $id): SegmentAssignmentInterface { $this->elementId = $id; @@ -118,9 +94,6 @@ public function setElementId(string $id): SegmentAssignmentInterface return $this; } - /** - * @inheritDoc - */ public function setElementType(string $type): SegmentAssignmentInterface { $this->elementType = $type; @@ -128,9 +101,6 @@ public function setElementType(string $type): SegmentAssignmentInterface return $this; } - /** - * @inheritDoc - */ public function setBreaksInheritance(bool $breaks): SegmentAssignmentInterface { $this->breaksInheritance = $breaks; @@ -142,9 +112,6 @@ public function setBreaksInheritance(bool $breaks): SegmentAssignmentInterface * SegmentAssignment constructor. * * @param string[] $segmentIds - * @param int $elementId - * @param string $elementType - * @param bool $breaksInheritance */ public function __construct(array $segmentIds = [], int $elementId = 0, string $elementType = '', bool $breaksInheritance = false) { diff --git a/src/Model/SegmentAssignment/SegmentAssignment/Dao.php b/src/Model/SegmentAssignment/SegmentAssignment/Dao.php index 59979e70..583f186b 100644 --- a/src/Model/SegmentAssignment/SegmentAssignment/Dao.php +++ b/src/Model/SegmentAssignment/SegmentAssignment/Dao.php @@ -24,8 +24,11 @@ class Dao extends AbstractDao const TABLE_NAME = 'plugin_cmf_segment_assignment'; const ATTRIBUTE_SEGMENT_IDS = 'segments'; + const ATTRIBUTE_ELEMENT_ID = 'elementId'; + const ATTRIBUTE_ELEMENT_TYPE = 'elementType'; + const ATTRIBUTE_BREAKS_INHERITANCE = 'breaksInheritance'; /** @@ -53,9 +56,6 @@ public function setModel($model): static return $this; } - /** - * @param SegmentAssignmentInterface|null $model - */ public function __construct(?SegmentAssignmentInterface $model) { $this->setModel($model); diff --git a/src/Model/SegmentAssignmentInterface.php b/src/Model/SegmentAssignmentInterface.php index 47e71411..9839986b 100644 --- a/src/Model/SegmentAssignmentInterface.php +++ b/src/Model/SegmentAssignmentInterface.php @@ -27,63 +27,42 @@ public function getSegmentIds(): array; /** * returns assigned Segments * * - * @return array */ public function getSegments(): array; /** * returns the affiliated element's id * - * @return string */ public function getElementId(): string; /** * returns the affiliated element's type * - * @return string */ public function getElementType(): string; /** * returns whether the affiliated element breaks inheritance * - * @return bool */ public function breaksInheritance(): bool; /** * @param string[] $segmentIds * - * @return SegmentAssignmentInterface */ public function setSegmentIds(array $segmentIds): self; /** * @param SegmentAssignmentInterface[] $segments * - * @return SegmentAssignmentInterface */ public function setSegments(array $segments): self; - /** - * @param string $id - * - * @return SegmentAssignmentInterface - */ public function setElementId(string $id): self; - /** - * @param string $type - * - * @return SegmentAssignmentInterface - */ public function setElementType(string $type): self; - /** - * @param bool $breaks - * - * @return SegmentAssignmentInterface - */ public function setBreaksInheritance(bool $breaks): self; } diff --git a/src/Model/Traits/CustomerTrait.php b/src/Model/Traits/CustomerTrait.php index 90e27e23..4008a703 100644 --- a/src/Model/Traits/CustomerTrait.php +++ b/src/Model/Traits/CustomerTrait.php @@ -81,7 +81,6 @@ public function saveDirty($disableVersions = true) } /** - * @param SaveOptions $saveOptions * @param bool $disableVersions * * @return mixed @@ -108,7 +107,6 @@ public function getSaveManager() * If this method returns true the customer will be exported by the provider handler with the given shortcut. * Otherwise the provider handler will delete the customer in the target system if it exists. * - * @param NewsletterProviderHandlerInterface $newsletterProviderHandler * * @return bool */ diff --git a/src/Model/Traits/DefaultUserawareCustomerTrait.php b/src/Model/Traits/DefaultUserawareCustomerTrait.php index 48d7e7c0..fd22ff73 100644 --- a/src/Model/Traits/DefaultUserawareCustomerTrait.php +++ b/src/Model/Traits/DefaultUserawareCustomerTrait.php @@ -27,7 +27,6 @@ public function getRoles(): array /** * By default email is used as username * - * @return string */ public function getUserIdentifier(): string { diff --git a/src/Newsletter/AddressSource/SegmentAddressSource.php b/src/Newsletter/AddressSource/SegmentAddressSource.php index e9690840..2141e104 100644 --- a/src/Newsletter/AddressSource/SegmentAddressSource.php +++ b/src/Newsletter/AddressSource/SegmentAddressSource.php @@ -24,10 +24,10 @@ class SegmentAddressSource implements AddressSourceAdapterInterface { - /* @var SegmentManagerInterface */ + // @var SegmentManagerInterface private $segmentManager = null; - /* @var SendingParamContainer[] */ + // @var SendingParamContainer[] private $sendingParamContainers = []; /** @@ -49,33 +49,21 @@ public function __construct(array $arguments) ); } - /** - * @inheritDoc - */ public function getMailAddressesForBatchSending(): array { return $this->sendingParamContainers; } - /** - * @inheritDoc - */ public function getParamsForTestSending($emailAddress): SendingParamContainer { return new SendingParamContainer($emailAddress, ['emailAddress' => $emailAddress]); } - /** - * @inheritDoc - */ public function getTotalRecordCount(): int { return count($this->sendingParamContainers); } - /** - * @inheritDoc - */ public function getParamsForSingleSending($limit, $offset): array { return array_slice($this->sendingParamContainers, $offset, $limit); @@ -88,7 +76,6 @@ public function getParamsForSingleSending($limit, $offset): array * @uses SegmentManagerInterface * * @param string[]|int[] $segmentIds - * @param string $operator * @param string[] $filterFlags * * @return SendingParamContainer[] diff --git a/src/Newsletter/Command/NewsletterSyncCommand.php b/src/Newsletter/Command/NewsletterSyncCommand.php index 775d5ac3..9182d66e 100644 --- a/src/Newsletter/Command/NewsletterSyncCommand.php +++ b/src/Newsletter/Command/NewsletterSyncCommand.php @@ -45,11 +45,6 @@ class NewsletterSyncCommand extends AbstractCommand */ protected $customerProvider; - /** - * @param NewsletterManagerInterface $newsletterManager - * @param NewsletterQueueInterface $newsletterQueue - * @param CustomerProviderInterface $customerProvider - */ public function __construct(NewsletterManagerInterface $newsletterManager, NewsletterQueueInterface $newsletterQueue, CustomerProviderInterface $customerProvider) { parent::__construct(); @@ -72,10 +67,6 @@ protected function configure() ->addOption('process-queue-item', null, InputOption::VALUE_REQUIRED, 'process single queue item (provide json data of queue item)'); } - /** - * @param InputInterface $input - * @param OutputInterface $output - */ protected function execute(InputInterface $input, OutputInterface $output) { if ($input->getOption('enqueue-all-customers')) { diff --git a/src/Newsletter/Manager/DefaultNewsletterManager.php b/src/Newsletter/Manager/DefaultNewsletterManager.php index ffe5d1d1..e87b08d5 100644 --- a/src/Newsletter/Manager/DefaultNewsletterManager.php +++ b/src/Newsletter/Manager/DefaultNewsletterManager.php @@ -32,7 +32,6 @@ class DefaultNewsletterManager implements NewsletterManagerInterface /** * Subscribe customer from newsletter (for example via web form). Returns true if it was successful. * - * @param NewsletterAwareCustomerInterface $customer * * @return bool * @@ -44,6 +43,7 @@ public function subscribeCustomer(NewsletterAwareCustomerInterface $customer) foreach ($this->newsletterProviderHandlers as $newsletterProviderHandler) { if (!$newsletterProviderHandler->subscribeCustomer($customer)) { $success = false; + break; } } @@ -58,7 +58,6 @@ public function subscribeCustomer(NewsletterAwareCustomerInterface $customer) /** * Unsubscribe customer from newsletter (for example via web form). Returns true if it was successful. * - * @param NewsletterAwareCustomerInterface $customer * * @return bool * @@ -70,6 +69,7 @@ public function unsubscribeCustomer(NewsletterAwareCustomerInterface $customer) foreach ($this->newsletterProviderHandlers as $newsletterProviderHandler) { if (!$newsletterProviderHandler->unsubscribeCustomer($customer)) { $success = false; + break; } } @@ -109,7 +109,6 @@ public function syncSingleCustomerQueueItem(NewsletterQueueItemInterface $newsle } /** - * @param NewsletterProviderHandlerInterface $newsletterProviderHandler * * @return void */ diff --git a/src/Newsletter/Manager/NewsletterManagerInterface.php b/src/Newsletter/Manager/NewsletterManagerInterface.php index 365f7dcd..ffa08b9e 100644 --- a/src/Newsletter/Manager/NewsletterManagerInterface.php +++ b/src/Newsletter/Manager/NewsletterManagerInterface.php @@ -24,7 +24,6 @@ interface NewsletterManagerInterface /** * Subscribe customer from newsletter (for example via web form). Returns true if it was successful. * - * @param NewsletterAwareCustomerInterface $customer * * @return bool */ @@ -33,7 +32,6 @@ public function subscribeCustomer(NewsletterAwareCustomerInterface $customer); /** * Unsubscribe customer from newsletter (for example via web form). Returns true if it was successful. * - * @param NewsletterAwareCustomerInterface $customer * * @return bool */ @@ -50,14 +48,12 @@ public function syncSegments($forceUpdate = false); public function syncCustomers($forceAllCustomers = false, $forceUpdate = false); /** - * @param NewsletterQueueItemInterface $newsletterQueueItem * * @return void */ public function syncSingleCustomerQueueItem(NewsletterQueueItemInterface $newsletterQueueItem); /** - * @param NewsletterProviderHandlerInterface $newsletterProviderHandler * * @return void */ diff --git a/src/Newsletter/ProviderHandler/Mailchimp.php b/src/Newsletter/ProviderHandler/Mailchimp.php index 61635e4a..9e945f82 100644 --- a/src/Newsletter/ProviderHandler/Mailchimp.php +++ b/src/Newsletter/ProviderHandler/Mailchimp.php @@ -45,8 +45,11 @@ class Mailchimp implements NewsletterProviderHandlerInterface use LoggerAware; const STATUS_SUBSCRIBED = 'subscribed'; + const STATUS_UNSUBSCRIBED = 'unsubscribed'; + const STATUS_PENDING = 'pending'; + const STATUS_CLEANED = 'cleaned'; /** @@ -109,13 +112,7 @@ class Mailchimp implements NewsletterProviderHandlerInterface * * @param string $shortcut * @param string $listId - * @param array $statusMapping - * @param array $reverseStatusMapping - * @param array $mergeFieldMapping * @param MailchimpDataTransformerInterface[] $fieldTransformers - * @param SegmentExporter $segmentExporter - * @param SegmentManagerInterface $segmentManager - * @param MailChimpExportService $exportService * * @throws \Exception */ @@ -156,7 +153,7 @@ public function processCustomerQueueItems(array $items, $forceUpdate = false) { $items = $this->getUpdateNeededItems($items, $forceUpdate); - list($emailChangedItems, $regularItems) = $this->determineEmailChangedItems($items); + [$emailChangedItems, $regularItems] = $this->determineEmailChangedItems($items); //Customers where the email address changed need to be handled by the single exporter as the batch exporter does not allow such operations. if (sizeof($emailChangedItems)) { @@ -218,16 +215,19 @@ protected function determineEmailChangedItems(array $items) foreach ($items as $item) { if ($item->getOperation() != NewsletterQueueInterface::OPERATION_UPDATE) { $regularItems[] = $item; + continue; } if (!$item->getCustomer()) { $regularItems[] = $item; + continue; } if ($item->getCustomer()->getEmail() != $item->getEmail()) { $emailChangedItems[] = $item; + continue; } @@ -341,7 +341,6 @@ public function fetchCustomer(NewsletterAwareCustomerInterface $customer) /** * Directly Subscribes/exports a customer with mailchimp status "subscribed" via the Mailchimp API. * - * @param NewsletterAwareCustomerInterface $customer * * @return bool success */ @@ -353,7 +352,6 @@ public function subscribeCustomer(NewsletterAwareCustomerInterface $customer) /** * Directly Subscribes/exports a customer with mailchimp status "pending" via the Mailchimp API. * - * @param NewsletterAwareCustomerInterface $customer * * @return bool success */ @@ -365,7 +363,6 @@ public function subscribeCustomerPending(NewsletterAwareCustomerInterface $custo /** * Directly Subscribes/exports a customer with given mailchimp status "subscribed" via the Mailchimp API. * - * @param NewsletterAwareCustomerInterface $customer * * @return bool success */ @@ -379,6 +376,7 @@ public function subscribeCustomerWithStatus(NewsletterAwareCustomerInterface $cu return false; } + try { $this->setNewsletterStatus($customer, $newsletterStatus); @@ -559,7 +557,7 @@ public function buildEntry(MailchimpAwareCustomerInterface $customer) { $mergeFieldsMapping = sizeof($this->mergeFieldMapping) ? $this->mergeFieldMapping : [ 'firstname' => 'FNAME', - 'lastname' => 'LNAME' + 'lastname' => 'LNAME', ]; $mergeFields = []; @@ -579,7 +577,7 @@ public function buildEntry(MailchimpAwareCustomerInterface $customer) $result = [ 'email_address' => $emailCleaner->transform($customer->getEmail()), - 'merge_fields' => $mergeFields + 'merge_fields' => $mergeFields, ]; if ($language = $customer->getCustomerLanguage()) { @@ -596,7 +594,6 @@ public function buildEntry(MailchimpAwareCustomerInterface $customer) } /** - * @param MailchimpAwareCustomerInterface $customer * * @return array */ @@ -785,7 +782,6 @@ public function reverseMapNewsletterStatus($mailchimpStatus) /** * @param string $field - * @param MailchimpAwareCustomerInterface $customer * * @return array|null */ @@ -893,9 +889,6 @@ public function getActiveCustomerByEmail($email) return $customer; } - /** - * @return MailChimpExportService - */ public function getExportService(): MailChimpExportService { return $this->exportService; diff --git a/src/Newsletter/ProviderHandler/Mailchimp/CliSyncProcessor.php b/src/Newsletter/ProviderHandler/Mailchimp/CliSyncProcessor.php index ce22eac2..1757dabb 100644 --- a/src/Newsletter/ProviderHandler/Mailchimp/CliSyncProcessor.php +++ b/src/Newsletter/ProviderHandler/Mailchimp/CliSyncProcessor.php @@ -84,6 +84,7 @@ public function syncStatusChanges() if ($client->success() && sizeof($result['members'])) { foreach ($result['members'] as $row) { $customer = null; + try { if (!$customer = $newsletterProviderHandler->getActiveCustomerByEmail( $row['email_address'] @@ -96,9 +97,11 @@ public function syncStatusChanges() $this->getLogger()->error( sprintf('multiple active customers with email %s found', $row['email_address']) ); + continue; } catch (\Exception $e) { $this->getLogger()->error($e->getMessage()); + continue; } @@ -214,6 +217,7 @@ public function deleteNonExistingItems() 'get members failed: ' . $url ); } + break; } } diff --git a/src/Newsletter/ProviderHandler/Mailchimp/CustomerExporter/AbstractExporter.php b/src/Newsletter/ProviderHandler/Mailchimp/CustomerExporter/AbstractExporter.php index fb01f092..2cca09ac 100644 --- a/src/Newsletter/ProviderHandler/Mailchimp/CustomerExporter/AbstractExporter.php +++ b/src/Newsletter/ProviderHandler/Mailchimp/CustomerExporter/AbstractExporter.php @@ -40,9 +40,6 @@ abstract class AbstractExporter */ protected $newsletterQueue; - /** - * @param NewsletterQueueInterface $newsletterQueue - */ public function __construct(NewsletterQueueInterface $newsletterQueue) { $this->newsletterQueue = $newsletterQueue; @@ -74,9 +71,7 @@ protected function getCustomer($id) /** * used to be able to track the last response independently of the concrete mailchimp account * - * @param MailChimpExportService $exportService * - * @return MailChimp */ protected function getApiClientFromExportService(MailChimpExportService $exportService): MailChimp { diff --git a/src/Newsletter/ProviderHandler/Mailchimp/CustomerExporter/BatchExporter.php b/src/Newsletter/ProviderHandler/Mailchimp/CustomerExporter/BatchExporter.php index 8f30f63b..69a4b70b 100644 --- a/src/Newsletter/ProviderHandler/Mailchimp/CustomerExporter/BatchExporter.php +++ b/src/Newsletter/ProviderHandler/Mailchimp/CustomerExporter/BatchExporter.php @@ -54,7 +54,6 @@ class BatchExporter extends AbstractExporter * Run the actual export * * @param NewsletterQueueItemInterface[] $items - * @param Mailchimp $mailchimpProviderHandler * */ public function export(array $items, Mailchimp $mailchimpProviderHandler) @@ -140,12 +139,6 @@ public function export(array $items, Mailchimp $mailchimpProviderHandler) $this->handleBatchStatus($batchStatus, $items, $mailchimpProviderHandler); } - /** - * @param Batch $batch - * @param CustomerInterface $customer - * @param array $entry - * @param Mailchimp $mailchimpProviderHandler - */ protected function createBatchUpdateOperation(Batch $batch, CustomerInterface $customer, array $entry, Mailchimp $mailchimpProviderHandler) { $exportService = $mailchimpProviderHandler->getExportService(); @@ -189,11 +182,6 @@ protected function createBatchUpdateOperation(Batch $batch, CustomerInterface $c ); } - /** - * @param Batch $batch - * @param NewsletterQueueItemInterface $item - * @param Mailchimp $mailchimpProviderHandler - */ protected function createBatchDeleteOperation(Batch $batch, NewsletterQueueItemInterface $item, Mailchimp $mailchimpProviderHandler) { if ($mailchimpProviderHandler->doesOtherSubscribedCustomerWithEmailExist($item->getEmail(), $item->getCustomerId())) { @@ -234,7 +222,6 @@ protected function createBatchDeleteOperation(Batch $batch, NewsletterQueueItemI /** * Check batch status and back off exponentially after errors * - * @param Batch $batch * @param int $iteration * * @return array|bool @@ -312,7 +299,6 @@ protected function checkBatchStatus(Batch $batch, \DrewM\MailChimp\MailChimp $ap /** * Update exported records from batch request with export notes and handle errored records * - * @param array $result * @param NewsletterQueueItemInterface[] $items * @param Mailchimp $mailchimpProviderHandler */ @@ -393,7 +379,7 @@ protected function processSuccessfullItem(Mailchimp $mailchimpProviderHandler, N $remoteId ), [ - 'relatedObject' => $customer + 'relatedObject' => $customer, ] ); } elseif ($customer) { @@ -412,7 +398,7 @@ protected function processSuccessfullItem(Mailchimp $mailchimpProviderHandler, N $remoteId ), [ - 'relatedObject' => $customer + 'relatedObject' => $customer, ] ); } @@ -454,7 +440,7 @@ protected function processFailedItem(Mailchimp $mailchimpProviderHandler, Newsle $message ), [ - 'relatedObject' => $customer + 'relatedObject' => $customer, ] ); } else { @@ -467,7 +453,7 @@ protected function processFailedItem(Mailchimp $mailchimpProviderHandler, Newsle $message ), [ - 'relatedObject' => $customer + 'relatedObject' => $customer, ] ); } diff --git a/src/Newsletter/ProviderHandler/Mailchimp/CustomerExporter/SingleExporter.php b/src/Newsletter/ProviderHandler/Mailchimp/CustomerExporter/SingleExporter.php index ed6ea33f..a236a325 100644 --- a/src/Newsletter/ProviderHandler/Mailchimp/CustomerExporter/SingleExporter.php +++ b/src/Newsletter/ProviderHandler/Mailchimp/CustomerExporter/SingleExporter.php @@ -30,8 +30,6 @@ class SingleExporter extends AbstractExporter /** * Run the actual export * - * @param NewsletterQueueItemInterface $item - * @param Mailchimp $mailchimpProviderHandler * * @return void */ @@ -56,9 +54,6 @@ public function export(NewsletterQueueItemInterface $item, Mailchimp $mailchimpP } /** - * @param MailchimpAwareCustomerInterface $customer - * @param NewsletterQueueItemInterface $item - * @param Mailchimp $mailchimpProviderHandler * * @return bool */ @@ -116,7 +111,7 @@ public function update(MailchimpAwareCustomerInterface $customer, NewsletterQueu $remoteId ), [ - 'relatedObject' => $customer + 'relatedObject' => $customer, ] ); @@ -144,7 +139,7 @@ public function update(MailchimpAwareCustomerInterface $customer, NewsletterQueu implode('; ', $apiClient->getLastRequest()) ), [ - 'relatedObject' => $customer + 'relatedObject' => $customer, ] ); } @@ -153,8 +148,6 @@ public function update(MailchimpAwareCustomerInterface $customer, NewsletterQueu } /** - * @param Mailchimp $mailchimpProviderHandler - * @param MailchimpAwareCustomerInterface $customer * * @return array|null */ @@ -195,7 +188,7 @@ protected function handleChangedEmail(MailchimpAwareCustomerInterface $customer, $remoteId ), [ - 'relatedObject' => $customer + 'relatedObject' => $customer, ] ); } elseif ($apiClient->getLastResponse()['headers']['http_code'] == 404) { @@ -207,7 +200,7 @@ protected function handleChangedEmail(MailchimpAwareCustomerInterface $customer, $remoteId ), [ - 'relatedObject' => $customer + 'relatedObject' => $customer, ] ); } else { @@ -221,7 +214,7 @@ protected function handleChangedEmail(MailchimpAwareCustomerInterface $customer, $apiClient->getLastResponse()['body'] ), [ - 'relatedObject' => $customer + 'relatedObject' => $customer, ] ); @@ -235,11 +228,6 @@ protected function handleChangedEmail(MailchimpAwareCustomerInterface $customer, return $remoteId; } - /** - * @param MailchimpAwareCustomerInterface $customer - * @param NewsletterQueueItemInterface $item - * @param Mailchimp $mailchimpProviderHandler - */ protected function delete(MailchimpAwareCustomerInterface $customer, NewsletterQueueItemInterface $item, Mailchimp $mailchimpProviderHandler) { $exportService = $mailchimpProviderHandler->getExportService(); @@ -286,7 +274,7 @@ protected function delete(MailchimpAwareCustomerInterface $customer, NewsletterQ $remoteId ), [ - 'relatedObject' => $customer + 'relatedObject' => $customer, ] ); @@ -311,7 +299,7 @@ protected function delete(MailchimpAwareCustomerInterface $customer, NewsletterQ $apiClient->getLastResponse()['body'] ), [ - 'relatedObject' => $customer + 'relatedObject' => $customer, ] ); } else { diff --git a/src/Newsletter/ProviderHandler/Mailchimp/MailChimpExportService.php b/src/Newsletter/ProviderHandler/Mailchimp/MailChimpExportService.php index 635f76e8..74fbe613 100644 --- a/src/Newsletter/ProviderHandler/Mailchimp/MailChimpExportService.php +++ b/src/Newsletter/ProviderHandler/Mailchimp/MailChimpExportService.php @@ -33,9 +33,6 @@ class MailChimpExportService */ protected $apiClient; - /** - * @param MailChimp $apiClient - */ public function __construct(MailChimp $apiClient) { $this->apiClient = $apiClient; @@ -69,7 +66,6 @@ public function getListResourceUrl($listId, $subResource = null) /** * Get remote mailchimp ID as stored in export notes * - * @param ElementInterface $object * @param string $listId * * @return string|null @@ -101,7 +97,6 @@ public function getObjectByRemoteId($remoteId) } /** - * @param ElementInterface $object * @param string $listId * * @return bool @@ -149,10 +144,8 @@ public function getExportNoteType() } /** - * @param ElementInterface $object * @param string $listId * @param string $remoteId - * @param \DateTime|null $date * * @return Note */ @@ -181,7 +174,6 @@ public function createExportNote(ElementInterface $object, $listId, $remoteId, \ } /** - * @param ElementInterface $object * @param string $listId * @param bool $refresh * @@ -209,7 +201,6 @@ public function getExportNotes(ElementInterface $object, $listId, $refresh = fal } /** - * @param ElementInterface $object * @param string $listId * @param bool $refresh * @@ -227,7 +218,6 @@ public function getLastExportNote(ElementInterface $object, $listId, $refresh = } /** - * @param ElementInterface $object * @param string $listId * @param array $exportData * @@ -249,7 +239,6 @@ public function didExportDataChangeSinceLastExport(ElementInterface $object, $li } /** - * @param ElementInterface $object * @param string $listId * * @return \DateTime|null @@ -276,7 +265,6 @@ public function getMd5($data) } /** - * @param Note $note * * @return \DateTime */ diff --git a/src/Newsletter/ProviderHandler/Mailchimp/SegmentExporter.php b/src/Newsletter/ProviderHandler/Mailchimp/SegmentExporter.php index b919cd55..29be6c01 100644 --- a/src/Newsletter/ProviderHandler/Mailchimp/SegmentExporter.php +++ b/src/Newsletter/ProviderHandler/Mailchimp/SegmentExporter.php @@ -38,7 +38,6 @@ public function __construct() /** * Export a segment group * - * @param CustomerSegmentGroup $group * @param bool $forceCreate * * @return null|string @@ -67,7 +66,7 @@ public function exportGroup(CustomerSegmentGroup $group, Newsletter\ProviderHand $group->getName() ), [ - 'relatedObject' => $group + 'relatedObject' => $group, ] ); } @@ -81,7 +80,7 @@ public function exportGroup(CustomerSegmentGroup $group, Newsletter\ProviderHand $group->getName() ), [ - 'relatedObject' => $group + 'relatedObject' => $group, ] ); @@ -109,7 +108,7 @@ public function exportGroup(CustomerSegmentGroup $group, Newsletter\ProviderHand $remoteGroupId ), [ - 'relatedObject' => $group + 'relatedObject' => $group, ] ); @@ -125,7 +124,7 @@ public function exportGroup(CustomerSegmentGroup $group, Newsletter\ProviderHand $remoteGroupId ), [ - 'relatedObject' => $group + 'relatedObject' => $group, ] ); @@ -148,7 +147,7 @@ public function exportGroup(CustomerSegmentGroup $group, Newsletter\ProviderHand $remoteGroupId ), [ - 'relatedObject' => $group + 'relatedObject' => $group, ] ); @@ -167,7 +166,7 @@ public function exportGroup(CustomerSegmentGroup $group, Newsletter\ProviderHand $apiClient->getLastResponse()['body'] ), [ - 'relatedObject' => $group + 'relatedObject' => $group, ] ); @@ -180,7 +179,7 @@ public function exportGroup(CustomerSegmentGroup $group, Newsletter\ProviderHand $group->getName() ), [ - 'relatedObject' => $group + 'relatedObject' => $group, ] ); @@ -196,8 +195,6 @@ public function exportGroup(CustomerSegmentGroup $group, Newsletter\ProviderHand /** * Export a segment * - * @param CustomerSegment $segment - * @param Newsletter\ProviderHandler\Mailchimp $mailchimpProviderHandler * @param string $remoteGroupId * @param bool $forceCreate * @param bool $forceUpdate @@ -224,7 +221,7 @@ public function exportSegment(CustomerSegment $segment, Newsletter\ProviderHandl $segment->getName() ), [ - 'relatedObject' => $segment + 'relatedObject' => $segment, ] ); } @@ -237,7 +234,7 @@ public function exportSegment(CustomerSegment $segment, Newsletter\ProviderHandl $segment->getName() ), [ - 'relatedObject' => $segment + 'relatedObject' => $segment, ] ); $result = $apiClient->post( @@ -264,7 +261,7 @@ public function exportSegment(CustomerSegment $segment, Newsletter\ProviderHandl $remoteSegmentId ), [ - 'relatedObject' => $segment + 'relatedObject' => $segment, ] ); @@ -280,7 +277,7 @@ public function exportSegment(CustomerSegment $segment, Newsletter\ProviderHandl $remoteSegmentId ), [ - 'relatedObject' => $segment + 'relatedObject' => $segment, ] ); $result = $apiClient->patch( @@ -301,7 +298,7 @@ public function exportSegment(CustomerSegment $segment, Newsletter\ProviderHandl $remoteGroupId ), [ - 'relatedObject' => $segment + 'relatedObject' => $segment, ] ); // add note @@ -319,7 +316,7 @@ public function exportSegment(CustomerSegment $segment, Newsletter\ProviderHandl $apiClient->getLastResponse()['body'] ), [ - 'relatedObject' => $segment + 'relatedObject' => $segment, ] ); // we tried to edit a resource which doesn't exist (anymore) - fall back to create @@ -332,7 +329,7 @@ public function exportSegment(CustomerSegment $segment, Newsletter\ProviderHandl $segment->getName() ), [ - 'relatedObject' => $segment + 'relatedObject' => $segment, ] ); @@ -348,8 +345,6 @@ public function exportSegment(CustomerSegment $segment, Newsletter\ProviderHandl /** * deletes all segments from given $remoteGroupId in mailchimp which are not within the given $existingSegmentIds array * - * @param array $existingSegmentIds - * @param Newsletter\ProviderHandler\Mailchimp $mailchimpProviderHandler * @param string $remoteGroupId */ public function deleteNonExistingSegmentsFromGroup(array $existingSegmentIds, Newsletter\ProviderHandler\Mailchimp $mailchimpProviderHandler, $remoteGroupId) @@ -400,8 +395,6 @@ public function deleteNonExistingSegmentsFromGroup(array $existingSegmentIds, Ne /** * deletes all groups in mailchimp which are not within the given $existingGroupIds array * - * @param array $existingGroupIds - * @param Newsletter\ProviderHandler\Mailchimp $mailchimpProviderHandler */ public function deleteNonExistingGroups(array $existingGroupIds, Newsletter\ProviderHandler\Mailchimp $mailchimpProviderHandler) { @@ -434,7 +427,6 @@ public function getLastCreatedGroupRemoteId() /** * @param string $remoteGroupId - * @param Newsletter\ProviderHandler\Mailchimp $mailchimpProviderHandler */ private function deleteGroupByRemoteId($remoteGroupId, Newsletter\ProviderHandler\Mailchimp $mailchimpProviderHandler) { @@ -452,7 +444,7 @@ private function deleteGroupByRemoteId($remoteGroupId, Newsletter\ProviderHandle $remoteGroupId ), [ - 'relatedObject' => $group + 'relatedObject' => $group, ] ); } else { @@ -481,7 +473,7 @@ private function deleteGroupByRemoteId($remoteGroupId, Newsletter\ProviderHandle $apiClient->getLastResponse()['body'] ), [ - 'relatedObject' => $group + 'relatedObject' => $group, ] ); } diff --git a/src/Newsletter/ProviderHandler/Mailchimp/TemplateExporter.php b/src/Newsletter/ProviderHandler/Mailchimp/TemplateExporter.php index b2540caa..881f2406 100644 --- a/src/Newsletter/ProviderHandler/Mailchimp/TemplateExporter.php +++ b/src/Newsletter/ProviderHandler/Mailchimp/TemplateExporter.php @@ -95,7 +95,7 @@ public function exportTemplate(Document\PageSnippet $document) $result = $apiClient->patch("templates/$remoteId", [ 'name' => $templateName, - 'html' => $html + 'html' => $html, ]); } else { $this->getLogger()->info( @@ -108,7 +108,7 @@ public function exportTemplate(Document\PageSnippet $document) $result = $apiClient->post('templates', [ 'name' => $templateName, - 'html' => $html + 'html' => $html, ]); } @@ -125,7 +125,7 @@ public function exportTemplate(Document\PageSnippet $document) $apiClient->getLastResponse()['body'] ), [ - 'relatedObject' => $document + 'relatedObject' => $document, ] ); @@ -134,9 +134,7 @@ public function exportTemplate(Document\PageSnippet $document) } /** - * @param Document\PageSnippet $document * - * @return Mailchimp * * @throws \Exception */ diff --git a/src/Newsletter/ProviderHandler/Mailchimp/UpdateFromMailchimpProcessor.php b/src/Newsletter/ProviderHandler/Mailchimp/UpdateFromMailchimpProcessor.php index 305cd664..485fad6d 100644 --- a/src/Newsletter/ProviderHandler/Mailchimp/UpdateFromMailchimpProcessor.php +++ b/src/Newsletter/ProviderHandler/Mailchimp/UpdateFromMailchimpProcessor.php @@ -38,8 +38,6 @@ public function __construct( * This updates the instance only but applies no save of the customer! * Returns true if any status changed during the method. * - * @param Mailchimp $mailchimpHandler - * @param MailchimpAwareCustomerInterface $customer * @param string $mailchimpStatus * * @return bool @@ -61,9 +59,6 @@ public function updateNewsletterStatus(Mailchimp $mailchimpHandler, MailchimpAwa } /** - * @param Mailchimp $mailchimpHandler - * @param MailchimpAwareCustomerInterface $customer - * @param array $mergeFieldData * * @return bool */ @@ -114,9 +109,6 @@ public function getUser() return $this->user; } - /** - * @param User $user - */ public function setUser(User $user) { $this->user = $user; diff --git a/src/Newsletter/ProviderHandler/NewsletterProviderHandlerInterface.php b/src/Newsletter/ProviderHandler/NewsletterProviderHandlerInterface.php index c5186df0..857ccafa 100644 --- a/src/Newsletter/ProviderHandler/NewsletterProviderHandlerInterface.php +++ b/src/Newsletter/ProviderHandler/NewsletterProviderHandlerInterface.php @@ -48,7 +48,6 @@ public function updateSegmentGroups($forceUpdate = false); /** * Subscribe customer to newsletter (for example via web form). Returns true if it was successful. * - * @param NewsletterAwareCustomerInterface $customer * * @return bool */ @@ -57,7 +56,6 @@ public function subscribeCustomer(NewsletterAwareCustomerInterface $customer); /** * Unsubscribe customer from newsletter (for example via web form). Returns true if it was successful. * - * @param NewsletterAwareCustomerInterface $customer * * @return bool */ diff --git a/src/Newsletter/Queue/DefaultNewsletterQueue.php b/src/Newsletter/Queue/DefaultNewsletterQueue.php index af80cc2a..e894025d 100644 --- a/src/Newsletter/Queue/DefaultNewsletterQueue.php +++ b/src/Newsletter/Queue/DefaultNewsletterQueue.php @@ -22,6 +22,7 @@ use CustomerManagementFrameworkBundle\Newsletter\Queue\Item\DefaultNewsletterQueueItem; use CustomerManagementFrameworkBundle\Newsletter\Queue\Item\NewsletterQueueItemInterface; use CustomerManagementFrameworkBundle\Traits\ApplicationLoggerAware; +use Knp\Bundle\PaginatorBundle\Pagination\SlidingPaginationInterface; use Knp\Component\Pager\PaginatorInterface; use Pimcore\Db; use Pimcore\Model\DataObject\Service; @@ -53,7 +54,6 @@ public function __construct(PaginatorInterface $paginator, $maxItemsPerRound = 5 } /** - * @param NewsletterAwareCustomerInterface $customer * @param string $operation * @param string|null $email * @param bool $immediateAsyncProcessQueueItem @@ -86,9 +86,6 @@ private function addImmidiateAsyncQueueItem(NewsletterAwareCustomerInterface $cu $this->immidateAsyncQueueItems[$customer->getId() . '_' . $operation] = $item; } - /** - * @inheritdoc - */ public function executeImmidiateAsyncQueueItems() { if (!sizeof($this->immidateAsyncQueueItems)) { @@ -124,8 +121,6 @@ public function processQueue(array $newsletterProviderHandlers, $forceAllCustome } /** - * @param array $newsletterProviderHandler - * @param NewsletterQueueItemInterface $newsletterQueueItem * * @return void */ @@ -135,7 +130,6 @@ public function syncSingleQueueItem(array $newsletterProviderHandler, Newsletter } /** - * @param NewsletterQueueItemInterface $item * * @return void */ @@ -145,11 +139,11 @@ public function removeFromQueue(NewsletterQueueItemInterface $item) if (!is_null($item->getEmail())) { $db->executeQuery('delete from ' . self::QUEUE_TABLE . ' where customerId = ? and email = ? and operation = ? and modificationDate = ?', [ - $item->getCustomerId(), $item->getEmail(), $item->getOperation(), $item->getModificationDate() + $item->getCustomerId(), $item->getEmail(), $item->getOperation(), $item->getModificationDate(), ]); } else { $db->executeQuery('delete from ' . self::QUEUE_TABLE . ' where customerId = ? and email is null and operation = ? and modificationDate = ?', [ - $item->getCustomerId(), $item->getOperation(), $item->getModificationDate() + $item->getCustomerId(), $item->getOperation(), $item->getModificationDate(), ]); } @@ -213,24 +207,26 @@ protected function processAllItems(array $newsletterProviderHandlers, $forceUpda $list = $customerProvider->getList(); $paginator = $this->paginator->paginate($list, 1, $this->maxItemsPerRound); - $pageCount = $paginator->getPaginationData()['pageCount']; - - for ($i = 1; $i <= $pageCount; $i++) { - $paginator = $this->paginator->paginate($list, $i, $this->maxItemsPerRound); - $items = []; - foreach ($paginator as $customer) { - if ($item = $this->createUpdateItem($customer)) { - $items[] = $item; + if ($paginator instanceof SlidingPaginationInterface) { + $pageCount = $paginator->getPaginationData()['pageCount']; + + for ($i = 1; $i <= $pageCount; $i++) { + $paginator = $this->paginator->paginate($list, $i, $this->maxItemsPerRound); + $items = []; + foreach ($paginator as $customer) { + if ($item = $this->createUpdateItem($customer)) { + $items[] = $item; + } } - } - try { - $this->processQueueItems($newsletterProviderHandlers, $items, $forceUpdate); - } catch (\Exception $e) { - $this->getLogger()->error('newsletter queue processing exception: ' . $e->getMessage()); - } + try { + $this->processQueueItems($newsletterProviderHandlers, $items, $forceUpdate); + } catch (\Exception $e) { + $this->getLogger()->error('newsletter queue processing exception: ' . $e->getMessage()); + } - \Pimcore::collectGarbage(); + \Pimcore::collectGarbage(); + } } } @@ -249,20 +245,22 @@ protected function processItemsFromQueue(array $newsletterProviderHandlers, $for $rows = $db->fetchAllAssociative((string)$select); $paginator = $this->paginator->paginate($rows, 1, $this->maxItemsPerRound); - $pageCount = $paginator->getPaginationData()['pageCount']; - - for ($i = 1; $i <= $pageCount; $i++) { - $paginator = $this->paginator->paginate($rows, $i, $this->maxItemsPerRound); - $items = []; - foreach ($paginator as $row) { - if ($item = $this->createItemFromData($row)) { - $items[] = $item; + if ($paginator instanceof SlidingPaginationInterface) { + $pageCount = $paginator->getPaginationData()['pageCount']; + + for ($i = 1; $i <= $pageCount; $i++) { + $paginator = $this->paginator->paginate($rows, $i, $this->maxItemsPerRound); + $items = []; + foreach ($paginator as $row) { + if ($item = $this->createItemFromData($row)) { + $items[] = $item; + } } - } - $this->processQueueItems($newsletterProviderHandlers, $items, $forceUpdate); + $this->processQueueItems($newsletterProviderHandlers, $items, $forceUpdate); - \Pimcore::collectGarbage(); + \Pimcore::collectGarbage(); + } } } @@ -317,6 +315,7 @@ protected function checkSuccessfullItems(array &$successfullItems, array $proces foreach ($successfullItems as $successfullItem) { if ($successfullItem == $item) { $result[] = $item; + break; } } @@ -342,7 +341,6 @@ protected function createUpdateItem(CustomerInterface $customer) } /** - * @param array $data * * @return NewsletterQueueItemInterface|false */ diff --git a/src/Newsletter/Queue/Item/DefaultNewsletterQueueItem.php b/src/Newsletter/Queue/Item/DefaultNewsletterQueueItem.php index cbe0e274..b417be22 100644 --- a/src/Newsletter/Queue/Item/DefaultNewsletterQueueItem.php +++ b/src/Newsletter/Queue/Item/DefaultNewsletterQueueItem.php @@ -140,7 +140,7 @@ public function toJson() 'customerId' => $this->customerId, 'operation' => $this->operation, 'email' => $this->email, - 'modificationDate' => $this->modificationDate + 'modificationDate' => $this->modificationDate, ]); } } diff --git a/src/Newsletter/Queue/NewsletterQueueInterface.php b/src/Newsletter/Queue/NewsletterQueueInterface.php index 15db3091..2940827f 100644 --- a/src/Newsletter/Queue/NewsletterQueueInterface.php +++ b/src/Newsletter/Queue/NewsletterQueueInterface.php @@ -22,10 +22,10 @@ interface NewsletterQueueInterface { const OPERATION_UPDATE = 'update'; + const OPERATION_DELETE = 'delete'; /** - * @param NewsletterAwareCustomerInterface $customer * @param string $operation * @param string|null $email * @param bool $immediateAsyncProcessQueueItem @@ -44,15 +44,12 @@ public function enqueueCustomer(NewsletterAwareCustomerInterface $customer, $ope public function processQueue(array $newsletterProviderHandler, $forceAllCustomers = false, $forceUpdate = false); /** - * @param array $newsletterProviderHandler - * @param NewsletterQueueItemInterface $newsletterQueueItem * * @return void */ public function syncSingleQueueItem(array $newsletterProviderHandler, NewsletterQueueItemInterface $newsletterQueueItem); /** - * @param NewsletterQueueItemInterface $item * * @return void */ diff --git a/src/PimcoreCustomerManagementFrameworkBundle.php b/src/PimcoreCustomerManagementFrameworkBundle.php index b80fd883..77e80ea8 100644 --- a/src/PimcoreCustomerManagementFrameworkBundle.php +++ b/src/PimcoreCustomerManagementFrameworkBundle.php @@ -59,7 +59,7 @@ public function getJsPaths(): array '/bundles/pimcorecustomermanagementframework/js/pimcore/targeting/actions.js', '/bundles/pimcorecustomermanagementframework/js/pimcore/targeting/conditions.js', '/bundles/pimcorecustomermanagementframework/js/SegmentAddressSource.js', - '/bundles/pimcorecustomermanagementframework/js/WebserviceConfigurationView.js' + '/bundles/pimcorecustomermanagementframework/js/WebserviceConfigurationView.js', ]; } diff --git a/src/RESTApi/AbstractHandler.php b/src/RESTApi/AbstractHandler.php index 7168ba5a..15fe0b0b 100644 --- a/src/RESTApi/AbstractHandler.php +++ b/src/RESTApi/AbstractHandler.php @@ -32,9 +32,6 @@ abstract class AbstractHandler implements HandlerInterface */ protected $paginator; - /** - * @param PaginatorInterface $paginator - */ public function __construct(PaginatorInterface $paginator) { $this->paginator = $paginator; @@ -42,11 +39,9 @@ public function __construct(PaginatorInterface $paginator) /** * @param mixed $listing - * @param Request $request * @param int $defaultPageSize * @param int $defaultPage * - * @return PaginationInterface */ protected function handlePaginatorParams( $listing, @@ -63,7 +58,6 @@ protected function handlePaginatorParams( /** * Parse request body JSON * - * @param Request $request * * @return array */ diff --git a/src/RESTApi/ActivitiesHandler.php b/src/RESTApi/ActivitiesHandler.php index 3a5ac05e..cc5a4903 100644 --- a/src/RESTApi/ActivitiesHandler.php +++ b/src/RESTApi/ActivitiesHandler.php @@ -24,6 +24,7 @@ use CustomerManagementFrameworkBundle\RESTApi\Traits\ResourceUrlGenerator; use CustomerManagementFrameworkBundle\RESTApi\Traits\ResponseGenerator; use CustomerManagementFrameworkBundle\Traits\LoggerAware; +use Knp\Bundle\PaginatorBundle\Pagination\SlidingPaginationInterface; use Symfony\Component\HttpFoundation\Request; class ActivitiesHandler extends AbstractHandler implements CrudHandlerInterface @@ -35,7 +36,6 @@ class ActivitiesHandler extends AbstractHandler implements CrudHandlerInterface /** * GET /activities * - * @param Request $request * * @return Response */ @@ -56,7 +56,7 @@ public function listRecords(Request $request) $result = [ 'page' => $page, - 'totalPages' => $paginator->getPaginationData()['pageCount'], + 'totalPages' => $paginator instanceof SlidingPaginationInterface ? $paginator->getPaginationData()['pageCount'] : 0, 'timestamp' => $timestamp, 'data' => [], ]; @@ -75,7 +75,6 @@ public function listRecords(Request $request) /** * GET /activities/{id} * - * @param Request $request * * @return Response */ @@ -89,7 +88,6 @@ public function readRecord(Request $request) /** * POST /activities * - * @param Request $request * * @return Response */ @@ -160,7 +158,6 @@ public function createRecord(Request $request) * * TODO support partial updates as we do now or demand whole object in PUT? Use PATCH for partial requests? * - * @param Request $request * * @return Response */ @@ -202,7 +199,6 @@ public function updateRecord(Request $request) /** * DELETE /{id} * - * @param Request $request * * @return Response */ @@ -267,7 +263,6 @@ protected function loadActivityStoreEntry($id) /** * Create customer response with hydrated customer data * - * @param ActivityStoreEntryInterface $activityStoreEntry * * @return Response */ @@ -281,7 +276,6 @@ protected function createActivityEntryResponse(ActivityStoreEntryInterface $acti } /** - * @param ActivityStoreEntryInterface $activityStoreEntry * * @return array */ diff --git a/src/RESTApi/CrudHandlerInterface.php b/src/RESTApi/CrudHandlerInterface.php index 46b34fe8..bdf37e86 100644 --- a/src/RESTApi/CrudHandlerInterface.php +++ b/src/RESTApi/CrudHandlerInterface.php @@ -22,7 +22,6 @@ interface CrudHandlerInterface /** * GET / * - * @param Request $request * * @return Response */ @@ -31,7 +30,6 @@ public function listRecords(Request $request); /** * GET /{id} * - * @param Request $request * * @return Response */ @@ -40,7 +38,6 @@ public function readRecord(Request $request); /** * POST / * - * @param Request $request * * @return Response */ @@ -51,7 +48,6 @@ public function createRecord(Request $request); * * TODO support partial updates as we do now or demand whole object in PUT? Use PATCH for partial requests? * - * @param Request $request * * @return Response */ @@ -60,7 +56,6 @@ public function updateRecord(Request $request); /** * DELETE /{id} * - * @param Request $request * * @return Response */ diff --git a/src/RESTApi/CustomersHandler.php b/src/RESTApi/CustomersHandler.php index 732f4f03..642b54b2 100644 --- a/src/RESTApi/CustomersHandler.php +++ b/src/RESTApi/CustomersHandler.php @@ -22,6 +22,7 @@ use CustomerManagementFrameworkBundle\RESTApi\Traits\ResourceUrlGenerator; use CustomerManagementFrameworkBundle\RESTApi\Traits\ResponseGenerator; use CustomerManagementFrameworkBundle\Traits\LoggerAware; +use Knp\Bundle\PaginatorBundle\Pagination\SlidingPaginationInterface; use Knp\Component\Pager\PaginatorInterface; use Pimcore\Model\DataObject\Customer; use Pimcore\Model\DataObject\Service; @@ -38,9 +39,6 @@ class CustomersHandler extends AbstractHandler implements CrudHandlerInterface */ protected $customerProvider; - /** - * @param CustomerProviderInterface $customerProvider - */ public function __construct(PaginatorInterface $paginator, CustomerProviderInterface $customerProvider) { parent::__construct($paginator); @@ -50,7 +48,6 @@ public function __construct(PaginatorInterface $paginator, CustomerProviderInter /** * GET /customers * - * @param Request $request * * @return Response */ @@ -89,7 +86,7 @@ public function listRecords(Request $request) return new Response( [ 'page' => $paginator->getCurrentPageNumber(), - 'totalPages' => $paginator->getPaginationData()['pageCount'], + 'totalPages' => $paginator instanceof SlidingPaginationInterface ? $paginator->getPaginationData()['pageCount'] : 0, 'timestamp' => $timestamp, 'data' => $result, ] @@ -99,7 +96,6 @@ public function listRecords(Request $request) /** * GET /customers/{id} * - * @param Request $request * * @return Response */ @@ -113,7 +109,6 @@ public function readRecord(Request $request) /** * POST /customers * - * @param Request $request * * @return Response */ @@ -139,7 +134,6 @@ public function createRecord(Request $request) * * TODO support partial updates as we do now or demand whole object in PUT? Use PATCH for partial requests? * - * @param Request $request * * @return Response */ @@ -161,7 +155,6 @@ public function updateRecord(Request $request) /** * DELETE /customers/{id} * - * @param Request $request * * @return Response */ @@ -211,9 +204,6 @@ protected function loadCustomer($id) /** * Create customer response with hydrated customer data * - * @param CustomerInterface $customer - * @param Request $request - * @param ExportCustomersFilterParams|null $params * * @return Response */ @@ -234,8 +224,6 @@ protected function createCustomerResponse( } /** - * @param CustomerInterface $customer - * @param ExportCustomersFilterParams $params * * @return array */ diff --git a/src/RESTApi/DeletionsHandler.php b/src/RESTApi/DeletionsHandler.php index 5ba7b6e6..0cba57ae 100644 --- a/src/RESTApi/DeletionsHandler.php +++ b/src/RESTApi/DeletionsHandler.php @@ -25,7 +25,6 @@ class DeletionsHandler extends AbstractHandler /** * GET /deletions * - * @param Request $request */ public function listRecords(Request $request) { diff --git a/src/RESTApi/Response.php b/src/RESTApi/Response.php index ed26db64..f7b96485 100644 --- a/src/RESTApi/Response.php +++ b/src/RESTApi/Response.php @@ -20,8 +20,12 @@ class Response extends JsonResponse { const RESPONSE_CODE_OK = 200; + const RESPONSE_CODE_CREATED = 201; + const RESPONSE_CODE_NO_CONTENT = 204; + const RESPONSE_CODE_BAD_REQUEST = 400; + const RESPONSE_CODE_NOT_FOUND = 404; } diff --git a/src/RESTApi/SegmentGroupsHandler.php b/src/RESTApi/SegmentGroupsHandler.php index c7513a58..bd3fe50d 100644 --- a/src/RESTApi/SegmentGroupsHandler.php +++ b/src/RESTApi/SegmentGroupsHandler.php @@ -20,6 +20,7 @@ use CustomerManagementFrameworkBundle\RESTApi\Traits\ResponseGenerator; use CustomerManagementFrameworkBundle\Service\ObjectToArray; use CustomerManagementFrameworkBundle\Traits\LoggerAware; +use Knp\Bundle\PaginatorBundle\Pagination\SlidingPaginationInterface; use Pimcore\Model\DataObject\CustomerSegmentGroup; use Pimcore\Model\DataObject\Service; use Symfony\Component\HttpFoundation\Request; @@ -33,7 +34,6 @@ class SegmentGroupsHandler extends AbstractHandler implements CrudHandlerInterfa /** * GET /segment-groups * - * @param Request $request * * @return Response */ @@ -57,7 +57,7 @@ public function listRecords(Request $request) return new Response( [ 'page' => $paginator->getCurrentPageNumber(), - 'totalPages' => $paginator->getPaginationData()['pageCount'], + 'totalPages' => $paginator instanceof SlidingPaginationInterface ? $paginator->getPaginationData()['pageCount'] : 0, 'timestamp' => $timestamp, 'data' => $result, ] @@ -67,7 +67,6 @@ public function listRecords(Request $request) /** * GET /segments/{id} * - * @param Request $request * * @return Response */ @@ -81,7 +80,6 @@ public function readRecord(Request $request) /** * POST /segments * - * @param Request $request * * @return Response */ @@ -100,9 +98,9 @@ public function createRecord(Request $request) } if ($data['reference'] && \Pimcore::getContainer()->get('cmf.segment_manager')->getSegmentGroupByReference( - $data['reference'], - (bool)$data['calculated'] - ) + $data['reference'], + (bool)$data['calculated'] + ) ) { return new Response( [ @@ -134,7 +132,6 @@ public function createRecord(Request $request) * * TODO support partial updates as we do now or demand whole object in PUT? Use PATCH for partial requests? * - * @param Request $request * * @return Response */ @@ -176,7 +173,6 @@ public function updateRecord(Request $request) /** * DELETE /segments/{id} * - * @param Request $request * * @return Response */ @@ -226,7 +222,6 @@ protected function loadSegmentGroup($id) /** * Create customer segment response with hydrated segment data * - * @param CustomerSegmentGroup $segmentGroup * * @return Response */ @@ -240,7 +235,6 @@ protected function createSegmentGroupResponse(CustomerSegmentGroup $segmentGroup } /** - * @param CustomerSegmentGroup $customerSegmentGroup * * @return array */ diff --git a/src/RESTApi/SegmentsHandler.php b/src/RESTApi/SegmentsHandler.php index 1497a4f8..b10bc942 100644 --- a/src/RESTApi/SegmentsHandler.php +++ b/src/RESTApi/SegmentsHandler.php @@ -20,6 +20,7 @@ use CustomerManagementFrameworkBundle\RESTApi\Traits\ResourceUrlGenerator; use CustomerManagementFrameworkBundle\RESTApi\Traits\ResponseGenerator; use CustomerManagementFrameworkBundle\Traits\LoggerAware; +use Knp\Bundle\PaginatorBundle\Pagination\SlidingPaginationInterface; use Pimcore\Model\DataObject\Concrete; use Pimcore\Model\DataObject\CustomerSegment; use Pimcore\Model\DataObject\CustomerSegmentGroup; @@ -35,7 +36,6 @@ class SegmentsHandler extends AbstractHandler implements CrudHandlerInterface /** * GET /segments * - * @param Request $request * * @return Response */ @@ -59,7 +59,7 @@ public function listRecords(Request $request) return new Response( [ 'page' => $paginator->getCurrentPageNumber(), - 'totalPages' => $paginator->getPaginationData()['pageCount'], + 'totalPages' => $paginator instanceof SlidingPaginationInterface ? $paginator->getPaginationData()['pageCount'] : 0, 'timestamp' => $timestamp, 'data' => $result, ] @@ -69,7 +69,6 @@ public function listRecords(Request $request) /** * GET /segments/{id} * - * @param Request $request * * @return Response */ @@ -83,7 +82,6 @@ public function readRecord(Request $request) /** * POST /segments * - * @param Request $request * * @return Response */ @@ -121,9 +119,9 @@ public function createRecord(Request $request) } if ($data['reference'] && \Pimcore::getContainer()->get('cmf.segment_manager')->getSegmentByReference( - $data['reference'], - $segmentGroup - ) + $data['reference'], + $segmentGroup + ) ) { return new Response( [ @@ -158,7 +156,6 @@ public function createRecord(Request $request) * * TODO support partial updates as we do now or demand whole object in PUT? Use PATCH for partial requests? * - * @param Request $request * * @return Response */ @@ -197,7 +194,6 @@ public function updateRecord(Request $request) /** * DELETE /segments/{id} * - * @param Request $request * * @return Response */ @@ -247,7 +243,6 @@ protected function loadSegment($id) /** * Create customer segment response with hydrated segment data * - * @param CustomerSegmentInterface $segment * * @return Response */ @@ -261,7 +256,6 @@ protected function createSegmentResponse(CustomerSegmentInterface $segment) } /** - * @param CustomerSegmentInterface $customerSegment * * @return array */ diff --git a/src/RESTApi/SegmentsOfCustomerHandler.php b/src/RESTApi/SegmentsOfCustomerHandler.php index 543e6999..13e9b2a0 100644 --- a/src/RESTApi/SegmentsOfCustomerHandler.php +++ b/src/RESTApi/SegmentsOfCustomerHandler.php @@ -38,7 +38,6 @@ protected function getRoutes() /** * POST /segments-of-customer * - * @param Request $request */ public function updateRecords(Request $request) { diff --git a/src/RESTApi/Traits/ResponseGenerator.php b/src/RESTApi/Traits/ResponseGenerator.php index c54fd97e..dc16bf90 100644 --- a/src/RESTApi/Traits/ResponseGenerator.php +++ b/src/RESTApi/Traits/ResponseGenerator.php @@ -22,7 +22,6 @@ trait ResponseGenerator /** * Create a JSON response with normalized body containing timestamp * - * @param array|null $data * @param int $code * * @return Response diff --git a/src/Security/Authentication/LoginManager.php b/src/Security/Authentication/LoginManager.php index dc2d61ab..960a3666 100644 --- a/src/Security/Authentication/LoginManager.php +++ b/src/Security/Authentication/LoginManager.php @@ -84,9 +84,6 @@ public function __construct( $this->container = $container; } - /** - * @inheritdoc - */ public function login(UserInterface $user, Request $request = null, Response $response = null) { if (null === $request) { diff --git a/src/Security/Authentication/LoginManagerInterface.php b/src/Security/Authentication/LoginManagerInterface.php index e1acae74..b54b0ec2 100644 --- a/src/Security/Authentication/LoginManagerInterface.php +++ b/src/Security/Authentication/LoginManagerInterface.php @@ -26,9 +26,6 @@ interface LoginManagerInterface /** * Handles manual login of a user (e.g. after registration) * - * @param UserInterface $user - * @param Request|null $request - * @param Response|null $response */ public function login(UserInterface $user, Request $request = null, Response $response = null); } diff --git a/src/Security/Authenticator/WebserviceAuthenticator.php b/src/Security/Authenticator/WebserviceAuthenticator.php index 155cbe32..1889bf29 100644 --- a/src/Security/Authenticator/WebserviceAuthenticator.php +++ b/src/Security/Authenticator/WebserviceAuthenticator.php @@ -40,11 +40,9 @@ class WebserviceAuthenticator extends AbstractAuthenticator implements Interacti use LoggerAwareTrait; const SETTINGS_STORE_KEY = 'api_keys'; + const SETTINGS_STORE_SCOPE = 'cmf'; - /** - * {@inheritdoc} - */ public function supports(Request $request): ?bool { return true; @@ -54,9 +52,7 @@ public function supports(Request $request): ?bool * Get the authentication credentials from the request as any an associate array. * Check credentials in the passport through CustomCredentials * - * @param Request $request * - * @return Passport */ public function authenticate(Request $request): Passport { @@ -113,9 +109,6 @@ protected function loadUserForApiKey($apiKey) return null; } - /** - * @inheritDoc - */ public function onAuthenticationFailure(Request $request, AuthenticationException $exception): ?Response { $this->logger->warning('Failed to authenticate for webservice request {path}', [ @@ -125,9 +118,6 @@ public function onAuthenticationFailure(Request $request, AuthenticationExceptio throw $this->createAccessDeniedException($exception); } - /** - * @inheritDoc - */ public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $firewallName): ?Response { $this->logger->debug('Successfully authenticated user {user} for webservice request {path}', [ @@ -138,9 +128,6 @@ public function onAuthenticationSuccess(Request $request, TokenInterface $token, return null; } - /** - * @inheritDoc - */ public function isInteractive(): bool { return true; diff --git a/src/Security/UserProvider/CustomerObjectUserProvider.php b/src/Security/UserProvider/CustomerObjectUserProvider.php index 6e4ceb21..97f99a7c 100644 --- a/src/Security/UserProvider/CustomerObjectUserProvider.php +++ b/src/Security/UserProvider/CustomerObjectUserProvider.php @@ -43,11 +43,6 @@ public function __construct( $this->usernameField = $usernameField; } - /** - * @inheritdoc - * - * @return UserInterface - */ public function loadUserByIdentifier(string $identifier): UserInterface { $list = $this->customerProvider->getList(); @@ -67,7 +62,7 @@ public function loadUserByIdentifier(string $identifier): UserInterface /** * @deprecated use loadUserByIdentifier() instead. * - * @inheritdoc + * */ public function loadUserByUsername($username) { @@ -75,7 +70,7 @@ public function loadUserByUsername($username) } /** - * @inheritdoc + * * * @return UserInterface */ @@ -96,7 +91,7 @@ public function refreshUser(UserInterface $user) } /** - * @inheritdoc + * * * @return bool */ diff --git a/src/SegmentAssignment/Indexer/Indexer.php b/src/SegmentAssignment/Indexer/Indexer.php index 2817a2e7..82f7fc1e 100644 --- a/src/SegmentAssignment/Indexer/Indexer.php +++ b/src/SegmentAssignment/Indexer/Indexer.php @@ -57,13 +57,6 @@ class Indexer implements IndexerInterface */ private $db = null; - /** - * @param string $segmentAssignmentTable - * @param string $segmentAssignmentIndexTable - * @param string $segmentAssignmentQueueTable - * @param StoredFunctionsInterface $storedFunctions - * @param QueueBuilderInterface $queueBuilder - */ public function __construct(string $segmentAssignmentTable, string $segmentAssignmentIndexTable, string $segmentAssignmentQueueTable, StoredFunctionsInterface $storedFunctions, QueueBuilderInterface $queueBuilder) { $this->setSegmentAssignmentTable($segmentAssignmentTable); @@ -73,81 +66,51 @@ public function __construct(string $segmentAssignmentTable, string $segmentAssig $this->setQueueBuilder($queueBuilder); } - /** - * @return string - */ public function getSegmentAssignmentTable(): string { return $this->segmentAssignmentTable; } - /** - * @param string $segmentAssignmentTable - */ public function setSegmentAssignmentTable(string $segmentAssignmentTable) { $this->segmentAssignmentTable = $segmentAssignmentTable; } - /** - * @return string - */ public function getSegmentAssignmentIndexTable(): string { return $this->segmentAssignmentIndexTable; } - /** - * @param string $segmentAssignmentIndexTable - */ public function setSegmentAssignmentIndexTable(string $segmentAssignmentIndexTable) { $this->segmentAssignmentIndexTable = $segmentAssignmentIndexTable; } - /** - * @return string - */ public function getSegmentAssignmentQueueTable(): string { return $this->segmentAssignmentQueueTable; } - /** - * @param string $segmentAssignmentQueueTable - */ public function setSegmentAssignmentQueueTable(string $segmentAssignmentQueueTable) { $this->segmentAssignmentQueueTable = $segmentAssignmentQueueTable; } - /** - * @return StoredFunctionsInterface - */ public function getStoredFunctions(): StoredFunctionsInterface { return $this->storedFunctions; } - /** - * @param StoredFunctionsInterface $storedFunctions - */ public function setStoredFunctions(StoredFunctionsInterface $storedFunctions) { $this->storedFunctions = $storedFunctions; } - /** - * @return QueueBuilderInterface - */ public function getQueueBuilder(): QueueBuilderInterface { return $this->queueBuilder; } - /** - * @param QueueBuilderInterface $queueBuilder - */ public function setQueueBuilder(QueueBuilderInterface $queueBuilder) { $this->queueBuilder = $queueBuilder; @@ -175,9 +138,6 @@ public function setDb($db) $this->db = $db; } - /** - * @inheritDoc - */ public function processQueue(): bool { $this->buildQueue(); // first enrich the queue table with all elements that are `inPreparation` and their children @@ -205,7 +165,6 @@ public function processQueue(): bool * inserts one row for each segment assigned to that element * and finally dequeues the element * - * @param array $element */ private function processElement(array $element) { @@ -224,7 +183,7 @@ private function processElement(array $element) 1 => $this->getSegmentAssignmentIndexTable(), 2 => $this->getSegmentAssignmentQueueTable(), 3 => $this->getSegmentAssignmentTable(), - 4 => $values + 4 => $values, ]; $statement = vsprintf( @@ -240,7 +199,7 @@ private function processElement(array $element) [ 'elementId' => $elementId, 'elementType' => $elementType, - 'segmentIds' => join(',', $segmentIds) + 'segmentIds' => join(',', $segmentIds), ]); try { diff --git a/src/SegmentAssignment/Indexer/IndexerInterface.php b/src/SegmentAssignment/Indexer/IndexerInterface.php index b2758e68..ed6b9989 100644 --- a/src/SegmentAssignment/Indexer/IndexerInterface.php +++ b/src/SegmentAssignment/Indexer/IndexerInterface.php @@ -20,7 +20,6 @@ interface IndexerInterface /** * indexes all elements in currently stored in the queue table * - * @return bool */ public function processQueue(): bool; } diff --git a/src/SegmentAssignment/QueryService/DefaultQueryService.php b/src/SegmentAssignment/QueryService/DefaultQueryService.php index d84e34ae..4bc5b123 100644 --- a/src/SegmentAssignment/QueryService/DefaultQueryService.php +++ b/src/SegmentAssignment/QueryService/DefaultQueryService.php @@ -19,9 +19,6 @@ use Pimcore\Model\DataObject\Service; use Pimcore\Model\Listing\AbstractListing; -/** - * @inheritdoc - */ class DefaultQueryService implements QueryServiceInterface { /** @@ -40,41 +37,26 @@ public function __construct(string $segmentAssignmentIndexTable, TypeMapperInter $this->setTypeMapper($typeMapper); } - /** - * @return string - */ public function getSegmentAssignmentIndexTable(): string { return $this->segmentAssignmentIndexTable; } - /** - * @param string $segmentAssignmentIndexTable - */ public function setSegmentAssignmentIndexTable(string $segmentAssignmentIndexTable) { $this->segmentAssignmentIndexTable = $segmentAssignmentIndexTable; } - /** - * @return TypeMapperInterface - */ public function getTypeMapper(): TypeMapperInterface { return $this->typeMapper; } - /** - * @param TypeMapperInterface $typeMapper - */ public function setTypeMapper(TypeMapperInterface $typeMapper) { $this->typeMapper = $typeMapper; } - /** - * @inheritDoc - */ public function bySegmentIds(AbstractListing $listing, array $segmentIds, $concatMode = self::MODE_DISJUNCTION) { if ([] === $segmentIds) { diff --git a/src/SegmentAssignment/QueryService/QueryServiceInterface.php b/src/SegmentAssignment/QueryService/QueryServiceInterface.php index abf94acd..5de36358 100644 --- a/src/SegmentAssignment/QueryService/QueryServiceInterface.php +++ b/src/SegmentAssignment/QueryService/QueryServiceInterface.php @@ -26,14 +26,13 @@ interface QueryServiceInterface { const MODE_CONJUNCTION = 'AND'; + const MODE_DISJUNCTION = 'OR'; /** * adds a condition that narrows the result set down to elements that are assigned one or more/all of the passed $segmentIds * (based on $concatMode) * - * @param AbstractListing $listing - * @param array $segmentIds * @param string $concatMode * * @return mixed diff --git a/src/SegmentAssignment/QueueBuilder/DefaultQueueBuilder.php b/src/SegmentAssignment/QueueBuilder/DefaultQueueBuilder.php index c2227932..77cd35a8 100644 --- a/src/SegmentAssignment/QueueBuilder/DefaultQueueBuilder.php +++ b/src/SegmentAssignment/QueueBuilder/DefaultQueueBuilder.php @@ -20,9 +20,6 @@ use Pimcore\Model\DataObject\Service; use Throwable; -/** - * @inheritdoc - */ class DefaultQueueBuilder implements QueueBuilderInterface { /** @@ -41,41 +38,26 @@ public function __construct(string $segmentAssignmentQueueTable, Connection $db) $this->setDb($db); } - /** - * @return string - */ public function getSegmentAssignmentQueueTable(): string { return $this->segmentAssignmentQueueTable; } - /** - * @param string $segmentAssignmentQueueTable - */ public function setSegmentAssignmentQueueTable(string $segmentAssignmentQueueTable) { $this->segmentAssignmentQueueTable = $segmentAssignmentQueueTable; } - /** - * @return Connection - */ public function getDb(): Connection { return $this->db; } - /** - * @param Connection $db - */ public function setDb(Connection $db) { $this->db = $db; } - /** - * @inheritdoc - */ public function enqueue(string $elementId, string $type): bool { try { @@ -95,9 +77,6 @@ public function enqueue(string $elementId, string $type): bool } } - /** - * @inheritdoc - */ public function enqueueChildren(string $elementId, string $type): bool { try { @@ -125,7 +104,7 @@ public function enqueueChildren(string $elementId, string $type): bool $this->getDb()->executeQuery($enqueueStatement, [ 'elementType' => $type, - 'elementId' => (int) $elementId + 'elementId' => (int) $elementId, ]); $this->getDb()->commit(); diff --git a/src/SegmentAssignment/QueueBuilder/QueueBuilderInterface.php b/src/SegmentAssignment/QueueBuilder/QueueBuilderInterface.php index 67dfa720..2c72abe2 100644 --- a/src/SegmentAssignment/QueueBuilder/QueueBuilderInterface.php +++ b/src/SegmentAssignment/QueueBuilder/QueueBuilderInterface.php @@ -25,20 +25,14 @@ interface QueueBuilderInterface /** * adds a single element to the segment assignment queue * - * @param string $elementId - * @param string $type * - * @return bool */ public function enqueue(string $elementId, string $type): bool; /** * adds an element's children to the segment assignment queue * - * @param string $elementId - * @param string $type * - * @return bool */ public function enqueueChildren(string $elementId, string $type): bool; } diff --git a/src/SegmentAssignment/SegmentAssigner/SegmentAssigner.php b/src/SegmentAssignment/SegmentAssigner/SegmentAssigner.php index ce2a10bc..f454795d 100644 --- a/src/SegmentAssignment/SegmentAssigner/SegmentAssigner.php +++ b/src/SegmentAssignment/SegmentAssigner/SegmentAssigner.php @@ -48,9 +48,6 @@ class SegmentAssigner implements SegmentAssignerInterface */ private $segmentAssignmentIndexTable = ''; - /** - * @inheritDoc - */ public function __construct(string $segmentAssignmentTable, string $segmentAssignmentQueueTable, string $segmentAssignmentIndexTable, Connection $db, TypeMapperInterface $typeMapper) { $this->setSegmentAssignmentTable($segmentAssignmentTable); @@ -60,89 +57,56 @@ public function __construct(string $segmentAssignmentTable, string $segmentAssig $this->setTypeMapper($typeMapper); } - /** - * @return Connection - */ public function getDb(): Connection { return $this->db; } - /** - * @param Connection $db - */ public function setDb(Connection $db) { $this->db = $db; } - /** - * @return TypeMapperInterface - */ public function getTypeMapper(): TypeMapperInterface { return $this->typeMapper; } - /** - * @param TypeMapperInterface $typeMapper - */ public function setTypeMapper(TypeMapperInterface $typeMapper) { $this->typeMapper = $typeMapper; } - /** - * @return string - */ public function getSegmentAssignmentTable(): string { return $this->segmentAssignmentTable; } - /** - * @param string $segmentAssignmentTable - */ public function setSegmentAssignmentTable(string $segmentAssignmentTable) { $this->segmentAssignmentTable = $segmentAssignmentTable; } - /** - * @return string - */ public function getSegmentAssignmentQueueTable(): string { return $this->segmentAssignmentQueueTable; } - /** - * @param string $segmentAssignmentQueueTable - */ public function setSegmentAssignmentQueueTable(string $segmentAssignmentQueueTable) { $this->segmentAssignmentQueueTable = $segmentAssignmentQueueTable; } - /** - * @return string - */ public function getSegmentAssignmentIndexTable(): string { return $this->segmentAssignmentIndexTable; } - /** - * @param string $segmentAssignmentIndexTable - */ public function setSegmentAssignmentIndexTable(string $segmentAssignmentIndexTable) { $this->segmentAssignmentIndexTable = $segmentAssignmentIndexTable; } - /** - * @inheritDoc - */ public function assign(ElementInterface $element, bool $breaksInheritance, array $segments): bool { $segmentIds = array_map(static function ($segment) { @@ -152,9 +116,6 @@ public function assign(ElementInterface $element, bool $breaksInheritance, array return $this->assignById((string) $element->getId(), $this->getTypeMapper()->getTypeStringByObject($element), $breaksInheritance, $segmentIds); } - /** - * @inheritDoc - */ public function assignById(string $elementId, string $type, bool $breaksInheritance, array $segmentIds): bool { try { @@ -168,7 +129,7 @@ public function assignById(string $elementId, string $type, bool $breaksInherita 'elementId' => $elementId, 'elementType' => $type, 'segmentIds' => join(',', $segmentIds), - 'breaksInheritance' => (int)$breaksInheritance + 'breaksInheritance' => (int)$breaksInheritance, ]); $this->db->commit(); @@ -181,9 +142,6 @@ public function assignById(string $elementId, string $type, bool $breaksInherita } } - /** - * @inheritdoc - */ public function removeElementById(string $elementId, string $type): bool { $db = $this->getDb(); @@ -208,7 +166,7 @@ public function removeElementById(string $elementId, string $type): bool $this->getDb()->executeQuery($statement, [ 'elementId' => $elementId, - 'elementType' => $type + 'elementType' => $type, ] ); } diff --git a/src/SegmentAssignment/SegmentAssigner/SegmentAssignerInterface.php b/src/SegmentAssignment/SegmentAssigner/SegmentAssignerInterface.php index 56d7e34d..acb2b73a 100644 --- a/src/SegmentAssignment/SegmentAssigner/SegmentAssignerInterface.php +++ b/src/SegmentAssignment/SegmentAssigner/SegmentAssignerInterface.php @@ -30,8 +30,6 @@ interface SegmentAssignerInterface /** * Assigns segments to an element * - * @param ElementInterface $element - * @param bool $breaksInheritance * @param CustomerSegmentInterface[]|int[] $segments * * @return bool true on success, false on failure @@ -41,9 +39,6 @@ public function assign(ElementInterface $element, bool $breaksInheritance, array /** * Assigns segments to an element id using the segments' ids * - * @param string $elementId - * @param string $type - * @param bool $breaksInheritance * @param string[] $segmentIds * * @return bool true on success, false on failure @@ -53,10 +48,7 @@ public function assignById(string $elementId, string $type, bool $breaksInherita /** * removes all references to the given element from assignment, queue and index tables * - * @param string $elementId - * @param string $type * - * @return bool */ public function removeElementById(string $elementId, string $type): bool; } diff --git a/src/SegmentAssignment/StoredFunctions/DefaultStoredFunctions.php b/src/SegmentAssignment/StoredFunctions/DefaultStoredFunctions.php index 25c5ea91..fc0d4797 100644 --- a/src/SegmentAssignment/StoredFunctions/DefaultStoredFunctions.php +++ b/src/SegmentAssignment/StoredFunctions/DefaultStoredFunctions.php @@ -17,14 +17,8 @@ use Pimcore\Db; -/** - * @inheritdoc - */ class DefaultStoredFunctions implements StoredFunctionsInterface { - /** - * @inheritdoc - */ public function retrieve(string $elementId, string $elementType): array { $storedFunction = static::STORED_FUNCTIONS_MAPPING[$elementType]; diff --git a/src/SegmentAssignment/StoredFunctions/StoredFunctionsInterface.php b/src/SegmentAssignment/StoredFunctions/StoredFunctionsInterface.php index adab329e..644794a9 100644 --- a/src/SegmentAssignment/StoredFunctions/StoredFunctionsInterface.php +++ b/src/SegmentAssignment/StoredFunctions/StoredFunctionsInterface.php @@ -29,7 +29,9 @@ interface StoredFunctionsInterface { const STORED_FUNCTION_DOCUMENT = 'PLUGIN_CMF_COLLECT_DOCUMENT_SEGMENT_ASSIGNMENTS'; + const STORED_FUNCTION_ASSET = 'PLUGIN_CMF_COLLECT_ASSET_SEGMENT_ASSIGNMENTS'; + const STORED_FUNCTION_OBJECT = 'PLUGIN_CMF_COLLECT_OBJECT_SEGMENT_ASSIGNMENTS'; /** @@ -38,15 +40,13 @@ interface StoredFunctionsInterface const STORED_FUNCTIONS_MAPPING = [ TypeMapperInterface::TYPE_DOCUMENT => self::STORED_FUNCTION_DOCUMENT, TypeMapperInterface::TYPE_ASSET => self::STORED_FUNCTION_ASSET, - TypeMapperInterface::TYPE_OBJECT => self::STORED_FUNCTION_OBJECT + TypeMapperInterface::TYPE_OBJECT => self::STORED_FUNCTION_OBJECT, ]; /** * retrieves an array of segment ids assigned to the given $elementId of $elementType * and all those it inherits along the element tree * - * @param string $elementId - * @param string $elementType * * @return string[] */ diff --git a/src/SegmentAssignment/TypeMapper/TypeMapper.php b/src/SegmentAssignment/TypeMapper/TypeMapper.php index 28876a29..01f1066a 100644 --- a/src/SegmentAssignment/TypeMapper/TypeMapper.php +++ b/src/SegmentAssignment/TypeMapper/TypeMapper.php @@ -24,9 +24,6 @@ class TypeMapper implements TypeMapperInterface { - /** - * @inheritdoc - */ public function getTypeStringByObject(ElementInterface $element): string { if ($element instanceof Document) { @@ -44,9 +41,6 @@ public function getTypeStringByObject(ElementInterface $element): string return ''; } - /** - * @inheritdoc - */ public function getTypeStringBySubType(string $subType): string { if (in_array($subType, Document::getTypes())) { @@ -64,9 +58,6 @@ public function getTypeStringBySubType(string $subType): string return ''; } - /** - * @inheritDoc - */ public function getTypeStringByListing(AbstractListing $listing): string { if ($listing instanceof Document\Listing) { diff --git a/src/SegmentAssignment/TypeMapper/TypeMapperInterface.php b/src/SegmentAssignment/TypeMapper/TypeMapperInterface.php index 959e96dc..97439919 100644 --- a/src/SegmentAssignment/TypeMapper/TypeMapperInterface.php +++ b/src/SegmentAssignment/TypeMapper/TypeMapperInterface.php @@ -28,33 +28,29 @@ interface TypeMapperInterface { const TYPE_DOCUMENT = 'document'; + const TYPE_ASSET = 'asset'; + const TYPE_OBJECT = 'object'; /** * returns a type string (e.g. 'document'|'asset'|'object') for the provided element * - * @param ElementInterface $element * - * @return string */ public function getTypeStringByObject(ElementInterface $element): string; /** * returns a type string (e.g. 'document'|'asset'|'object') for the provided sub type * - * @param string $subType * - * @return string */ public function getTypeStringBySubType(string $subType): string; /** * returns a type string (e.g. 'document'|'asset'|'object') based on the type of Listing provided * - * @param AbstractListing $listing * - * @return string */ public function getTypeStringByListing(AbstractListing $listing): string; } diff --git a/src/SegmentBuilder/AbstractSegmentBuilder.php b/src/SegmentBuilder/AbstractSegmentBuilder.php index d6a73bbc..4cf2c5a0 100644 --- a/src/SegmentBuilder/AbstractSegmentBuilder.php +++ b/src/SegmentBuilder/AbstractSegmentBuilder.php @@ -26,7 +26,6 @@ abstract class AbstractSegmentBuilder implements SegmentBuilderInterface protected $paginator; /** - * @param PaginatorInterface $paginator * @required */ public function setPaginator(PaginatorInterface $paginator): void diff --git a/src/SegmentBuilder/AgeSegmentBuilder.php b/src/SegmentBuilder/AgeSegmentBuilder.php index 34c3b97f..302ddf4b 100644 --- a/src/SegmentBuilder/AgeSegmentBuilder.php +++ b/src/SegmentBuilder/AgeSegmentBuilder.php @@ -19,6 +19,7 @@ use CustomerManagementFrameworkBundle\Model\CustomerInterface; use CustomerManagementFrameworkBundle\SegmentManager\SegmentManagerInterface; use CustomerManagementFrameworkBundle\Traits\LoggerAware; +use Knp\Bundle\PaginatorBundle\Pagination\SlidingPaginationInterface; use Pimcore\Model\Tool\TmpStore; class AgeSegmentBuilder extends AbstractSegmentBuilder @@ -26,8 +27,11 @@ class AgeSegmentBuilder extends AbstractSegmentBuilder use LoggerAware; private $groupName; + private $segmentGroup; + private $ageGroups; + private $birthDayField; public function __construct($groupName = 'Age', $ageGroups = [], $birthDayField = 'birthDate') @@ -54,7 +58,6 @@ public function __construct($groupName = 'Age', $ageGroups = [], $birthDayField /** * prepare data and configurations which could be reused for all calculateSegments() calls * - * @param SegmentManagerInterface $segmentManager * * @return void */ @@ -66,8 +69,6 @@ public function prepare(SegmentManagerInterface $segmentManager) /** * build segment(s) for given customer * - * @param CustomerInterface $customer - * @param SegmentManagerInterface $segmentManager * * @return void */ @@ -143,13 +144,15 @@ public function maintenance(SegmentManagerInterface $segmentManager) $paginator = $this->paginator->paginate($list, 1, 100); - $pageCount = $paginator->getPaginationData()['pageCount']; - for ($i = 1; $i <= $pageCount; $i++) { - $paginator = $this->paginator->paginate($list, $i, 100); + if ($paginator instanceof SlidingPaginationInterface) { + $pageCount = $paginator->getPaginationData()['pageCount']; + for ($i = 1; $i <= $pageCount; $i++) { + $paginator = $this->paginator->paginate($list, $i, 100); - foreach ($paginator as $customer) { - $this->calculateSegments($customer, $segmentManager); - $segmentManager->saveMergedSegments($customer); + foreach ($paginator as $customer) { + $this->calculateSegments($customer, $segmentManager); + $segmentManager->saveMergedSegments($customer); + } } } } diff --git a/src/SegmentBuilder/GenderSegmentBuilder.php b/src/SegmentBuilder/GenderSegmentBuilder.php index bbf491c0..9ee98ec5 100644 --- a/src/SegmentBuilder/GenderSegmentBuilder.php +++ b/src/SegmentBuilder/GenderSegmentBuilder.php @@ -21,18 +21,27 @@ class GenderSegmentBuilder extends AbstractSegmentBuilder { const MALE = 'male'; + const FEMALE = 'female'; + const NOT_SET = 'not-set'; private $maleSegment; + private $femaleSegment; + private $notsetSegment; + private $segmentGroup; private $segmentGroupName; + private $maleSegmentName; + private $femaleSegmentName; + private $notsetSegmentName; + private $valueMapping; public function __construct( @@ -55,7 +64,6 @@ public function __construct( /** * prepare data and configurations which could be reused for all calculateSegments() calls * - * @param SegmentManagerInterface $segmentManager * * @return void */ @@ -82,8 +90,6 @@ public function prepare(SegmentManagerInterface $segmentManager) /** * build segment(s) for given customer * - * @param CustomerInterface $customer - * @param SegmentManagerInterface $segmentManager * * @return void */ diff --git a/src/SegmentBuilder/SegmentBuilderInterface.php b/src/SegmentBuilder/SegmentBuilderInterface.php index 0f617d9a..fcfb0ae1 100644 --- a/src/SegmentBuilder/SegmentBuilderInterface.php +++ b/src/SegmentBuilder/SegmentBuilderInterface.php @@ -23,7 +23,6 @@ interface SegmentBuilderInterface /** * prepares data and configurations which could be reused for all buildSegment(CustomerInterface $customer) calls * - * @param SegmentManagerInterface $segmentManager * * @return void */ @@ -32,8 +31,6 @@ public function prepare(SegmentManagerInterface $segmentManager); /** * update calculated segment(s) for given customer * - * @param CustomerInterface $customer - * @param SegmentManagerInterface $segmentManager * * @return void */ @@ -56,7 +53,6 @@ public function executeOnCustomerSave(); /** * executed in maintenance mode * - * @param SegmentManagerInterface $segmentManager * * @return void */ diff --git a/src/SegmentBuilder/StateSegmentBuilder.php b/src/SegmentBuilder/StateSegmentBuilder.php index 11abe986..728cf30c 100644 --- a/src/SegmentBuilder/StateSegmentBuilder.php +++ b/src/SegmentBuilder/StateSegmentBuilder.php @@ -23,7 +23,9 @@ class StateSegmentBuilder extends AbstractSegmentBuilder { private $countryTransformers; + private $groupName; + private $segmentGroup; public function __construct($groupName = 'State', array $countryTransformers = []) @@ -40,7 +42,6 @@ public function __construct($groupName = 'State', array $countryTransformers = [ /** * prepare data and configurations which could be reused for all calculateSegments() calls * - * @param SegmentManagerInterface $segmentManager */ public function prepare(SegmentManagerInterface $segmentManager) { @@ -58,8 +59,6 @@ public function prepare(SegmentManagerInterface $segmentManager) /** * build segment(s) for given customer * - * @param CustomerInterface $customer - * @param SegmentManagerInterface $segmentManager */ public function calculateSegments(CustomerInterface $customer, SegmentManagerInterface $segmentManager) { diff --git a/src/SegmentManager/DefaultSegmentManager.php b/src/SegmentManager/DefaultSegmentManager.php index 61b4eeb0..dc9ac9c9 100644 --- a/src/SegmentManager/DefaultSegmentManager.php +++ b/src/SegmentManager/DefaultSegmentManager.php @@ -77,10 +77,6 @@ class DefaultSegmentManager implements SegmentManagerInterface /** * @param string|\Pimcore\Model\DataObject\Folder $segmentFolderCalculated * @param string|\Pimcore\Model\DataObject\Folder $segmentFolderManual - * @param CustomerSaveManagerInterface $customerSaveManager - * @param CustomerProviderInterface $customerProvider - * @param TypeMapperInterface $typeMapper - * @param StoredFunctionsInterface $storedFunctions */ public function __construct($segmentFolderCalculated, $segmentFolderManual, CustomerSaveManagerInterface $customerSaveManager, CustomerProviderInterface $customerProvider, TypeMapperInterface $typeMapper, StoredFunctionsInterface $storedFunctions) { @@ -94,57 +90,36 @@ public function __construct($segmentFolderCalculated, $segmentFolderManual, Cust $this->setStoredFunctions($storedFunctions); } - /** - * @return TypeMapperInterface - */ public function getTypeMapper(): TypeMapperInterface { return $this->typeMapper; } - /** - * @param TypeMapperInterface $typeMapper - */ public function setTypeMapper(TypeMapperInterface $typeMapper) { $this->typeMapper = $typeMapper; } - /** - * @return StoredFunctionsInterface - */ public function getStoredFunctions(): StoredFunctionsInterface { return $this->storedFunctions; } - /** - * @param StoredFunctionsInterface $storedFunctions - */ public function setStoredFunctions(StoredFunctionsInterface $storedFunctions) { $this->storedFunctions = $storedFunctions; } - /** - * @inheritdoc - */ public function getSegmentById($id) { return CustomerSegment::getById($id); } - /** - * @inheritdoc - */ public function getSegmentGroupById($id) { return CustomerSegmentGroup::getById($id); } - /** - * @inheritdoc - */ public function getSegmentsForElement(ElementInterface $element): array { $id = (string) $element->getId(); @@ -153,9 +128,6 @@ public function getSegmentsForElement(ElementInterface $element): array return $this->getSegmentsForElementId($id, $type); } - /** - * @inheritdoc - */ public function getSegmentsForElementId(string $id, string $type): array { $segmentIds = $this->getStoredFunctions()->retrieve($id, $type); @@ -167,9 +139,6 @@ public function getSegmentsForElementId(string $id, string $type): array return array_filter($segments); } - /** - * @inheritdoc - */ public function getCustomersBySegmentIds(array $segmentIds, $conditionMode = self::CONDITION_AND) { $list = $this->customerProvider->getList(); @@ -188,9 +157,6 @@ public function getCustomersBySegmentIds(array $segmentIds, $conditionMode = sel return $list; } - /** - * @inheritdoc - */ public function getSegments(array $params = []) { /** @@ -202,9 +168,6 @@ public function getSegments(array $params = []) return $list; } - /** - * @inheritdoc - */ public function getSegmentGroups() { /** @@ -216,9 +179,6 @@ public function getSegmentGroups() return $list; } - /** - * @inheritdoc - */ public function getSegmentsFolder($calculated = true) { $folder = $calculated ? $this->segmentFolderCalculated : $this->segmentFolderManual; @@ -253,9 +213,6 @@ public function resetSegmentsFolder(): void } } - /** - * @inheritdoc - */ public function getSegmentByReference($segmentReference, CustomerSegmentGroup $segmentGroup = null, $calculated = null) { $list = $this->getSegments() @@ -283,9 +240,6 @@ public function getSegmentByReference($segmentReference, CustomerSegmentGroup $s return $list->current(); } - /** - * @inheritdoc - */ public function createSegment( $segmentName, $segmentGroup, @@ -340,9 +294,6 @@ public function createSegment( return $segment; } - /** - * @inheritdoc - */ public function createCalculatedSegment($segmentReference, $segmentGroup, $segmentName = null, $subFolder = null) { return $this->createSegment( @@ -354,9 +305,6 @@ public function createCalculatedSegment($segmentReference, $segmentGroup, $segme ); } - /** - * @inheritdoc - */ public function createSegmentGroup( $segmentGroupName, $segmentGroupReference = null, @@ -387,9 +335,6 @@ public function createSegmentGroup( return $segmentGroup; } - /** - * @inheritdoc - */ public function updateSegmentGroup(CustomerSegmentGroup $segmentGroup, array $values = []) { $currentCalculatedState = $segmentGroup->getCalculated(); @@ -414,9 +359,6 @@ public function updateSegmentGroup(CustomerSegmentGroup $segmentGroup, array $va $segmentGroup->save(); } - /** - * @inheritdoc - */ public function updateSegment(CustomerSegmentInterface $segment, array $values = []) { $segment->setValues($values); @@ -441,9 +383,6 @@ public function updateSegment(CustomerSegmentInterface $segment, array $values = $segment->save(); } - /** - * @inheritdoc - */ public function getSegmentGroupByReference($segmentGroupReference, $calculated) { if (is_null($segmentGroupReference)) { @@ -466,9 +405,6 @@ public function getSegmentGroupByReference($segmentGroupReference, $calculated) return $list->current(); } - /** - * @inheritdoc - */ public function getSegmentsFromSegmentGroup(CustomerSegmentGroup $segmentGroup, array $ignoreSegments = []) { $list = $this->getSegments() @@ -487,18 +423,12 @@ public function getSegmentsFromSegmentGroup(CustomerSegmentGroup $segmentGroup, return $result ?: []; } - /** - * @inheritdoc - */ public function preSegmentUpdate(CustomerSegmentInterface $segment) { $this->checkAndUpdateTargetGroupConnection($segment); $this->updateGroupRelation($segment); } - /** - * @param CustomerSegmentInterface $segment - */ protected function checkAndUpdateTargetGroupConnection(CustomerSegmentInterface $segment) { //check connection to target groups @@ -512,9 +442,6 @@ protected function checkAndUpdateTargetGroupConnection(CustomerSegmentInterface } } - /** - * @inheritdoc - */ public function postSegmentDelete(CustomerSegmentInterface $segment) { if ($segment->getUseAsTargetGroup() && ($targetGroupId = $segment->getTargetGroup())) { @@ -522,9 +449,6 @@ public function postSegmentDelete(CustomerSegmentInterface $segment) } } - /** - * @param CustomerSegmentInterface $segment - */ protected function updateGroupRelation(CustomerSegmentInterface $segment) { if ($segment instanceof Concrete) { @@ -543,9 +467,6 @@ protected function updateGroupRelation(CustomerSegmentInterface $segment) } } - /** - * @inheritdoc - */ public function customerHasSegment(CustomerInterface $customer, CustomerSegmentInterface $segment) { foreach ($customer->getAllSegments() as $s) { @@ -557,33 +478,21 @@ public function customerHasSegment(CustomerInterface $customer, CustomerSegmentI return false; } - /** - * @inheritdoc - */ public function getCalculatedSegmentsFromCustomer(CustomerInterface $customer) { return $this->getSegmentExtractor()->getCalculatedSegmentsFromCustomer($customer); } - /** - * @inheritdoc - */ public function getManualSegmentsFromCustomer(CustomerInterface $customer) { return $this->getSegmentExtractor()->getManualSegmentsFromCustomer($customer); } - /** - * @inheritdoc - */ public function getSegmentExtractor(): SegmentExtractorInterface { return \Pimcore::getContainer()->get(SegmentExtractorInterface::class); } - /** - * @inheritdoc - */ public function getCustomersSegmentsFromGroup(CustomerInterface $customer, $group) { if (!$group instanceof CustomerSegmentGroup) { @@ -608,9 +517,6 @@ public function getCustomersSegmentsFromGroup(CustomerInterface $customer, $grou return $result; } - /** - * @inheritdoc - */ public function mergeSegments( CustomerInterface $customer, array $addSegments, @@ -629,9 +535,6 @@ public function mergeSegments( ); } - /** - * @inheritdoc - */ public function saveMergedSegments(CustomerInterface $customer) { \Pimcore::getContainer()->get('cmf.segment_manager.segment_merger')->saveMergedSegments($customer); @@ -642,9 +545,6 @@ public function addSegmentBuilder(SegmentBuilderInterface $segmentBuilder) $this->segmentBuilders[] = $segmentBuilder; } - /** - * @inheritdoc - */ public function getSegmentBuilders() { return $this->segmentBuilders; diff --git a/src/SegmentManager/SegmentBuilderExecutor/DefaultSegmentBuilderExecutor.php b/src/SegmentManager/SegmentBuilderExecutor/DefaultSegmentBuilderExecutor.php index 043ca76a..d68966eb 100644 --- a/src/SegmentManager/SegmentBuilderExecutor/DefaultSegmentBuilderExecutor.php +++ b/src/SegmentManager/SegmentBuilderExecutor/DefaultSegmentBuilderExecutor.php @@ -21,6 +21,7 @@ use CustomerManagementFrameworkBundle\SegmentBuilder\SegmentBuilderInterface; use CustomerManagementFrameworkBundle\SegmentManager\SegmentManagerInterface; use CustomerManagementFrameworkBundle\Traits\LoggerAware; +use Knp\Bundle\PaginatorBundle\Pagination\SlidingPaginationInterface; use Knp\Component\Pager\PaginatorInterface; use Pimcore\Db; use Pimcore\Model\DataObject\Concrete; @@ -60,9 +61,6 @@ public function __construct(SegmentManagerInterface $segmentManager, CustomerPro $this->paginator = $paginator; } - /** - * @param CustomerInterface $customer - */ public function buildCalculatedSegmentsOnCustomerSave(CustomerInterface $customer) { $this->prepareSegmentBuilders($this->segmentManager->getSegmentBuilders(), true); @@ -166,7 +164,7 @@ public function buildCalculatedSegments( $paginator = $this->paginator->paginate($idList, 1, $pageSize); $totalAmount = $paginator->getTotalItemCount(); - $totalPages = $paginator->getPaginationData()['pageCount']; + $totalPages = $paginator instanceof SlidingPaginationInterface ? $paginator->getPaginationData()['pageCount'] : 0; $startPage = $desiredStartPage !== null && $desiredStartPage > 0 ? min($totalPages, $desiredStartPage) : 1; $endPage = $totalPages; @@ -235,6 +233,7 @@ public function buildCalculatedSegments( $progressCount = max((int)($pageSize / 10), 1); $progressTime = time(); $itemCount = 1; + try { for ($pageNumber = $startPage; $pageNumber <= $endPage && $pageNumber <= $totalPages && !$stopFurtherProcessing; $pageNumber++) { $logger->notice( @@ -348,9 +347,6 @@ protected function getIntOption(array $options, $option) ? (int)$options[$option] : null; } - /** - * @param CustomerInterface $customer - */ public function addCustomerToChangesQueue(CustomerInterface $customer) { Db::get()->executeQuery( @@ -366,10 +362,6 @@ public function executeSegmentBuilderMaintenance() } } - /** - * @param CustomerInterface $customer - * @param SegmentBuilderInterface $segmentBuilder - */ protected function applySegmentBuilderToCustomer( CustomerInterface $customer, SegmentBuilderInterface $segmentBuilder diff --git a/src/SegmentManager/SegmentBuilderExecutor/SegmentBuilderExecutorInterface.php b/src/SegmentManager/SegmentBuilderExecutor/SegmentBuilderExecutorInterface.php index f1ba5792..05d42d2c 100644 --- a/src/SegmentManager/SegmentBuilderExecutor/SegmentBuilderExecutorInterface.php +++ b/src/SegmentManager/SegmentBuilderExecutor/SegmentBuilderExecutorInterface.php @@ -20,7 +20,6 @@ interface SegmentBuilderExecutorInterface { /** - * @param CustomerInterface $customer * * @return void */ @@ -48,7 +47,6 @@ public function buildCalculatedSegments( ); /** - * @param CustomerInterface $customer * * @return void */ diff --git a/src/SegmentManager/SegmentExtractor/DefaultSegmentExtractor.php b/src/SegmentManager/SegmentExtractor/DefaultSegmentExtractor.php index 2831e9cf..fe79d5f9 100644 --- a/src/SegmentManager/SegmentExtractor/DefaultSegmentExtractor.php +++ b/src/SegmentManager/SegmentExtractor/DefaultSegmentExtractor.php @@ -21,9 +21,6 @@ class DefaultSegmentExtractor implements SegmentExtractorInterface { - /** - * @inheritdoc - */ public function getCalculatedSegmentsFromCustomer(CustomerInterface $customer) { return $this->extractSegmentsFromPimcoreFieldData($customer->getCalculatedSegments()); @@ -34,9 +31,6 @@ public function getManualSegmentsFromCustomer(CustomerInterface $customer) return $this->extractSegmentsFromPimcoreFieldData($customer->getManualSegments()); } - /** - * @inheritdoc - */ public function extractSegmentsFromPimcoreFieldData($segments): array { if (!is_array($segments) || empty($segments)) { @@ -54,9 +48,6 @@ public function extractSegmentsFromPimcoreFieldData($segments): array return $result; } - /** - * @inheritdoc - */ public function getAllSegmentApplicationCounters(CustomerInterface $customer): array { $segments = []; @@ -66,9 +57,6 @@ public function getAllSegmentApplicationCounters(CustomerInterface $customer): a return $segments; } - /** - * @inheritdoc - */ public function getSegmentApplicationCounter(CustomerInterface $customer, CustomerSegmentInterface $customerSegment): int { $allCounters = $this->getAllSegmentApplicationCounters($customer); diff --git a/src/SegmentManager/SegmentExtractor/SegmentExtractorInterface.php b/src/SegmentManager/SegmentExtractor/SegmentExtractorInterface.php index 194cd3cf..c7c9d4c3 100644 --- a/src/SegmentManager/SegmentExtractor/SegmentExtractorInterface.php +++ b/src/SegmentManager/SegmentExtractor/SegmentExtractorInterface.php @@ -22,14 +22,12 @@ interface SegmentExtractorInterface { /** - * @param CustomerInterface $customer * * @return CustomerSegmentInterface[] */ public function getCalculatedSegmentsFromCustomer(CustomerInterface $customer); /** - * @param CustomerInterface $customer * * @return CustomerSegmentInterface[] */ @@ -48,17 +46,10 @@ public function extractSegmentsFromPimcoreFieldData($segments): array; /** * returns an array with all segment application counters of all assiged segments of the customer * - * @param CustomerInterface $customer * * @return int[] array key = segmentId, array value = segment application counter */ public function getAllSegmentApplicationCounters(CustomerInterface $customer): array; - /** - * @param CustomerInterface $customer - * @param CustomerSegmentInterface $customerSegment - * - * @return int - */ public function getSegmentApplicationCounter(CustomerInterface $customer, CustomerSegmentInterface $customerSegment): int; } diff --git a/src/SegmentManager/SegmentManagerInterface.php b/src/SegmentManager/SegmentManagerInterface.php index 7d04a41a..2c55b011 100644 --- a/src/SegmentManager/SegmentManagerInterface.php +++ b/src/SegmentManager/SegmentManagerInterface.php @@ -27,6 +27,7 @@ interface SegmentManagerInterface { const CONDITION_AND = 'and'; + const CONDITION_OR = 'or'; /** @@ -61,7 +62,6 @@ public function getSegmentGroupById($id); * Returns all segments assigned to $element or one of its parents * uses the directly assigned segments, not the indexed ones * - * @param ElementInterface $element * * @return CustomerSegmentInterface[] */ @@ -71,8 +71,6 @@ public function getSegmentsForElement(ElementInterface $element): array; * Returns all segments assigned to $id with $type or one of its parents * uses the directly assigned segments, not the indexed ones * - * @param string $id - * @param string $type * * @return CustomerSegmentInterface[] */ @@ -100,7 +98,6 @@ public function getSegmentGroups(); public function getSegmentsFolder($calculated = true); /** - * @param SegmentBuilderInterface $segmentBuilder * * @return void */ @@ -116,9 +113,6 @@ public function getSegmentBuilders(); * If segments are added or removed this will be tracked in the notes/events tab of the customer. * The changes of this method will be persisted when saveMergedSegments() gets called. * - * @param CustomerInterface $customer - * @param array $addSegments - * @param array $deleteSegments * @param string|null $hintForNotes additional hint for the notes/event entries * @param int|true|null $segmentCreatedTimestamp * Optional. Can be used to store the date when the segment was added (for potentially expiring segments). @@ -157,7 +151,6 @@ public function mergeSegments( /** * Needs to be called after segments are merged with mergeSegments() in order to persist the segments in the customer object. * - * @param CustomerInterface $customer * * @return void */ @@ -201,7 +194,6 @@ public function createSegment( * If no CustomerSegmentGroup is given it will search globally. * * @param string $segmentReference - * @param CustomerSegmentGroup|null $segmentGroup * @param bool $calculated * * @return CustomerSegmentInterface|null @@ -214,7 +206,6 @@ public function getSegmentByReference($segmentReference, CustomerSegmentGroup $s * @param string|CustomerSegmentGroup $segmentGroupName * @param string|null $segmentGroupReference * @param bool $calculated - * @param array $values * * @return CustomerSegmentGroup */ @@ -228,8 +219,6 @@ public function createSegmentGroup( /** * Updates a segment group. * - * @param CustomerSegmentGroup $segmentGroup - * @param array $values * * @return mixed */ @@ -239,7 +228,6 @@ public function updateSegmentGroup(CustomerSegmentGroup $segmentGroup, array $va * Updates a segment. * * @param Concrete&CustomerSegmentInterface $segment - * @param array $values * * @return mixed */ @@ -256,7 +244,6 @@ public function updateSegment(CustomerSegmentInterface $segment, array $values = public function getSegmentGroupByReference($segmentGroupReference, $calculated); /** - * @param CustomerSegmentGroup $segmentGroup * @param CustomerSegmentInterface[] $ignoreSegments * * @return CustomerSegmentInterface[] @@ -264,36 +251,28 @@ public function getSegmentGroupByReference($segmentGroupReference, $calculated); public function getSegmentsFromSegmentGroup(CustomerSegmentGroup $segmentGroup, array $ignoreSegments = []); /** - * @param CustomerInterface $customer - * @param CustomerSegmentInterface $segment * * @return bool */ public function customerHasSegment(CustomerInterface $customer, CustomerSegmentInterface $segment); /** - * @param CustomerInterface $customer * * @return CustomerSegmentInterface[] */ public function getCalculatedSegmentsFromCustomer(CustomerInterface $customer); /** - * @param CustomerInterface $customer * * @return CustomerSegmentInterface[] */ public function getManualSegmentsFromCustomer(CustomerInterface $customer); - /** - * @return SegmentExtractorInterface - */ public function getSegmentExtractor(): SegmentExtractorInterface; /** * Return segments of given customers which are within given customer segment group. * - * @param CustomerInterface $customer * @param CustomerSegmentGroup|string $group * * @return CustomerSegmentInterface[] @@ -303,7 +282,6 @@ public function getCustomersSegmentsFromGroup(CustomerInterface $customer, $grou /** * Called in pimcore's pre object update hook for CustomerSegment objects. * - * @param CustomerSegmentInterface $segment * * @return void */ @@ -312,7 +290,6 @@ public function preSegmentUpdate(CustomerSegmentInterface $segment); /** * Called in pimcore's post object delete hook for CustomerSegment objects. * - * @param CustomerSegmentInterface $segment * * @return void */ diff --git a/src/SegmentManager/SegmentMerger/DefaultSegmentMerger.php b/src/SegmentManager/SegmentMerger/DefaultSegmentMerger.php index 4613fb6c..97471974 100644 --- a/src/SegmentManager/SegmentMerger/DefaultSegmentMerger.php +++ b/src/SegmentManager/SegmentMerger/DefaultSegmentMerger.php @@ -59,9 +59,6 @@ public function __construct(CustomerSaveManagerInterface $customerSaveManager, S $this->metadataFiller = $metadataFiller; } - /** - * @inheritdoc - */ public function mergeSegments( CustomerInterface $customer, array $addSegments, @@ -70,8 +67,8 @@ public function mergeSegments( $segmentCreatedTimestamp = null, $segmentApplicationCounter = null ) { - list($addManualSegments, $addCalculatedSegments) = $this->devideIntoManualAndCalculatedSegments($addSegments); - list($deleteManualSegments, $deleteCalculatedSegments) = $this->devideIntoManualAndCalculatedSegments($deleteSegments); + [$addManualSegments, $addCalculatedSegments] = $this->devideIntoManualAndCalculatedSegments($addSegments); + [$deleteManualSegments, $deleteCalculatedSegments] = $this->devideIntoManualAndCalculatedSegments($deleteSegments); if (sizeof($addCalculatedSegments) || sizeof($deleteCalculatedSegments)) { $this->mergeSegmentsHelper( @@ -119,9 +116,6 @@ private function devideIntoManualAndCalculatedSegments(array $segments) } /** - * @param CustomerInterface $customer - * @param array $addSegments - * @param array $deleteSegments * @param bool $calculated * @param string $hintForNotes * @param int|true|null $segmentCreatedTimestamp @@ -281,7 +275,6 @@ private function objectMetadataArrayToObjectArray(array $array) } /** - * @param CustomerInterface $customer * @param bool $calculated * * @return \CustomerManagementFrameworkBundle\Model\CustomerSegmentInterface[]|\Pimcore\Model\DataObject\Data\ObjectMetadata[] @@ -296,7 +289,6 @@ public function getSegmentsDataFromCustomer(CustomerInterface $customer, $calcul } /** - * @param CustomerInterface $customer * @param \CustomerManagementFrameworkBundle\Model\CustomerSegmentInterface[]|\Pimcore\Model\DataObject\Data\ObjectMetadata[] $segments * @param bool $calculated */ @@ -309,9 +301,6 @@ protected function setSegmentsDataOfCustomer(CustomerInterface $customer, array } } - /** - * @inheritdoc - */ public function saveMergedSegments(CustomerInterface $customer) { if (isset($this->mergedSegmentsCustomerSaveQueue[$customer->getId()])) { @@ -335,8 +324,6 @@ public function saveMergedSegments(CustomerInterface $customer) /** * Remembers customers + notes which need to be saved by saveMergedSegments() * - * @param CustomerInterface $customer - * @param array $notes */ protected function addToMergedSegmentsCustomerSaveQueue(CustomerInterface $customer, array $notes) { @@ -355,7 +342,6 @@ protected function addToMergedSegmentsCustomerSaveQueue(CustomerInterface $custo } /** - * @param CustomerInterface $customer * @param array $segments * @param string $title * @param string $hintForNotes diff --git a/src/SegmentManager/SegmentMerger/DefaultSegmentMerger/MetadataFiller.php b/src/SegmentManager/SegmentMerger/DefaultSegmentMerger/MetadataFiller.php index 890f10b1..0730c52a 100644 --- a/src/SegmentManager/SegmentMerger/DefaultSegmentMerger/MetadataFiller.php +++ b/src/SegmentManager/SegmentMerger/DefaultSegmentMerger/MetadataFiller.php @@ -23,9 +23,6 @@ class MetadataFiller { /** - * @param CustomerInterface $customer - * @param array $addSegments - * @param array $addSegments * @param bool $calculated * @param int|true|null $segmentCreatedTimestamp * @param int|true|null $segmentApplicationCounter diff --git a/src/SegmentManager/SegmentMerger/SegmentMergerInterface.php b/src/SegmentManager/SegmentMerger/SegmentMergerInterface.php index ddf082e8..1b4fd7c1 100644 --- a/src/SegmentManager/SegmentMerger/SegmentMergerInterface.php +++ b/src/SegmentManager/SegmentMerger/SegmentMergerInterface.php @@ -23,9 +23,6 @@ interface SegmentMergerInterface * Could be used to add/remove segments to/from customers. * Take a look at the same method with the same name in the SegmentManagerInterface for further details. * - * @param CustomerInterface $customer - * @param array $addSegments - * @param array $deleteSegments * @param string|null $hintForNotes * @param int|true|null $segmentCreatedTimestamp * @param int|true|null $segmentApplicationCounter @@ -44,7 +41,6 @@ public function mergeSegments( /** * Needs to be called after segments are merged with mergeSegments() in order to persist the segments in the customer object * - * @param CustomerInterface $customer * * @return void */ diff --git a/src/Service/MariaDb.php b/src/Service/MariaDb.php index eb3f8f47..68993beb 100644 --- a/src/Service/MariaDb.php +++ b/src/Service/MariaDb.php @@ -20,8 +20,11 @@ class MariaDb { const DYNAMIC_COLUMN_DATA_TYPE_CHAR = 'char'; + const DYNAMIC_COLUMN_DATA_TYPE_DOUBLE = 'double'; + const DYNAMIC_COLUMN_DATA_TYPE_INTEGER = 'integer'; + const DYNAMIC_COLUMN_DATA_TYPE_BOOLEAN = 'boolean'; private function __construct() @@ -53,7 +56,6 @@ public static function getInstance() /** * Generates insert SQL statement for MariaDBs dynamic column feature. * - * @param array $data * * @return string */ @@ -117,7 +119,6 @@ private static function convertDynamicColumnValueAccordingToDataType($value, $da * Insert $data into table $tableName. Returns last inserted ID. * * @param string $tableName - * @param array $data * * @return int */ @@ -176,7 +177,6 @@ public static function update($tableName, $data, $where) /** * quotes each single item of given array * - * @param array $data * * @return array */ diff --git a/src/Targeting/ActionHandler/ApplyTargetGroupsFromSegments.php b/src/Targeting/ActionHandler/ApplyTargetGroupsFromSegments.php index ecf745d6..dd21d076 100644 --- a/src/Targeting/ActionHandler/ApplyTargetGroupsFromSegments.php +++ b/src/Targeting/ActionHandler/ApplyTargetGroupsFromSegments.php @@ -37,7 +37,9 @@ class ApplyTargetGroupsFromSegments implements ActionHandlerInterface, DataProviderDependentInterface { const APPLY_TYPE_CLEANUP_AND_MERGE = 'cleanup_and_merge'; + const APPLY_TYPE_CLEANUP_AND_OVERWRITE = 'cleanup_and_overwrite'; + const APPLY_TYPE_ONLY_MERGE = 'only_merge'; /** @@ -66,17 +68,11 @@ public function __construct( $this->storage = $storage; } - /** - * @inheritDoc - */ public function getDataProviderKeys(): array { return [Customer::PROVIDER_KEY]; } - /** - * @inheritDoc - */ public function apply(VisitorInfo $visitorInfo, array $action, Rule $rule = null): void { $this->dataLoader->loadDataFromProviders($visitorInfo, [Customer::PROVIDER_KEY]); @@ -112,12 +108,15 @@ public function apply(VisitorInfo $visitorInfo, array $action, Rule $rule = null switch ($action['applyType']) { case self::APPLY_TYPE_CLEANUP_AND_OVERWRITE: $storageData = $this->cleanupAndOverwrite($visitorInfo, $storageData, $targetGroupsToConsider, $targetGroupInitSet); + break; case self::APPLY_TYPE_CLEANUP_AND_MERGE: $storageData = $this->cleanupAndMerge($visitorInfo, $storageData, $targetGroupsToConsider, $targetGroupInitSet); + break; case self::APPLY_TYPE_ONLY_MERGE: $storageData = $this->onlyMerge($visitorInfo, $storageData, $targetGroupsToConsider, $targetGroupInitSet); + break; default: throw new \Exception("Invalid apply type '" . $action['applyType'] . "'"); diff --git a/src/Targeting/ActionHandler/AssignTargetGroupAndSegment.php b/src/Targeting/ActionHandler/AssignTargetGroupAndSegment.php index 19e4a66c..ebc78af8 100644 --- a/src/Targeting/ActionHandler/AssignTargetGroupAndSegment.php +++ b/src/Targeting/ActionHandler/AssignTargetGroupAndSegment.php @@ -82,9 +82,6 @@ public function setConsentChecker(ConsentCheckerInterface $consentChecker): void $this->consentChecker = $consentChecker; } - /** - * @inheritdoc - */ public function apply(VisitorInfo $visitorInfo, array $action, Rule $rule = null): void { parent::apply($visitorInfo, $action, $rule); diff --git a/src/Targeting/ActionHandler/TrackActivity.php b/src/Targeting/ActionHandler/TrackActivity.php index 06cc768a..7183a272 100644 --- a/src/Targeting/ActionHandler/TrackActivity.php +++ b/src/Targeting/ActionHandler/TrackActivity.php @@ -51,17 +51,11 @@ public function __construct(ActivityManagerInterface $activityManager, DataLoade $this->consentChecker = $consentChecker; } - /** - * @inheritDoc - */ public function getDataProviderKeys(): array { return [Customer::PROVIDER_KEY]; } - /** - * @inheritDoc - */ public function apply(VisitorInfo $visitorInfo, array $action, Rule $rule = null): void { //get customer @@ -82,7 +76,7 @@ public function apply(VisitorInfo $visitorInfo, array $action, Rule $rule = null $activity = new GenericActivity([ 'type' => $activityType, - 'attributes' => [] + 'attributes' => [], ]); $activity->setCustomer($customer); diff --git a/src/Targeting/ActionHandler/TrackSegment.php b/src/Targeting/ActionHandler/TrackSegment.php index 6cdb9ca2..114cb49b 100644 --- a/src/Targeting/ActionHandler/TrackSegment.php +++ b/src/Targeting/ActionHandler/TrackSegment.php @@ -53,17 +53,11 @@ public function __construct( $this->segmentTracker = $segmentTracker; } - /** - * @inheritDoc - */ public function getDataProviderKeys(): array { return [Customer::PROVIDER_KEY]; } - /** - * @inheritDoc - */ public function apply(VisitorInfo $visitorInfo, array $action, Rule $rule = null): void { $segmentOption = $action['segment']; diff --git a/src/Targeting/Condition/CustomerIsLoggedIn.php b/src/Targeting/Condition/CustomerIsLoggedIn.php index 02280ea7..2b9d40b7 100644 --- a/src/Targeting/Condition/CustomerIsLoggedIn.php +++ b/src/Targeting/Condition/CustomerIsLoggedIn.php @@ -24,37 +24,25 @@ class CustomerIsLoggedIn extends AbstractVariableCondition implements DataProviderDependentInterface { - /** - * @inheritDoc - */ public static function fromConfig(array $config): self { return new self(); } - /** - * @inheritDoc - */ public function getDataProviderKeys(): array { $providers = [ - Customer::PROVIDER_KEY + Customer::PROVIDER_KEY, ]; return $providers; } - /** - * @inheritDoc - */ public function canMatch(): bool { return true; } - /** - * @inheritDoc - */ public function match(VisitorInfo $visitorInfo): bool { $customer = $visitorInfo->get(Customer::PROVIDER_KEY); diff --git a/src/Targeting/Condition/CustomerSegmentsHaveChanged.php b/src/Targeting/Condition/CustomerSegmentsHaveChanged.php index a0e3657d..53eecd4b 100644 --- a/src/Targeting/Condition/CustomerSegmentsHaveChanged.php +++ b/src/Targeting/Condition/CustomerSegmentsHaveChanged.php @@ -30,38 +30,26 @@ public function __construct() { } - /** - * @inheritDoc - */ public static function fromConfig(array $config): self { return new self(); } - /** - * @inheritDoc - */ public function getDataProviderKeys(): array { $providers = [ Customer::PROVIDER_KEY, - CustomerSegments::PROVIDER_KEY + CustomerSegments::PROVIDER_KEY, ]; return $providers; } - /** - * @inheritDoc - */ public function canMatch(): bool { return true; } - /** - * @inheritDoc - */ public function match(VisitorInfo $visitorInfo): bool { $customer = $visitorInfo->get(Customer::PROVIDER_KEY); diff --git a/src/Targeting/Condition/HasSegment.php b/src/Targeting/Condition/HasSegment.php index 3e9edcc7..4c73e7d4 100644 --- a/src/Targeting/Condition/HasSegment.php +++ b/src/Targeting/Condition/HasSegment.php @@ -40,10 +40,6 @@ class HasSegment extends AbstractVariableCondition implements DataProviderDepend */ private $options = []; - /** - * @param int|null $segmentId - * @param array $options - */ public function __construct(int $segmentId = null, array $options = []) { $this->segmentId = $segmentId; @@ -60,7 +56,7 @@ private function configureOptions(OptionsResolver $resolver) 'operator' => '>=', 'value' => 1, 'considerCustomerSegments' => true, - 'considerTrackedSegments' => true + 'considerTrackedSegments' => true, ]); $resolver->setAllowedTypes('operator', 'string'); @@ -75,9 +71,6 @@ private function configureOptions(OptionsResolver $resolver) $resolver->setAllowedTypes('considerTrackedSegments', 'bool'); } - /** - * @inheritDoc - */ public static function fromConfig(array $config): self { $segmentId = null; @@ -97,14 +90,11 @@ public static function fromConfig(array $config): self 'operator' => $config['condition_operator'] ?? '>=', 'value' => $config['value'] ?? 1, 'considerCustomerSegments' => $config['considerCustomerSegments'] ?? true, - 'considerTrackedSegments' => $config['considerTrackedSegments'] ?? true + 'considerTrackedSegments' => $config['considerTrackedSegments'] ?? true, ] ); } - /** - * @inheritDoc - */ public function getDataProviderKeys(): array { $providers = []; @@ -120,17 +110,11 @@ public function getDataProviderKeys(): array return $providers; } - /** - * @inheritDoc - */ public function canMatch(): bool { return null !== $this->segmentId; } - /** - * @inheritDoc - */ public function match(VisitorInfo $visitorInfo): bool { $segments = $this->loadSegments($visitorInfo); diff --git a/src/Targeting/DataProvider/Customer.php b/src/Targeting/DataProvider/Customer.php index 6d67bf4e..a60932ab 100644 --- a/src/Targeting/DataProvider/Customer.php +++ b/src/Targeting/DataProvider/Customer.php @@ -36,9 +36,6 @@ public function __construct(TokenStorageInterface $tokenStorage) $this->tokenStorage = $tokenStorage; } - /** - * @inheritDoc - */ public function load(VisitorInfo $visitorInfo): void { if ($visitorInfo->has(self::PROVIDER_KEY)) { diff --git a/src/Targeting/DataProvider/CustomerSegments.php b/src/Targeting/DataProvider/CustomerSegments.php index 8c3a167e..b9bf8a1a 100644 --- a/src/Targeting/DataProvider/CustomerSegments.php +++ b/src/Targeting/DataProvider/CustomerSegments.php @@ -37,17 +37,11 @@ public function __construct(SegmentExtractorInterface $segmentExtractor) $this->segmentExtractor = $segmentExtractor; } - /** - * @inheritDoc - */ public function getDataProviderKeys(): array { return [Customer::PROVIDER_KEY]; } - /** - * @inheritDoc - */ public function load(VisitorInfo $visitorInfo): void { if ($visitorInfo->has(self::PROVIDER_KEY)) { diff --git a/src/Targeting/EventListener/ElementSegmentsListener.php b/src/Targeting/EventListener/ElementSegmentsListener.php index 7b850076..434612de 100644 --- a/src/Targeting/EventListener/ElementSegmentsListener.php +++ b/src/Targeting/EventListener/ElementSegmentsListener.php @@ -60,14 +60,14 @@ public function __construct( } /** - * @inheritDoc + * * * @return array */ public static function getSubscribedEvents()//: array { return [ - TargetingEvents::PRE_RESOLVE => 'onTargetingPreResolve' + TargetingEvents::PRE_RESOLVE => 'onTargetingPreResolve', ]; } diff --git a/src/Targeting/EventListener/TargetingToolbarListener.php b/src/Targeting/EventListener/TargetingToolbarListener.php index 329e2a2a..05be0028 100644 --- a/src/Targeting/EventListener/TargetingToolbarListener.php +++ b/src/Targeting/EventListener/TargetingToolbarListener.php @@ -58,7 +58,7 @@ public function __construct( public static function getSubscribedEvents()//: array { return [ - TargetingEvents::RENDER_TOOLBAR => 'onRenderToolbar' + TargetingEvents::RENDER_TOOLBAR => 'onRenderToolbar', ]; } diff --git a/src/Targeting/SegmentTracker.php b/src/Targeting/SegmentTracker.php index 691f41d1..137fd112 100644 --- a/src/Targeting/SegmentTracker.php +++ b/src/Targeting/SegmentTracker.php @@ -72,7 +72,6 @@ public function trackSegment(VisitorInfo $visitorInfo, CustomerSegmentInterface } /** - * @param VisitorInfo $visitorInfo * @param CustomerSegmentInterface[] $segments */ public function trackSegments(VisitorInfo $visitorInfo, array $segments) @@ -95,7 +94,6 @@ public function trackSegments(VisitorInfo $visitorInfo, array $segments) /** * Raw method to track ID to count assignments. Use trackSegment(s) if possible. * - * @param VisitorInfo $visitorInfo * @param array $assignments Segment ID as key, count as value */ public function trackAssignments(VisitorInfo $visitorInfo, array $assignments) @@ -127,9 +125,7 @@ public function trackAssignments(VisitorInfo $visitorInfo, array $assignments) /** * Read ID <-> count assignment mapping from storage * - * @param VisitorInfo $visitorInfo * - * @return array */ public function getAssignments(VisitorInfo $visitorInfo): array { @@ -144,11 +140,7 @@ public function getAssignments(VisitorInfo $visitorInfo): array /** * Returns assigned segments filtered for $allowedSegmentGroupReferences grouped by segment groups * - * @param VisitorInfo $visitorInfo - * @param array $allowedSegmentGroupReferences - * @param int $limitSegmentCountPerGroup * - * @return array */ public function getFilteredAssignments(VisitorInfo $visitorInfo, array $allowedSegmentGroupReferences, int $limitSegmentCountPerGroup): array { @@ -163,7 +155,7 @@ public function getFilteredAssignments(VisitorInfo $visitorInfo, array $allowedS if (in_array($reference, $allowedSegmentGroupReferences)) { $segmentCollection[$reference][] = [ 'segment' => $segment, - 'count' => $count + 'count' => $count, ]; } } diff --git a/src/Traits/ApplicationLoggerAware.php b/src/Traits/ApplicationLoggerAware.php index 51864868..bab67a52 100644 --- a/src/Traits/ApplicationLoggerAware.php +++ b/src/Traits/ApplicationLoggerAware.php @@ -66,7 +66,6 @@ public function getLogger() } /** - * @param LoggerInterface $logger * * @return $this */ diff --git a/src/Traits/LoggerAware.php b/src/Traits/LoggerAware.php index b109a4ac..403a561b 100644 --- a/src/Traits/LoggerAware.php +++ b/src/Traits/LoggerAware.php @@ -37,7 +37,6 @@ public function getLogger() } /** - * @param LoggerInterface $logger * * @return $this */ diff --git a/src/Twig/Extension/CmfFrontendUtilsExtension.php b/src/Twig/Extension/CmfFrontendUtilsExtension.php index d56213f2..df005ea3 100644 --- a/src/Twig/Extension/CmfFrontendUtilsExtension.php +++ b/src/Twig/Extension/CmfFrontendUtilsExtension.php @@ -51,10 +51,6 @@ class CmfFrontendUtilsExtension extends AbstractExtension /** * CmfFrontendUtilsExtension constructor. * - * @param Packages $packages - * @param JsConfigService $jsConfigService - * @param SegmentManagerInterface $segmentManager - * @param ExporterManagerInterface $customerExportManager */ public function __construct(Packages $packages, JsConfigService $jsConfigService, SegmentManagerInterface $segmentManager, ExporterManagerInterface $customerExportManager) { @@ -64,9 +60,6 @@ public function __construct(Packages $packages, JsConfigService $jsConfigService $this->customerExportManager = $customerExportManager; } - /** - * {@inheritdoc} - */ public function getFunctions(): array { return [ @@ -92,7 +85,7 @@ public function getFilters()//: array { return [ new TwigFilter('cmf_printFieldCombinations', [$this, 'printFieldCombinations']), - new TwigFilter('cmf_codeList', [$this, 'buildCodeList']) + new TwigFilter('cmf_codeList', [$this, 'buildCodeList']), ]; } diff --git a/src/Twig/Extension/CmfUrlUtilsExtension.php b/src/Twig/Extension/CmfUrlUtilsExtension.php index 2de051f1..a1fcf5d3 100644 --- a/src/Twig/Extension/CmfUrlUtilsExtension.php +++ b/src/Twig/Extension/CmfUrlUtilsExtension.php @@ -51,10 +51,6 @@ class CmfUrlUtilsExtension extends AbstractExtension /** * CmfUrlUtilsExtension constructor. * - * @param RouterInterface $router - * @param RequestStack $requestStack - * @param CustomerViewInterface $customerView - * @param LinkActivityDefinitionLinkGenerator $linkActivityUrlGenerator */ public function __construct(RouterInterface $router, RequestStack $requestStack, CustomerViewInterface $customerView, LinkActivityDefinitionLinkGenerator $linkActivityUrlGenerator) { @@ -213,7 +209,7 @@ public function getUserDetailUrl(CustomerInterface $customer): ?string $userDetailUrl = null; if ($this->customerView->hasDetailView($customer)) { $userDetailUrl = $this->router->generate('customermanagementframework_admin_customers_detail', [ - 'id' => $customer->getId() + 'id' => $customer->getId(), ]); $userDetailUrl = $this->getFormQueryString($userDetailUrl); diff --git a/src/View/Formatter/DefaultViewFormatter.php b/src/View/Formatter/DefaultViewFormatter.php index ca58b77a..87e6374a 100644 --- a/src/View/Formatter/DefaultViewFormatter.php +++ b/src/View/Formatter/DefaultViewFormatter.php @@ -56,7 +56,6 @@ public function translate($messageId, $parameters = []) } /** - * @param Data $fd * * @return string */ @@ -77,7 +76,6 @@ public function getLabelByFieldName(ClassDefinition $class, $fieldName) } /** - * @param Data $fd * @param mixed $value * * @return string @@ -171,7 +169,6 @@ public function getLocale() } /** - * @param CustomerSegmentInterface $segment * * @return string */ diff --git a/src/View/Formatter/ViewFormatterInterface.php b/src/View/Formatter/ViewFormatterInterface.php index e817f702..0ed29be1 100644 --- a/src/View/Formatter/ViewFormatterInterface.php +++ b/src/View/Formatter/ViewFormatterInterface.php @@ -22,14 +22,12 @@ interface ViewFormatterInterface extends TranslatorInterface { /** - * @param Data $fd * * @return string */ public function getLabelByFieldDefinition(Data $fd); /** - * @param ClassDefinition $class * @param string $fieldName * * @return string @@ -58,7 +56,6 @@ public function formatBooleanValue($value); public function formatDatetimeValue($value); /** - * @param Data $fd * @param mixed $value * * @return string diff --git a/tests/Model/Activity/ActivityTest.php b/tests/Model/Activity/ActivityTest.php index 831c8690..b8627ea5 100644 --- a/tests/Model/Activity/ActivityTest.php +++ b/tests/Model/Activity/ActivityTest.php @@ -1,6 +1,20 @@ setKey(uniqid()); $customer->setPublished(true); @@ -31,29 +45,28 @@ protected function createCustomer(): Customer { $customer->setFirstname('Peter'); $customer->setLastname('Hugo'); $customer->save(); + return $customer; } - public function testTrackActivity() { + public function testTrackActivity() + { $activityManager = \Pimcore::getContainer()->get(ActivityManagerInterface::class); $activityStore = \Pimcore::getContainer()->get('cmf.activity_store'); $customer = $this->createCustomer(); - $activity = new GenericActivity(['type' => 'test', 'attributes' => []]); $activity->setCustomer($customer); $activityManager->trackActivity($activity); $this->assertEquals(1, $activityStore->countActivitiesOfCustomer($customer)); - $activity = new GenericActivity(['type' => 'test2', 'attributes' => []]); $activity->setCustomer($customer); $activityManager->trackActivity($activity); $this->assertEquals(2, $activityStore->countActivitiesOfCustomer($customer)); - // --- create another customer $customer = $this->createCustomer(); @@ -69,12 +82,10 @@ public function testTrackActivity() { $listing->setLimit(1); $this->assertEquals(1, count($listing->getActivities())); - $listing = $activityStore->getActivityList(); $listing->addConditionParam('`type` = ? OR `type` = ?', ['test2', 'dsfsdf']); $this->assertEquals(2, $listing->count()); - // --- create another customer $customer = $this->createCustomer(); @@ -84,5 +95,4 @@ public function testTrackActivity() { $this->assertEquals(1, $activityStore->countActivitiesOfCustomer($customer)); } - } diff --git a/tests/Model/Customer/CustomerListTest.php b/tests/Model/Customer/CustomerListTest.php index 8cb1e2be..8ebfc591 100644 --- a/tests/Model/Customer/CustomerListTest.php +++ b/tests/Model/Customer/CustomerListTest.php @@ -1,7 +1,19 @@ 'ga-s1', 'group' => 'ga'], ['name' => 'ga-s2', 'group' => 'ga'], @@ -29,7 +40,7 @@ class CustomerListTest extends ModelTestCase ['name' => 'ga-s4', 'group' => 'ga'], ['name' => 'gb-s1', 'group' => 'gb'], ['name' => 'gb-s2', 'group' => 'gb'], - ['name' => 'gb-s3', 'group' => 'gb'] + ['name' => 'gb-s3', 'group' => 'gb'], ]; protected $customerDummyData = [ @@ -43,8 +54,8 @@ class CustomerListTest extends ModelTestCase 'date' => '1980-11-05', 'segments' => [ 'manual' => ['ga-s1', 'ga-s2', 'gb-s1'], - 'calculated' => ['gb-s2'] - ] + 'calculated' => ['gb-s2'], + ], ], [ 'firstname' => 'Jane', 'lastname' => 'Doe', @@ -55,8 +66,8 @@ class CustomerListTest extends ModelTestCase 'date' => '1980-01-01', 'segments' => [ 'manual' => ['ga-s1', 'ga-s2', 'gb-s1'], - 'calculated' => [] - ] + 'calculated' => [], + ], ], [ 'firstname' => 'John', 'lastname' => 'Doe', @@ -67,8 +78,8 @@ class CustomerListTest extends ModelTestCase 'date' => '1980-05-05', 'segments' => [ 'manual' => ['ga-s3', 'ga-s4'], - 'calculated' => [] - ] + 'calculated' => [], + ], ], [ 'firstname' => 'Sam', 'lastname' => 'Jackman Pet', @@ -79,8 +90,8 @@ class CustomerListTest extends ModelTestCase 'date' => '1980-05-06', 'segments' => [ 'manual' => ['ga-s3', 'ga-s4'], - 'calculated' => ['gb-s3'] - ] + 'calculated' => ['gb-s3'], + ], ], [ 'firstname' => 'Sohpie', 'lastname' => 'Fischer Hugo', @@ -91,9 +102,9 @@ class CustomerListTest extends ModelTestCase 'date' => '1980-06-05', 'segments' => [ 'manual' => ['ga-s1', 'ga-s2', 'ga-s3', 'ga-s4'], - 'calculated' => [] - ] - ] + 'calculated' => [], + ], + ], ]; public function setUp(): void @@ -179,7 +190,6 @@ public function testEqualsFilter() $modifiedListing = $handler->getListing(); $this->assertEquals(1, $modifiedListing->getCount()); - //test one filter $listing = new Customer\Listing(); $handler = new FilterHandler($listing); @@ -190,7 +200,6 @@ public function testEqualsFilter() $modifiedListing = $handler->getListing(); $this->assertEquals(count($this->customerDummyData) - 1, $modifiedListing->getCount()); - //test two filters $listing = new Customer\Listing(); $handler = new FilterHandler($listing); @@ -216,7 +225,6 @@ public function testEqualsFilter() $modifiedListing = $handler->getListing(); $this->assertEquals(0, $modifiedListing->getCount()); - //test filters array $listing = new Customer\Listing(); $handler = new FilterHandler($listing); @@ -232,7 +240,6 @@ public function testEqualsFilter() } - public function testFloatBetweenFilter() { //test one filter @@ -246,7 +253,6 @@ public function testFloatBetweenFilter() $modifiedListing = $handler->getListing(); $this->assertEquals(count($this->customerDummyData), $modifiedListing->getCount()); - $listing = new Customer\Listing(); $handler = new FilterHandler($listing); @@ -281,31 +287,31 @@ public function testFloatBetweenFilter() $this->assertEquals(2, $modifiedListing->getCount()); //TODO only makes sense with or filters ... do not work yet. -// $listing = new Customer\Listing(); -// $handler = new FilterHandler($listing); -// -// $betweenFilter = new FloatBetween($idField, $this->customerDummyData[0][$idField], $this->customerDummyData[1][$idField]); -// $handler->addFilter($betweenFilter); -// -// $betweenFilter = new FloatBetween($idField, $this->customerDummyData[1][$idField], $this->customerDummyData[2][$idField]); -// $handler->addFilter($betweenFilter); -// -// $modifiedListing = $handler->getListing(); -// $this->assertEquals(3, $modifiedListing->getCount()); -// -// -// //test filters array -// $listing = new Customer\Listing(); -// $handler = new FilterHandler($listing); -// -// $betweenFilter = []; -// $betweenFilter[] = new FloatBetween($idField, $this->customerDummyData[0][$idField], $this->customerDummyData[1][$idField]); -// $betweenFilter[] = new FloatBetween($idField, $this->customerDummyData[1][$idField], $this->customerDummyData[2][$idField]); -// -// $handler->addFilters($betweenFilter); -// -// $modifiedListing = $handler->getListing(); -// $this->assertEquals(3, $modifiedListing->getCount()); + // $listing = new Customer\Listing(); + // $handler = new FilterHandler($listing); + // + // $betweenFilter = new FloatBetween($idField, $this->customerDummyData[0][$idField], $this->customerDummyData[1][$idField]); + // $handler->addFilter($betweenFilter); + // + // $betweenFilter = new FloatBetween($idField, $this->customerDummyData[1][$idField], $this->customerDummyData[2][$idField]); + // $handler->addFilter($betweenFilter); + // + // $modifiedListing = $handler->getListing(); + // $this->assertEquals(3, $modifiedListing->getCount()); + // + // + // //test filters array + // $listing = new Customer\Listing(); + // $handler = new FilterHandler($listing); + // + // $betweenFilter = []; + // $betweenFilter[] = new FloatBetween($idField, $this->customerDummyData[0][$idField], $this->customerDummyData[1][$idField]); + // $betweenFilter[] = new FloatBetween($idField, $this->customerDummyData[1][$idField], $this->customerDummyData[2][$idField]); + // + // $handler->addFilters($betweenFilter); + // + // $modifiedListing = $handler->getListing(); + // $this->assertEquals(3, $modifiedListing->getCount()); } @@ -321,7 +327,6 @@ public function testDateBetweenFilter() $modifiedListing = $handler->getListing(); $this->assertEquals(count($this->customerDummyData), $modifiedListing->getCount()); - $listing = new Customer\Listing(); $handler = new FilterHandler($listing); @@ -331,7 +336,6 @@ public function testDateBetweenFilter() $modifiedListing = $handler->getListing(); $this->assertEquals(2, $modifiedListing->getCount()); - //test two filters $listing = new Customer\Listing(); $handler = new FilterHandler($listing); @@ -342,7 +346,6 @@ public function testDateBetweenFilter() $dateFilter = new DateBetween('birthdate', Carbon::createFromFormat('Y-m-d', '1980-01-01'), Carbon::createFromFormat('Y-m-d', '1980-08-31')); $handler->addFilter($dateFilter); - $modifiedListing = $handler->getListing(); $this->assertEquals(2, $modifiedListing->getCount()); @@ -380,7 +383,6 @@ public function testCustomerSegmentFilter() $modifiedListing = $handler->getListing(); $this->assertEquals(3, $modifiedListing->getCount()); - //test two segments - 2 $listing = new Customer\Listing(); $handler = new FilterHandler($listing); @@ -410,7 +412,6 @@ public function testCustomerSegmentFilter() $this->assertEquals(4, $modifiedListing->getCount()); } - public function testSearchFilter() { //test one filter @@ -445,7 +446,8 @@ public function testSearchFilter() } - public function testSingleSearchQueryFilter() { + public function testSingleSearchQueryFilter() + { //test one filter $listing = new Customer\Listing(); @@ -466,7 +468,6 @@ public function testSingleSearchQueryFilter() { $modifiedListing = $handler->getListing(); $this->assertEquals(2, $modifiedListing->getCount()); - // ------------ $listing = new Customer\Listing(); $handler = new FilterHandler($listing); @@ -505,7 +506,6 @@ public function testSingleSearchQueryFilter() { $modifiedListing = $handler->getListing(); $this->assertEquals(0, $modifiedListing->getCount()); - $listing = new Customer\Listing(); $handler = new FilterHandler($listing); @@ -515,7 +515,6 @@ public function testSingleSearchQueryFilter() { $modifiedListing = $handler->getListing(); $this->assertEquals(1, $modifiedListing->getCount()); - // ------------ $listing = new Customer\Listing(); $handler = new FilterHandler($listing); @@ -526,7 +525,6 @@ public function testSingleSearchQueryFilter() { $modifiedListing = $handler->getListing(); $this->assertEquals(4, $modifiedListing->getCount()); - $listing = new Customer\Listing(); $handler = new FilterHandler($listing); @@ -536,8 +534,6 @@ public function testSingleSearchQueryFilter() { $modifiedListing = $handler->getListing(); $this->assertEquals(4, $modifiedListing->getCount()); - - // ------------ $listing = new Customer\Listing(); $handler = new FilterHandler($listing); @@ -548,7 +544,6 @@ public function testSingleSearchQueryFilter() { $modifiedListing = $handler->getListing(); $this->assertEquals(5, $modifiedListing->getCount()); - $listing = new Customer\Listing(); $handler = new FilterHandler($listing); @@ -619,7 +614,6 @@ public function testSingleSearchQueryFilter() { $modifiedListing = $handler->getListing(); $this->assertEquals(0, $modifiedListing->getCount()); - $listing = new Customer\Listing(); $handler = new FilterHandler($listing); @@ -638,7 +632,6 @@ public function testSingleSearchQueryFilter() { $modifiedListing = $handler->getListing(); $this->assertEquals(1, $modifiedListing->getCount()); - $listing = new Customer\Listing(); $handler = new FilterHandler($listing); @@ -659,7 +652,6 @@ public function testSingleSearchQueryFilter() { $modifiedListing = $handler->getListing(); $this->assertEquals(2, $modifiedListing->getCount()); - $listing = new Customer\Listing(); $handler = new FilterHandler($listing); @@ -697,47 +689,45 @@ public function testSingleSearchQueryFilter() { $handler = new FilterHandler($listing); $searchFilter = new SearchQuery(['email'], '*pimcore* AND !"sam.jackman@pimcore.fun"'); - $handler->addFilter ($searchFilter); - - $modifiedListing = $handler->getListing (); - $this->assertEquals (4, $modifiedListing->getCount ()); + $handler->addFilter($searchFilter); + $modifiedListing = $handler->getListing(); + $this->assertEquals(4, $modifiedListing->getCount()); $listing = new Customer\Listing(); $handler = new FilterHandler($listing); $searchFilter = new SearchQuery(['firstname', 'lastname', 'email'], '*pimcore* AND !"sam.jackman@pimcore.fun"'); - $handler->addFilter ($searchFilter); - - $modifiedListing = $handler->getListing (); - $this->assertEquals (4, $modifiedListing->getCount ()); + $handler->addFilter($searchFilter); + $modifiedListing = $handler->getListing(); + $this->assertEquals(4, $modifiedListing->getCount()); // ------------ $listing = new Customer\Listing(); $handler = new FilterHandler($listing); $searchFilter = new SearchQuery(['email'], '(*pimcore* AND !"sam.jackman@pimcore.fun") OR *fun'); - $handler->addFilter ($searchFilter); - - $modifiedListing = $handler->getListing (); - $this->assertEquals (5, $modifiedListing->getCount ()); + $handler->addFilter($searchFilter); + $modifiedListing = $handler->getListing(); + $this->assertEquals(5, $modifiedListing->getCount()); $listing = new Customer\Listing(); $handler = new FilterHandler($listing); $searchFilter = new SearchQuery(['firstname', 'lastname', 'email'], '(*pimcore* AND !"sam.jackman@pimcore.fun") OR *fun'); - $handler->addFilter ($searchFilter); + $handler->addFilter($searchFilter); - $modifiedListing = $handler->getListing (); - $this->assertEquals (5, $modifiedListing->getCount ()); + $modifiedListing = $handler->getListing(); + $this->assertEquals(5, $modifiedListing->getCount()); // -- Tests for Exact Search(Field should match exactly) with * } - public function testBoolCombinatorFilter() { + public function testBoolCombinatorFilter() + { //test one filter $listing = new Customer\Listing(); $handler = new FilterHandler($listing); @@ -748,7 +738,6 @@ public function testBoolCombinatorFilter() { $modifiedListing = $handler->getListing(); $this->assertEquals(1, $modifiedListing->getCount()); - //test two OR filters $listing = new Customer\Listing(); $handler = new FilterHandler($listing); @@ -798,7 +787,6 @@ public function testCombinedSearchQueryFilter() $modifiedListing = $handler->getListing(); $this->assertEquals(0, $modifiedListing->getCount()); - // -------------------- $listing = new Customer\Listing(); $handler = new FilterHandler($listing); @@ -807,11 +795,9 @@ public function testCombinedSearchQueryFilter() $searchFilter2 = new SearchQuery(['firstname'], 'pet*'); $handler->addFilter(new BoolCombinator([$searchFilter1, $searchFilter2], 'OR')); - $modifiedListing = $handler->getListing(); $this->assertEquals(2, $modifiedListing->getCount()); - // -------------------- $listing = new Customer\Listing(); $handler = new FilterHandler($listing); @@ -854,7 +840,6 @@ public function testCombinedSearchQueryFilter() $searchFilter2 = new SearchQuery(['firstname'], '"peter"'); $handler->addFilter(new BoolCombinator([$searchFilter1, $searchFilter2], 'OR')); - $modifiedListing = $handler->getListing(); $this->assertEquals(1, $modifiedListing->getCount()); diff --git a/tests/Model/Customer/CustomerTest.php b/tests/Model/Customer/CustomerTest.php index 7619a859..649693c2 100644 --- a/tests/Model/Customer/CustomerTest.php +++ b/tests/Model/Customer/CustomerTest.php @@ -1,17 +1,26 @@ setKey('foo'); @@ -37,5 +47,4 @@ public function testCreateCustomer() { $this->assertGreaterThan(0, $customer->getId()); } - } diff --git a/tests/Model/_bootstrap.php b/tests/Model/_bootstrap.php index 5367b35f..47598fcc 100644 --- a/tests/Model/_bootstrap.php +++ b/tests/Model/_bootstrap.php @@ -1,4 +1,16 @@ sut = new TypeMapper(); } - public function testGetTypeStringByObject() { + public function testGetTypeStringByObject() + { $objects = [new Document(), new Asset(), new DataObject()]; $expected = ['document', 'asset', 'object']; - $actual = array_map(function($item) { + $actual = array_map(function ($item) { return $this->sut->getTypeStringByObject($item); - }, $objects); + }, $objects); self::assertSame($expected, $actual); } diff --git a/tests/Unit/View/Formatter/ObjectWrapperTest.php b/tests/Unit/View/Formatter/ObjectWrapperTest.php index 69355d28..4807e3b5 100644 --- a/tests/Unit/View/Formatter/ObjectWrapperTest.php +++ b/tests/Unit/View/Formatter/ObjectWrapperTest.php @@ -1,12 +1,16 @@ [42.5], 'null' => [null], 'bool:true' => [true], - 'bool:false' => [false] + 'bool:false' => [false], ]; } } diff --git a/tests/Unit/_bootstrap.php b/tests/Unit/_bootstrap.php index 05ccf54e..55af41e5 100644 --- a/tests/Unit/_bootstrap.php +++ b/tests/Unit/_bootstrap.php @@ -1,14 +1,17 @@ debug('[CMF] Running cmf installer'); - //create migrations table in order to allow installation - needed for SettingsStoreAware Installer \Pimcore\Db::get()->exec(' create table migration_versions diff --git a/tests/_support/Helper/Unit.php b/tests/_support/Helper/Unit.php index 2a232f75..969374c6 100644 --- a/tests/_support/Helper/Unit.php +++ b/tests/_support/Helper/Unit.php @@ -1,12 +1,16 @@