Skip to content

Commit a34a948

Browse files
committed
CS fixer and rector
1 parent f4544ca commit a34a948

9 files changed

Lines changed: 34 additions & 77 deletions

Command/CustomDeduplicateCommand.php

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -56,24 +56,17 @@ class CustomDeduplicateCommand extends DeduplicateCommand
5656

5757
/**
5858
* DeduplicateCommand constructor.
59-
*
60-
* @param ContactDeduper $contactDeduper
61-
* @param TranslatorInterface $translator
62-
* @param NotificationModel $notificationModel
63-
* @param UserModel $userModel
64-
* @param IntegrationHelper $integrationHelper
65-
* @param Logger $logger
6659
*/
6760
public function __construct(ContactDeduper $contactDeduper, TranslatorInterface $translator, NotificationModel $notificationModel, UserModel $userModel, IntegrationHelper $integrationHelper, Logger $logger)
6861
{
6962
parent::__construct($contactDeduper, $translator);
7063

7164
$this->notificationModel = $notificationModel;
72-
$this->translator = $translator;
73-
$this->contactDeduper = $contactDeduper;
74-
$this->userModel = $userModel;
65+
$this->translator = $translator;
66+
$this->contactDeduper = $contactDeduper;
67+
$this->userModel = $userModel;
7568
$this->integrationHelper = $integrationHelper;
76-
$this->logger = $logger;
69+
$this->logger = $logger;
7770
}
7871

7972
public function configure()
@@ -103,10 +96,6 @@ public function configure()
10396
);
10497
}
10598

106-
/**
107-
* @param InputInterface $input
108-
* @param OutputInterface $output
109-
*/
11099
protected function execute(InputInterface $input, OutputInterface $output)
111100
{
112101
$integration = $this->integrationHelper->getIntegrationObject('CustomDeduplicate');
@@ -117,19 +106,20 @@ protected function execute(InputInterface $input, OutputInterface $output)
117106
);
118107
$this->sendDisabledNotification();
119108
$this->logger->debug($message);
109+
120110
return 0;
121111
}
122112

123113
$notify = (bool) $input->getOption('notify');
124-
$key = __CLASS__;
114+
$key = __CLASS__;
125115
if (!$this->checkRunStatus($input, $output, $key)) {
126116
if ($notify) {
127117
$this->sendProgressNotification();
128118
}
119+
129120
return 0;
130121
}
131122

132-
133123
if ($notify) {
134124
$this->sendStartNotification();
135125
}
@@ -151,6 +141,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
151141
if ($notify) {
152142
$this->sendEndNotification($count);
153143
}
144+
154145
return 0;
155146
}
156147

@@ -188,7 +179,7 @@ private function sendProgressNotification()
188179
private function sendEndNotification($count)
189180
{
190181
$this->notificationModel->addNotification(
191-
$this->translator->trans('plugin.custom.deduplication.notification.result.count',[
182+
$this->translator->trans('plugin.custom.deduplication.notification.result.count', [
192183
'%count%' => $count,
193184
]),
194185

Config/config.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
'arguments' => [
2121
'mautic.helper.integration',
2222
'router',
23-
'translator'
23+
'translator',
2424
],
2525
],
2626
'mautic.plugin.custom.deduplicate.contacts.subscriber' => [
@@ -37,23 +37,23 @@
3737
'doctrine.orm.entity_manager',
3838
'mautic.point.model.trigger',
3939
'mautic.lead.repository.lead',
40-
'mautic.plugin.custom.duplicate.fields'
40+
'mautic.plugin.custom.duplicate.fields',
4141
],
4242
],
4343
'mautic.plugin.custom.duplicate.fields' => [
4444
'class' => \MauticPlugin\MauticCustomDeduplicateBundle\Deduplicate\Fields::class,
4545
'arguments' => [
46-
'mautic.helper.integration'
46+
'mautic.helper.integration',
4747
],
4848
],
4949
'mautic.plugin.custom.duplicate.command.execute' => [
5050
'class' => \MauticPlugin\MauticCustomDeduplicateBundle\Deduplicate\CommandExecution::class,
5151
'arguments' => [
52-
'mautic.helper.core_parameters'
52+
'mautic.helper.core_parameters',
5353
],
5454
],
5555
],
56-
'command'=>[
56+
'command'=> [
5757
'mautic.plugin.custom.deduplicate.command' => [
5858
'class' => \MauticPlugin\MauticCustomDeduplicateBundle\Command\CustomDeduplicateCommand::class,
5959
'arguments' => [
@@ -62,7 +62,7 @@
6262
'mautic.core.model.notification',
6363
'mautic.user.model.user',
6464
'mautic.helper.integration',
65-
'monolog.logger.mautic'
65+
'monolog.logger.mautic',
6666
],
6767
'tag' => 'console.command',
6868
],

Controller/CustomDeduplicateController.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,18 @@
1515

1616
class CustomDeduplicateController extends CommonController
1717
{
18-
1918
public function runAction()
2019
{
21-
2220
$flashes = [];
23-
$routeContext = 'contact';
21+
$routeContext = 'contact';
2422
$contentTemplate = 'MauticLeadBundle:Lead:index';
2523
$activeLink = '#mautic_contact_index';
2624
$mauticContent = 'lead';
2725
$returnUrl = $this->generateUrl(
2826
'mautic_'.$routeContext.'_index'
2927
);
3028
$this->get('mautic.plugin.custom.duplicate.command.execute')->execute();
31-
$flashes[] = [
29+
$flashes[] = [
3230
'type' => 'notice',
3331
'msg' => $this->translator->trans('plugin.custom.deduplication.command'),
3432
];

Deduplicate/CommandExecution.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,16 @@ public function getDefaultConsolePath()
3434
}
3535

3636
/**
37-
* Execute command line in background
37+
* Execute command line in background.
3838
*/
3939
public function execute()
4040
{
4141
$cmd = 'php '.$this->getDefaultConsolePath().' mautic:contacts:deduplicate:custom --notify --env='.MAUTIC_ENV;
4242

43-
if (substr(php_uname(), 0, 7) == "Windows") {
44-
pclose(popen("start /B ".$cmd, "r"));
43+
if ('Windows' == substr(php_uname(), 0, 7)) {
44+
pclose(popen('start /B '.$cmd, 'r'));
4545
} else {
46-
exec($cmd." > /dev/null &");
46+
exec($cmd.' > /dev/null &');
4747
}
4848
}
4949
}

Deduplicate/CustomDuplications.php

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -22,40 +22,22 @@ class CustomDuplications
2222
*/
2323
private $entityManager;
2424

25-
/**
26-
* @var TriggerModel
27-
*/
28-
private $triggerModel;
29-
30-
/**
31-
* @var LeadRepository
32-
*/
33-
private $leadRepository;
34-
3525
/**
3626
* @var Fields
3727
*/
3828
private $fields;
3929

4030
/**
4131
* CustomDuplications constructor.
42-
*
43-
* @param EntityManager $entityManager
44-
* @param TriggerModel $triggerModel
45-
* @param LeadRepository $leadRepository
46-
* @param Fields $fields
4732
*/
4833
public function __construct(
4934
EntityManager $entityManager,
5035
TriggerModel $triggerModel,
5136
LeadRepository $leadRepository,
5237
Fields $fields
5338
) {
54-
5539
$this->entityManager = $entityManager;
56-
$this->triggerModel = $triggerModel;
57-
$this->leadRepository = $leadRepository;
58-
$this->fields = $fields;
40+
$this->fields = $fields;
5941
}
6042

6143
/**
@@ -72,7 +54,6 @@ public function customCheckForDuplicateContacts($fields)
7254
return $this->getContactsByUniqueFields($uniqueData);
7355
}
7456
}
75-
7657
}
7758

7859
/**
@@ -134,26 +115,24 @@ private function getContactsByUniqueFields($uniqueFieldsWithData, $leadId = null
134115
->setParameter('ids', array_keys($leads))
135116
->orderBy('l.dateAdded', 'DESC')
136117
->addOrderBy('l.id', 'DESC');
137-
$entities = $q->getQuery()
138-
->getResult();
139118

140-
return $entities;
119+
return $q->getQuery()
120+
->getResult();
141121
}
142122

143123
/**
144-
* @param array $queryFields
145-
*
146124
* @return array
147125
*/
148126
private function getCustomUniqueData(array $queryFields)
149127
{
150-
$uniqueLeadFields = $this->fields->getCustomUniqueFields();
128+
$uniqueLeadFields = $this->fields->getCustomUniqueFields();
151129
$uniqueLeadFieldData = [];
152130
foreach ($queryFields as $k => $v) {
153131
if (in_array($k, $uniqueLeadFields)) {
154132
$uniqueLeadFieldData[$k] = $v;
155133
}
156134
}
135+
157136
return $uniqueLeadFieldData;
158137
}
159138
}

Deduplicate/Fields.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ class Fields
3030
private $settings;
3131

3232
public function __construct(IntegrationHelper $integrationHelper)
33-
{
34-
$this->integrationHelper = $integrationHelper;
35-
$integration = $this->integrationHelper->getIntegrationObject('CustomDeduplicate');
36-
if ($integration && $integration->getIntegrationSettings()->getIsPublished()) {
37-
$this->settings = $integration->mergeConfigToFeatureSettings();
38-
}
39-
}
33+
{
34+
$this->integrationHelper = $integrationHelper;
35+
$integration = $this->integrationHelper->getIntegrationObject('CustomDeduplicate');
36+
if ($integration && $integration->getIntegrationSettings()->getIsPublished()) {
37+
$this->settings = $integration->mergeConfigToFeatureSettings();
38+
}
39+
}
4040

4141
/**
4242
* @return array
@@ -46,7 +46,6 @@ public function getFieldsToSkip()
4646
return isset($this->settings['skipFields']) ? $this->settings['skipFields'] : [];
4747
}
4848

49-
5049
/**
5150
* @return array
5251
*/

EventListener/ButtonSubscriber.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ class ButtonSubscriber implements EventSubscriberInterface
2929
*/
3030
protected $integrationHelper;
3131

32-
private $event;
33-
34-
private $objectId;
35-
3632
/**
3733
* @var RouterInterface
3834
*/

EventListener/CheckDeduplicateContactsListener.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,16 @@
2020

2121
class CheckDeduplicateContactsListener implements EventSubscriberInterface
2222
{
23-
2423
/**
2524
* @var CustomDuplications
2625
*/
2726
private $customDuplications;
2827

2928
/**
3029
* CheckDeduplicateContactsListener constructor.
31-
*
32-
* @param CustomDuplications $customDuplications
3330
*/
3431
public function __construct(CustomDuplications $customDuplications)
3532
{
36-
3733
$this->customDuplications = $customDuplications;
3834
}
3935

@@ -52,5 +48,4 @@ public function checkForDuplicateContacts(DuplicateContactsEvent $event)
5248
$duplications = $this->customDuplications->customCheckForDuplicateContacts($event->getFields());
5349
$event->setDuplicates($duplications);
5450
}
55-
5651
}

Integration/CustomDeduplicateIntegration.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function getIcon()
4242
*/
4343
public function appendToForm(&$builder, $data, $formArea)
4444
{
45-
if ($formArea == 'features') {
45+
if ('features' == $formArea) {
4646
$builder->add(
4747
'uniqueFields',
4848
LeadFieldsType::class,
@@ -72,5 +72,4 @@ public function appendToForm(&$builder, $data, $formArea)
7272
);
7373
}
7474
}
75-
7675
}

0 commit comments

Comments
 (0)