elcodedocle/marketo-soap-api-php-client

View on GitHub
src/MarketoSoapApiClient.php

Summary

Maintainability
C
1 day
Test Coverage

File MarketoSoapApiClient.php has 359 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Core file of the Marketo SOAP API Client project
 *
 * @category   SOAP_API_Client
Severity: Minor
Found in src/MarketoSoapApiClient.php - About 4 hrs to fix

    Method scheduleCampaign has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function scheduleCampaign(
            $programName,
            $campaignName,
            $tokens,
            $runAt = null
    Severity: Minor
    Found in src/MarketoSoapApiClient.php - About 1 hr to fix

      Method runCampaignOnLeads has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function runCampaignOnLeads($campaignKey, $leads, $tokens = null){
      
              $leadKeys = array();
              foreach ($leads as $key => $element){
                  if (is_array($element)){
      Severity: Minor
      Found in src/MarketoSoapApiClient.php - About 1 hr to fix

        Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                $userId,
                $secretKey,
                $soapClient,
                $options = array(),
                $namespace = 'http://www.marketo.com/mktows/',
        Severity: Minor
        Found in src/MarketoSoapApiClient.php - About 45 mins to fix

          Function runCampaignOnLeads has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function runCampaignOnLeads($campaignKey, $leads, $tokens = null){
          
                  $leadKeys = array();
                  foreach ($leads as $key => $element){
                      if (is_array($element)){
          Severity: Minor
          Found in src/MarketoSoapApiClient.php - About 35 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function buildLeadRecord has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function buildLeadRecord($leadAttributes, $leadKey = null){
          
                  $record = new stdClass;
          
                  // Identify the lead if it is known
          Severity: Minor
          Found in src/MarketoSoapApiClient.php - About 35 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function prepareLeadActivityResults has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function prepareLeadActivityResults($marketo_result) {
                  if ($marketo_result->leadActivityList->returnCount > 1) {
                      $activity = $marketo_result->leadActivityList->activityRecordList->activityRecord;
                  }
                  elseif ($marketo_result->leadActivityList->returnCount == 1) {
          Severity: Minor
          Found in src/MarketoSoapApiClient.php - About 25 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function keyType has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function keyType($key) {
                  if (filter_var($key, FILTER_VALIDATE_EMAIL)) {
                      $type = 'EMAIL';
                  }
                  elseif (is_int($key) || (is_string($key) && ctype_digit($key))) {
          Severity: Minor
          Found in src/MarketoSoapApiClient.php - About 25 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function flattenAttributes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function flattenAttributes($attributes){
          
                  $types = array('integer', 'string', 'boolean', 'float');
                  $flattenedAttributes = array();
          
          
          Severity: Minor
          Found in src/MarketoSoapApiClient.php - About 25 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          There are no issues that match your filters.

          Category
          Status