vindi/vindi-woocommerce

View on GitHub
src/services/Api.php

Summary

Maintainability
B
4 hrs
Test Coverage

Method test_api_key has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public function test_api_key($api_key)
  {
    delete_transient('vindi_merchant');

    $url         = $this->base_path() . 'merchant';
Severity: Minor
Found in src/services/Api.php - About 1 hr to fix

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

      public function request($endpoint, $method = 'POST', $data = array(), $data_to_log = null)
      {
        $url  = sprintf('%s%s', $this->base_path(), $endpoint);
        $body = $this->build_body($data);
    
    
    Severity: Minor
    Found in src/services/Api.php - About 1 hr to fix

      Function test_api_key has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        public function test_api_key($api_key)
        {
          delete_transient('vindi_merchant');
      
          $url         = $this->base_path() . 'merchant';
      Severity: Minor
      Found in src/services/Api.php - About 55 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 check_response has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          private function check_response($response)
          {
              if (isset($response['errors']) && !empty($response['errors'])) {
                  foreach ($response['errors'] as $error) {
                      $message = $this->get_error_message($error);
      Severity: Minor
      Found in src/services/Api.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

      Avoid unused private fields such as '$recentRequest'.
      Open

        private $recentRequest;
      Severity: Minor
      Found in src/services/Api.php by phpmd

      UnusedPrivateField

      Since: 0.2

      Detects when a private field is declared and/or assigned a value, but not used.

      Example

      class Something
      {
          private static $FOO = 2; // Unused
          private $i = 5; // Unused
          private $j = 6;
          public function addOne()
          {
              return $this->j++;
          }
      }

      Source https://phpmd.org/rules/unusedcode.html#unusedprivatefield

      The property $current_plan is not named in camelCase.
      Open

      class VindiApi
      {
        /**
         * @var string
         */
      Severity: Minor
      Found in src/services/Api.php by phpmd

      CamelCasePropertyName

      Since: 0.2

      It is considered best practice to use the camelCase notation to name attributes.

      Example

      class ClassName {
          protected $property_name;
      }

      Source

      The property $last_error is not named in camelCase.
      Open

      class VindiApi
      {
        /**
         * @var string
         */
      Severity: Minor
      Found in src/services/Api.php by phpmd

      CamelCasePropertyName

      Since: 0.2

      It is considered best practice to use the camelCase notation to name attributes.

      Example

      class ClassName {
          protected $property_name;
      }

      Source

      The property $accept_bank_slip is not named in camelCase.
      Open

      class VindiApi
      {
        /**
         * @var string
         */
      Severity: Minor
      Found in src/services/Api.php by phpmd

      CamelCasePropertyName

      Since: 0.2

      It is considered best practice to use the camelCase notation to name attributes.

      Example

      class ClassName {
          protected $property_name;
      }

      Source

      The property $errors_list is not named in camelCase.
      Open

      class VindiApi
      {
        /**
         * @var string
         */
      Severity: Minor
      Found in src/services/Api.php by phpmd

      CamelCasePropertyName

      Since: 0.2

      It is considered best practice to use the camelCase notation to name attributes.

      Example

      class ClassName {
          protected $property_name;
      }

      Source

      Inline control structures are not allowed
      Open

          if (false === array_key_exists($error_identifier, $this->errors_list))
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line exceeds 120 characters; contains 128 characters
      Open

          $this->logger->log(sprintf("[Request #%s]: Novo Request para a API.\n%s %s\n%s", $request_id, $method, $url, $data_to_log));
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line exceeds 120 characters; contains 136 characters
      Open

          $this->logger->log(sprintf("[Request #%s]: Nova Resposta da API.\n%s\n%s", $request_id, $status, print_r($response['body'], true)));
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line exceeds 120 characters; contains 136 characters
      Open

          $this->logger->log(sprintf("[Request #%s]: Nova Resposta da API.\n%s\n%s", $request_id, $status, print_r($response['body'], true)));
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line exceeds 120 characters; contains 130 characters
      Open

            $this->logger->log(sprintf('[Request #%s]: Erro ao recuperar corpo do request! %s', $request_id, print_r($response, true)));
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line exceeds 120 characters; contains 128 characters
      Open

          $this->logger->log(sprintf("[Request #%s]: Novo Request para a API.\n%s %s\n%s", $request_id, $method, $url, $data_to_log));
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line exceeds 120 characters; contains 130 characters
      Open

            $this->logger->log(sprintf('[Request #%s]: Erro ao recuperar corpo do request! %s', $request_id, print_r($response, true)));
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 4
      Open

          $this->sandbox      = $sandbox;
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 4 spaces, found 2
      Open

        {
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 4 spaces, found 2
      Open

        }
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 8 spaces, found 4
      Open

          }
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 4 spaces, found 2
      Open

        {
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 8 spaces, found 4
      Open

          if ('yes' === $this->sandbox) {
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 4 spaces, found 2
      Open

        public function __construct($key, VindiLogger $logger, $sandbox)
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 4 spaces, found 2
      Open

        private $key;
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 4 spaces, found 2
      Open

        private $recentRequest;
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 4 spaces, found 2
      Open

        public $current_plan;
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 4 spaces, found 2
      Open

        private function build_body($data)
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 4 spaces, found 2
      Open

        {
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 4 spaces, found 2
      Open

        public $last_error = '';
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 4 spaces, found 2
      Open

        );
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 4 spaces, found 2
      Open

        {
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 8 spaces, found 4
      Open

          if (!empty($data)) {
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 4 spaces, found 2
      Open

        public function test_api_key($api_key)
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 4
      Open

          delete_transient('vindi_merchant');
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 4
      Open

          $status = $response['response']['code'] . ' ' . $response['response']['message'];
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 4 spaces, found 2
      Open

        {
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 8 spaces, found 4
      Open

          if (!$response_body) {
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 4 spaces, found 2
      Open

        {
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 4 spaces, found 2
      Open

        }
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 4 spaces, found 2
      Open

        }
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 4 spaces, found 2
      Open

        private function get_auth_header()
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 4 spaces, found 2
      Open

        private function get_error_message($error)
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 4
      Open

          $data_to_log = 'API Authorization Test';
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 12 spaces, found 6
      Open

            foreach ($response_body_array['errors'] as $error) {
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 20 spaces, found 10
      Open

                delete_transient('vindi_payment_methods');
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 8 spaces, found 4
      Open

          }
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 4
      Open

          $this->logger->log(sprintf("[Request #%s]: Nova Resposta da API.\n%s\n%s", $request_id, $status, print_r($response['body'], true)));
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 4
      Open

          return $body;
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 4 spaces, found 2
      Open

        {
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 4
      Open

          $this->logger->log(sprintf("[Request #%s]: Novo Request para a API.\n%s %s\n%s", $request_id, $method, $url, $data_to_log));
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 4
      Open

          $response_body_array = json_decode($response_body, true);
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 4
      Open

          $this->logger->log(sprintf("[Request #%s]: Novo Request para a API.\n%s %s\n%s", $request_id, $method, $url, $data_to_log));
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 6
      Open

            'timeout'   => 60,
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 4
      Open

          $status = sprintf('%s %s', $response['response']['code'], $response['response']['message']);
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 8 spaces, found 4
      Open

          }
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 4 spaces, found 2
      Open

        }
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 4 spaces, found 2
      Open

        public function request($endpoint, $method = 'POST', $data = array(), $data_to_log = null)
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 4
      Open

          return 'https://app.vindi.com.br/api/v1/';
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 4
      Open

          $this->key          = $key;
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 8 spaces, found 4
      Open

          }
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 20 spaces, found 10
      Open

                $this->last_error = $message;
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 4
      Open

          set_transient('vindi_merchant', $response_body_array['merchant'], 1 * HOUR_IN_SECONDS);
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 4
      Open

          $body = $this->build_body($data);
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 8 spaces, found 4
      Open

          if (!$this->check_response($response_body_array)) {
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 4 spaces, found 2
      Open

        public $accept_bank_slip;
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 4
      Open

          $this->logger       = $logger;
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 6
      Open

            return $error_identifier;
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 12 spaces, found 6
      Open

            return false;
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 8 spaces, found 4
      Open

          if (isset($response_body_array['errors']) && !empty($response_body_array['errors'])) {
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 20 spaces, found 10
      Open

                $message = $this->get_error_message($error);
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 8 spaces, found 4
      Open

          if (is_wp_error($response)) {
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 4 spaces, found 2
      Open

        }
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 4 spaces, found 2
      Open

        }
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 4
      Open

          $url         = $this->base_path() . 'merchant';
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 16 spaces, found 8
      Open

              if ('unauthorized' == $error['id'] and 'authorization' == $error['parameter']) {
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 8 spaces, found 4
      Open

          }
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 4
      Open

          $url  = sprintf('%s%s', $this->base_path(), $endpoint);
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 6
      Open

            'headers' => array(
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 4 spaces, found 2
      Open

        private $sandbox;
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 4 spaces, found 2
      Open

        private $errors_list = array(
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 4
      Open

          $body = null;
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 6
      Open

            'headers' => [
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 6
      Open

            ],
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 8 spaces, found 4
      Open

          if (!$response_body) {
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 6
      Open

            'body'      => $body,
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 12 spaces, found 6
      Open

            $this->logger->log(sprintf("[Request #%s]: Erro ao fazer request! %s", $request_id, print_r($response, true)));
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 12 spaces, found 6
      Open

            return 'https://sandbox-app.vindi.com.br/api/v1/';
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 4
      Open

          $body = null;
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 8 spaces, found 4
      Open

          if (!empty($data)) {
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 4
      Open

          $error_identifier = sprintf('%s|%s', $error_id, $error_parameter);
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 4
      Open

          $response = wp_remote_post($url, [
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 12 spaces, found 6
      Open

            }
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 4 spaces, found 2
      Open

        private $logger;
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 12 spaces, found 6
      Open

            $body = json_encode($data);
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 4 spaces, found 2
      Open

        {
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 16 spaces, found 8
      Open

              }
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 4
      Open

          return true;
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 4
      Open

          $response_body = wp_remote_retrieve_body($response);
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 12 spaces, found 6
      Open

            return false;
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 8 spaces, found 4
      Open

          }
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 4
      Open

          return $body;
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 12 spaces, found 6
      Open

            $body = json_encode($data);
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 4
      Open

          return sprintf('Basic %s', base64_encode($this->key . ":"));
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 6
      Open

            'method'    => $method,
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 6
      Open

            'timeout'   => 60,
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 8 spaces, found 4
      Open

          if (is_wp_error($response)) {
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 4
      Open

          $response_body = wp_remote_retrieve_body($response);
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 12 spaces, found 6
      Open

            $this->logger->log(sprintf('[Request #%s]: Erro ao recuperar corpo do request! %s', $request_id, print_r($response, true)));
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 6
      Open

            ),
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 4 spaces, found 2
      Open

        public function base_path()
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 20 spaces, found 10
      Open

                delete_transient('vindi_plans');
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 20 spaces, found 10
      Open

                return $error['id'];
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 4 spaces, found 2
      Open

        private function convert_body_to_json($data)
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 4
      Open

          $error_id         = empty($error['id']) ? '' : $error['id'];
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 4
      Open

          $method      = 'GET';
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 12 spaces, found 6
      Open

            $this->logger->log(sprintf("[Request #%s]: Erro ao fazer request! %s", $request_id, print_r($response, true)));
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 4 spaces, found 2
      Open

        }
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 4
      Open

          ));
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 4
      Open

          $response_body_array = json_decode($response_body, true);
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 4
      Open

          return $response_body_array;
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 4
      Open

          if (false === array_key_exists($error_identifier, $this->errors_list))
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 12 spaces, found 6
      Open

            return false;
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 8 spaces, found 4
      Open

          }
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 4
      Open

          $response = wp_remote_post($url, array(
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 12 spaces, found 6
      Open

            return false;
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 4
      Open

          $error_parameter  = empty($error['parameter']) ? '' : $error['parameter'];
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 4
      Open

          return __($this->errors_list[$error_identifier], VINDI);
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 4
      Open

          $data_to_log = null !== $data_to_log ? $this->build_body($data_to_log) : $body;
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 12 spaces, found 6
      Open

            $this->logger->log(sprintf('[Request #%s]: Erro ao recuperar corpo do request! %s', $request_id, print_r($response, true)));
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 8 spaces, found 4
      Open

          }
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 12 spaces, found 6
      Open

            return false;
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 4 spaces, found 2
      Open

        }
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 4
      Open

          $request_id  = rand();
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 6
      Open

            'sslverify' => true,
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 4
      Open

          ]);
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 4
      Open

          $this->logger->log(sprintf("[Request #%s]: Nova Resposta da API.\n%s\n%s", $request_id, $status, print_r($response['body'], true)));
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected 8 spaces, found 4
      Open

          }
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 4
      Open

          $request_id = rand();
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 6
      Open

            'method'    => $method,
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      Line indented incorrectly; expected at least 8 spaces, found 6
      Open

            'sslverify' => true,
      Severity: Minor
      Found in src/services/Api.php by phpcodesniffer

      There are no issues that match your filters.

      Category
      Status