gomoob/php-pushwoosh

View on GitHub

Showing 27 of 27 total issues

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