gomoob/php-pushwoosh

View on GitHub

Showing 15 of 27 total issues

Notification has 59 functions (exceeds 20 allowed). Consider refactoring.
Open

class Notification implements \JsonSerializable
{
    /**
     * An object which contains specific Pushwoosh notification informations for ADM (Amazon Device Messaging).
     *
Severity: Major
Found in src/main/php/Gomoob/Pushwoosh/Model/Notification/Notification.php - About 1 day to fix

    Function exports has 148 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function(grunt) {
    
        grunt.initConfig(
            {
    
    
    Severity: Major
    Found in Gruntfile.js - About 5 hrs to fix

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

      <?php
      
      /**
       * gomoob/php-pushwoosh
       *
      Severity: Minor
      Found in src/main/php/Gomoob/Pushwoosh/Model/Notification/Notification.php - About 4 hrs to fix

        CreateTargetedMessageRequest has 31 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class CreateTargetedMessageRequest extends AbstractRequest
        {
            /**
             * The campaign code to which you want to assign this push message.
             *

          Android has 26 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Android implements \JsonSerializable
          {
              /**
               * Android application icon badge number.
               *
          Severity: Minor
          Found in src/main/php/Gomoob/Pushwoosh/Model/Notification/Android.php - About 3 hrs to fix

            Pushwoosh has 22 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class Pushwoosh implements IPushwoosh // NOSONAR
            {
                /**
                 * The the Pushwoosh application ID to be used by default by all the requests performed by the Pushwoosh client.
                 * This identifier can be overwritten by request if needed.
            Severity: Minor
            Found in src/main/php/Gomoob/Pushwoosh/Client/Pushwoosh.php - About 2 hrs to fix

              Method jsonSerialize has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function jsonSerialize()
                  {
                      $json = [];
                  
                      // Mandatory parameters
              Severity: Minor
              Found in src/main/php/Gomoob/Pushwoosh/Model/Notification/Notification.php - About 1 hr to fix

                Function checkDeviceType has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function checkDeviceType()
                    {
                        // The 'deviceType' parameter must have been defined.
                        if (!isset($this->deviceType)) {
                            throw new PushwooshException('The \'deviceType\' property is not set !');

                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 pushwooshCall has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function pushwooshCall($method, array $data)
                    {
                        // Creates the absolute Web Service URL to call, here we first remove trailing '/' characters to be sure the URL
                        // is well formed
                        $url = rtrim($this->apiUrl, '/') . '/' . $method;
                Severity: Minor
                Found in src/main/php/Gomoob/Pushwoosh/Client/CURLClient.php - About 1 hr to fix

                  Method checkDeviceType has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function checkDeviceType()
                      {
                          // The 'deviceType' parameter must have been defined.
                          if (!isset($this->deviceType)) {
                              throw new PushwooshException('The \'deviceType\' property is not set !');

                    Function createMessage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function createMessage(CreateMessageRequest $createMessageRequest)
                        {
                            // If both the 'application' and 'applicationsGroup' attribute are not set in the request we try to get a
                            // default one from the Pushwoosh client
                            if ($createMessageRequest->getApplication() === null && $createMessageRequest->getApplicationsGroup() === null
                    Severity: Minor
                    Found in src/main/php/Gomoob/Pushwoosh/Client/Pushwoosh.php - About 45 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 jsonSerialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function jsonSerialize()
                        {
                            // One of the 'application' or 'applicationsGroup' parameter must have been defined.
                            if (!isset($this->application) && !isset($this->applicationsGroup)) {
                                throw new PushwooshException('None of the \'application\' or \'applicationsGroup\' properties are set !');
                    Severity: Minor
                    Found in src/main/php/Gomoob/Pushwoosh/Model/Request/CreateMessageRequest.php - About 45 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 setSendDate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function setSendDate(/* \DateTime */ $sendDate)
                        {
                            // Try to parse a string date
                            if (is_string($sendDate) && $sendDate !== 'now') {
                                $newSendDate = \DateTime::createFromFormat('Y-m-d H:i', $sendDate);
                    Severity: Minor
                    Found in src/main/php/Gomoob/Pushwoosh/Model/Notification/Notification.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 setSendDate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function setSendDate(/* \DateTime */ $sendDate)
                        {
                            // Try to parse a string date
                            if (is_string($sendDate) && $sendDate !== 'now') {
                                $newSendDate = \DateTime::createFromFormat('Y-m-d H:i', $sendDate);

                    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 jsonSerialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function jsonSerialize()
                        {
                            $json = [];
                        
                            // Mandatory parameters
                    Severity: Minor
                    Found in src/main/php/Gomoob/Pushwoosh/Model/Notification/Notification.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