Commit 561d6086 authored by john_a's avatar john_a Committed by John.Avery
Browse files

Issue #3198635 by john_a: Linting issues

parent 6dfb90bb
......@@ -83,8 +83,7 @@ function marketing_cloud_update_8004() {
*
* @see https://www.drupal.org/project/marketing_cloud/issues/3193522
*/
function marketing_cloud_update_8005()
{
function marketing_cloud_update_8005() {
$settings = Drupal::configFactory()->getEditable('marketing_cloud.settings');
if ($settings->get('scope') === NULL) {
$settings->set('scope', '')->save();
......
......@@ -145,7 +145,12 @@ class CampaignsService extends MarketingCloudService {
*/
public function getCampaignAsset($id, $assetId) {
$machineName = 'get_campaign_asset';
return $this->apiCall($this->moduleName, $machineName, new \stdClass(), ['[id]' => $id, '[assetId]' => $assetId]);
return $this->apiCall(
$this->moduleName,
$machineName,
new \stdClass(),
['[id]' => $id, '[assetId]' => $assetId]
);
}
/**
......@@ -163,7 +168,12 @@ class CampaignsService extends MarketingCloudService {
*/
public function unassociateAssetFromCampaign($id, $assetId) {
$machineName = 'unassociate_asset_from_campaign';
return $this->apiCall($this->moduleName, $machineName, new \stdClass(), ['[id]' => $id, '[assetId]' => $assetId]);
return $this->apiCall(
$this->moduleName,
$machineName,
new \stdClass(),
['[id]' => $id, '[assetId]' => $assetId]
);
}
}
......@@ -280,7 +280,12 @@ class ContactsService extends MarketingCloudService {
*/
public function searchAttributeGroupIdBySchema($schemaId, $id) {
$machineName = 'search_attribute_group_id_by_schema';
return $this->apiCall($this->moduleName, $machineName, new \stdClass(), ['[schemaId]' => $schemaId, '[id]' => $id]);
return $this->apiCall(
$this->moduleName,
$machineName,
new \stdClass(),
['[schemaId]' => $schemaId, '[id]' => $id]
);
}
/**
......@@ -318,7 +323,12 @@ class ContactsService extends MarketingCloudService {
*/
public function searchAttributeSetNamesBySchema($schemaId, $name, $json) {
$machineName = 'search_attribute_set_names_by_schema';
return $this->apiCall($this->moduleName, $machineName, $json, ['[schemaId]' => $schemaId, '[name]' => $name]);
return $this->apiCall(
$this->moduleName,
$machineName,
$json,
['[schemaId]' => $schemaId, '[name]' => $name]
);
}
/**
......
......@@ -64,7 +64,12 @@ class DataEventsService extends MarketingCloudService {
if (empty($json)) {
$json = new \stdClass();
}
return $this->apiCall($this->moduleName, $machineName, $json, ['[key]' => $key, '[primaryKeys]' => $primaryKeys]);
return $this->apiCall(
$this->moduleName,
$machineName,
$json,
['[key]' => $key, '[primaryKeys]' => $primaryKeys]
);
}
/**
......
......@@ -227,7 +227,13 @@ class InteractionService extends MarketingCloudService {
public function getJourneyAuditLog($id, $action, $versionNumber = NULL) {
$machineName = 'get_journey_audit_log';
$params = !$versionNumber ? [] : ['versionNumber' => $versionNumber];
return $this->apiCall($this->moduleName, $machineName, new \stdClass(), ['[id]' => $id, '[action]' => $action], $params);
return $this->apiCall(
$this->moduleName,
$machineName,
new \stdClass(),
['[id]' => $id, '[action]' => $action],
$params
);
}
/**
......
......@@ -387,7 +387,7 @@ class MarketingCloudInteractionTest extends BrowserTestBase {
"description" => "api created journey",
"workflowApiVersion" => 1.0,
"triggers" => ['sdf'],
"goals" => ['sag','asdg'],
"goals" => ['sag', 'asdg'],
"activities" => ['qwert', 'ertyu', 'sdfgh'],
];
}
......
......@@ -68,7 +68,12 @@ class MessagesService extends MarketingCloudService {
*/
public function getEmailDeliveryStatus($key, $recipientSendId) {
$machineName = 'get_email_delivery_status';
return $this->apiCall($this->moduleName, $machineName, new \stdClass(), ['[key]' => $key, '[recipientSendId]' => $recipientSendId]);
return $this->apiCall(
$this->moduleName,
$machineName,
new \stdClass(),
['[key]' => $key, '[recipientSendId]' => $recipientSendId]
);
}
}
......@@ -337,7 +337,12 @@ class PushService extends MarketingCloudService {
*/
public function updateCustomKey($appId, $key) {
$machineName = 'update_custom_key';
return $this->apiCall($this->moduleName, $machineName, new \stdClass(), ['[appId]' => $appId, '[key]' => $key]);
return $this->apiCall(
$this->moduleName,
$machineName,
new \stdClass(),
['[appId]' => $appId, '[key]' => $key]
);
}
/**
......@@ -356,7 +361,12 @@ class PushService extends MarketingCloudService {
*/
public function deleteCustomKey($appId, $key) {
$machineName = 'delete_custom_key';
return $this->apiCall($this->moduleName, $machineName, new \stdClass(), ['[appId]' => $appId, '[key]' => $key]);
return $this->apiCall(
$this->moduleName,
$machineName,
new \stdClass(),
['[appId]' => $appId, '[key]' => $key]
);
}
/**
......@@ -411,7 +421,12 @@ class PushService extends MarketingCloudService {
*/
public function getRefreshListStatus($id, $tokenId) {
$machineName = 'get_refresh_list_status';
return $this->apiCall($this->moduleName, $machineName, new \stdClass(), ['[id]' => $id, '[tokenId]' => $tokenId]);
return $this->apiCall(
$this->moduleName,
$machineName,
new \stdClass(),
['[id]' => $id, '[tokenId]' => $tokenId]
);
}
/**
......@@ -430,7 +445,12 @@ class PushService extends MarketingCloudService {
*/
public function getDeliveryStatusOfMessageApp($messageId, $tokenId) {
$machineName = 'get_delivery_status_of_message_app';
return $this->apiCall($this->moduleName, $machineName, new \stdClass(), ['[messageId]' => $messageId, '[tokenId]' => $tokenId]);
return $this->apiCall(
$this->moduleName,
$machineName,
new \stdClass(),
['[messageId]' => $messageId, '[tokenId]' => $tokenId]
);
}
/**
......@@ -449,7 +469,12 @@ class PushService extends MarketingCloudService {
*/
public function getDeliveryStatusOfMessageTag($messageId, $tokenId) {
$machineName = 'get_delivery_status_of_message_tag';
return $this->apiCall($this->moduleName, $machineName, new \stdClass(), ['[messageId]' => $messageId, '[tokenId]' => $tokenId]);
return $this->apiCall(
$this->moduleName,
$machineName,
new \stdClass(),
['[messageId]' => $messageId, '[tokenId]' => $tokenId]
);
}
/**
......@@ -468,7 +493,12 @@ class PushService extends MarketingCloudService {
*/
public function getDeliveryStatusOfMessageList($messageId, $tokenId) {
$machineName = 'get_delivery_status_of_message_list';
return $this->apiCall($this->moduleName, $machineName, new \stdClass(), ['[messageId]' => $messageId, '[tokenId]' => $tokenId]);
return $this->apiCall(
$this->moduleName,
$machineName,
new \stdClass(),
['[messageId]' => $messageId, '[tokenId]' => $tokenId]
);
}
/**
......@@ -486,7 +516,12 @@ class PushService extends MarketingCloudService {
*/
public function getDeliveryStatusOfMessageContact($messageId, $tokenId) {
$machineName = 'get_delivery_status_of_message_contact';
return $this->apiCall($this->moduleName, $machineName, new \stdClass(), ['[messageId]' => $messageId, '[tokenId]' => $tokenId]);
return $this->apiCall(
$this->moduleName,
$machineName,
new \stdClass(),
['[messageId]' => $messageId, '[tokenId]' => $tokenId]
);
}
}
......@@ -256,7 +256,12 @@ class SMSService extends MarketingCloudService {
*/
public function getMessageListStatus($messageId, $tokenId) {
$machineName = 'get_message_list_status';
return $this->apiCall($this->moduleName, $machineName, new \stdClass(), ['[messageId]' => $messageId, '[tokenId]' => $tokenId]);
return $this->apiCall(
$this->moduleName,
$machineName,
new \stdClass(),
['[messageId]' => $messageId, '[tokenId]' => $tokenId]
);
}
/**
......@@ -311,7 +316,12 @@ class SMSService extends MarketingCloudService {
*/
public function createMessageListDeliveryReport($tokenId, $messageID, $json) {
$machineName = 'create_message_list_delivery_report';
return $this->apiCall($this->moduleName, $machineName, $json, ['[tokenId]' => $tokenId, '[messageID]' => $messageID]);
return $this->apiCall(
$this->moduleName,
$machineName,
$json,
['[tokenId]' => $tokenId, '[messageID]' => $messageID]
);
}
/**
......@@ -329,7 +339,12 @@ class SMSService extends MarketingCloudService {
*/
public function getRefreshListStatus($listId, $tokenId) {
$machineName = 'get_refresh_list_status';
return $this->apiCall($this->moduleName, $machineName, new \stdClass(), ['[listId]' => $listId, '[tokenId]' => $tokenId]);
return $this->apiCall(
$this->moduleName,
$machineName,
new \stdClass(),
['[listId]' => $listId, '[tokenId]' => $tokenId]
);
}
/**
......@@ -347,7 +362,11 @@ class SMSService extends MarketingCloudService {
*/
public function getImportStatus($listId, $tokenId) {
$machineName = 'get_import_status';
return $this->apiCall($this->moduleName, $machineName, new \stdClass(), ['[listId]' => $listId, '[tokenId]' => $tokenId]);
return $this->apiCall(
$this->moduleName, $machineName,
new \stdClass(),
['[listId]' => $listId, '[tokenId]' => $tokenId]
);
}
/**
......
......@@ -28,7 +28,7 @@ class WorkflowTeamsService extends MarketingCloudService {
* Retrieves a list of active workflow teams. Depending on the query string parameters, the result includes one or both filtered results: role user information for each workflow item or workflow items to which the current user is assigned.
*
* @param string $objectType
* Specify the workflow object type to retrieve or use (@all to retrieve all workflow object types).
* Specify the workflow object type to retrieve or use (@all to retrieve all workflow object types).
* @param array $params
* URL filter params. Permissible keys:
* assignee string
......@@ -91,7 +91,10 @@ class WorkflowTeamsService extends MarketingCloudService {
$this->moduleName,
$machineName,
$json,
['[workflowRoleInstanceId]' => $workflowRoleInstanceId, '[workflowItemId]' => $workflowItemId],
[
'[workflowRoleInstanceId]' => $workflowRoleInstanceId,
'[workflowItemId]' => $workflowItemId,
],
[]
);
}
......@@ -120,7 +123,7 @@ class WorkflowTeamsService extends MarketingCloudService {
[
'[workflowRoleInstanceId]' => $workflowRoleInstanceId,
'[workflowItemId]' => $workflowItemId,
'[userId]' => $userId
'[userId]' => $userId,
],
[]
);
......
......@@ -76,7 +76,10 @@ class MarketingCloudWorkflowTeamsTest extends BrowserTestBase {
$this->validateDefinitionIsEmpty('get_active_workflow_teams');
// Test getActiveWorkflowTeams against expected inputs.
$result = $this->service
->getActiveWorkflowTeams('@all', ['assignee' => '@current', 'extra' => 'roleusers']);
->getActiveWorkflowTeams(
'@all',
['assignee' => '@current', 'extra' => 'roleusers']
);
$this->assertEquals('https://www.exacttargetapis.com/hub/v1/workflowteams/@all?assignee=@current&extra=roleusers',
$result['url'],
'Unexpected URL.');
......@@ -143,13 +146,19 @@ class MarketingCloudWorkflowTeamsTest extends BrowserTestBase {
$this->assertNotEqual($schema, '', "json schema for $machineName should be an empty string.");
}
/**
* Return test data for state transition.
*/
private function getStateTransitionData() {
return [
'transitionid' => '865rkv',
'overrideNotificationId' => 'fsthjerhn'
'overrideNotificationId' => 'fsthjerhn',
];
}
/**
* Return test data for active workflow.
*/
private function getActiveWorkflowTeamsData() {
return [
'userId' => 'jgfd540ilk',
......
......@@ -171,7 +171,10 @@ abstract class MarketingCloudService {
$validator = Schema::import($schema);
}
catch (Exception $e) {
$message = $this->t('Errors were found in the schema for %machine_name in %module_name. Please check the logs.', ['%machine_name' => $machineName, '%module_name' => $moduleName]);
$message = $this->t(
'Errors were found in the schema for %machine_name in %module_name. Please check the logs.',
['%machine_name' => $machineName, '%module_name' => $moduleName]
);
$this->messenger->addError($message);
$message = $this->t('Error in the JSON schema for the %machine_name in %module_name schema: %error',
[
......@@ -185,7 +188,10 @@ abstract class MarketingCloudService {
return FALSE;
}
catch (InvalidValue $e) {
$message = $this->t('Errors were found in the schema for %machine_name in %module_name. Please check the logs.', ['%machine_name' => $machineName, '%module_name' => $moduleName]);
$message = $this->t(
'Errors were found in the schema for %machine_name in %module_name. Please check the logs.',
['%machine_name' => $machineName, '%module_name' => $moduleName]
);
$this->messenger->addError($message);
$message = $this->t('Error in the JSON schema for the %machine_name in %module_name schema: %error',
[
......@@ -268,7 +274,10 @@ abstract class MarketingCloudService {
$token = $session->token($force);
if (!$token) {
$message = $this->t('%method to %url failed, unable to fetch authentication token', ['%method' => $method, '%url' => $url]);
$message = $this->t(
'%method to %url failed, unable to fetch authentication token',
['%method' => $method, '%url' => $url]
);
$this->messenger->addError($message);
$this->loggerFactory->get(__METHOD__)->error($message);
return FALSE;
......
......@@ -125,7 +125,7 @@ class MarketingCloudSession {
* The Marketing Cloud secret.
* @param string $scope
* The Marketing Cloud scope.
* @param integer $accountId
* @param int $accountId
* The Marketing Cloud account id.
*
* @return bool|string
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment