idimensionz/sendgrid-webapi-v3-php

View on GitHub

Showing 16 of 16 total issues

MailDto has 44 functions (exceeds 20 allowed). Consider refactoring.
Open

class MailDto
{
    const DATE_FORMAT = 'Y-m-d';

    /**
Severity: Minor
Found in lib/iDimensionz/SendGridWebApiV3/Api/Mail/MailDto.php - About 6 hrs to fix

    MetricsDto has 42 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class MetricsDto
    {
        /**
         * @var array
         */
    Severity: Minor
    Found in lib/iDimensionz/SendGridWebApiV3/Api/Stats/MetricsDto.php - About 5 hrs to fix

      UserProfileDto has 25 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class UserProfileDto
      {
          /**
           * @var string $address
           */
      Severity: Minor
      Found in lib/iDimensionz/SendGridWebApiV3/Api/Users/UserProfileDto.php - About 2 hrs to fix

        File MailDto.php has 269 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /*
         * iDimensionz/{sendgrid-webapi-v3}
         * MailDto.php
         *  
        Severity: Minor
        Found in lib/iDimensionz/SendGridWebApiV3/Api/Mail/MailDto.php - About 2 hrs to fix

          Method toArray has 59 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function toArray()
              {
                  $output = [];
                  $personalizationData = [];
                  $personalizations = $this->getPersonalizations();
          Severity: Major
          Found in lib/iDimensionz/SendGridWebApiV3/Api/Mail/MailDto.php - About 2 hrs to fix

            Function toArray has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                public function toArray()
                {
                    $output = [];
                    $personalizationData = [];
                    $personalizations = $this->getPersonalizations();
            Severity: Minor
            Found in lib/iDimensionz/SendGridWebApiV3/Api/Mail/MailDto.php - About 2 hrs 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

            MailSettingsDto has 21 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class MailSettingsDto
            {
                /**
                 * @var boolean
                 */
            Severity: Minor
            Found in lib/iDimensionz/SendGridWebApiV3/Api/Mail/MailSettingsDto.php - About 2 hrs to fix

              File MetricsDto.php has 254 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              /*
               * iDimensionz/{sendgrid-webapi-v3}
               * MetricsDto.php
               *  
              Severity: Minor
              Found in lib/iDimensionz/SendGridWebApiV3/Api/Stats/MetricsDto.php - About 2 hrs to fix

                Function isReadyToSend has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function isReadyToSend(MailDto $mailDto)
                    {
                        $isReady = true;
                        // Check personalizations.
                        $personalizationCount = count($mailDto->getPersonalizations());
                Severity: Minor
                Found in lib/iDimensionz/SendGridWebApiV3/Api/Mail/MailApi.php - About 1 hr 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

                Method toArray has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function toArray()
                    {
                        $output = [];
                        if (!empty($this->getBccEmailAddress()) && !empty($this->isBccEnabled())) {
                            $output['bcc'] = [
                Severity: Minor
                Found in lib/iDimensionz/SendGridWebApiV3/Api/Mail/MailSettingsDto.php - About 1 hr to fix

                  Method isReadyToSend has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function isReadyToSend(MailDto $mailDto)
                      {
                          $isReady = true;
                          // Check personalizations.
                          $personalizationCount = count($mailDto->getPersonalizations());
                  Severity: Minor
                  Found in lib/iDimensionz/SendGridWebApiV3/Api/Mail/MailApi.php - About 1 hr to fix

                    Consider simplifying this complex logical expression.
                    Open

                            if ($isValid) {
                                $keys = array_keys($templateVersionData);
                                $isValid = $isValid &&
                                    in_array('id', $keys) &&
                                    in_array('template_id', $keys) &&
                    Severity: Major
                    Found in lib/iDimensionz/SendGridWebApiV3/Api/Templates/TemplateVersionDto.php - About 40 mins to fix

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

                          public function __construct($content, $filename, $type=null, $disposition=null, $contentId=null)
                      Severity: Minor
                      Found in lib/iDimensionz/SendGridWebApiV3/Api/Mail/AttachmentDto.php - About 35 mins to fix

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

                            public function toArray()
                            {
                                $output = [];
                                if (!empty($this->getBccEmailAddress()) && !empty($this->isBccEnabled())) {
                                    $output['bcc'] = [
                        Severity: Minor
                        Found in lib/iDimensionz/SendGridWebApiV3/Api/Mail/MailSettingsDto.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 __construct has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function __construct(array $templateVersionData)
                            {
                                $this->validateArray($templateVersionData);
                                if (!empty($templateVersionData)) {
                                    $this->setId($templateVersionData['id']);
                        Severity: Minor
                        Found in lib/iDimensionz/SendGridWebApiV3/Api/Templates/TemplateVersionDto.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 __construct has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function __construct(array $metricsData)
                            {
                                if (array_key_exists('metrics', $metricsData)) {
                                    $this->setMetrics($metricsData['metrics']);
                                    if (array_key_exists('name', $metricsData)) {
                        Severity: Minor
                        Found in lib/iDimensionz/SendGridWebApiV3/Api/Stats/MetricsDto.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

                        Severity
                        Category
                        Status
                        Source
                        Language