gerencianet/gn-api-sdk-php

View on GitHub

Showing 16 of 16 total issues

File migrationChecker.php has 542 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Certifique-se de inserir este arquivo na raiz do seu projeto, para que possa validar todos os arquivos
 * e de inserir corretamente o caminho para os arquivos do autoload do Composer na linha 55.
Severity: Major
Found in migrationChecker.php - About 1 day to fix

    Function map has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

        private function map($method)
        {
            if (!isset($this->endpoints['ENDPOINTS'])) {
                if (array_column($this->endpoints['PIX'], $method)) {
                    $this->endpoints = $this->endpoints['PIX'];
    Severity: Minor
    Found in src/Gerencianet/Endpoints.php - About 3 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

    Function verifyCertificate has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        private function verifyCertificate($certificate)
        {
            if ($this->certified_path) {
                $this->client->setDefaultOption('verify', $this->certified_path);
            }
    Severity: Minor
    Found in src/Gerencianet/Request.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

    Function getMissingPackages has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        private function getMissingPackages(): array
        {
            $missingPackages = [];
    
            foreach (self::REQUIRED_PACKAGES as $package => $version) {
    Severity: Minor
    Found in migrationChecker.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

    Function getCorrections has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        private function getCorrections(): array
        {
            $corrections = [];
    
            foreach ($this->getPhpFiles() as $filePath) {
    Severity: Minor
    Found in migrationChecker.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

    Function send has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        public function send($method, $route, $requestOptions)
        {
            try {
                if (isset($this->config['certificate'])) {
                    $requestOptions['cert'] = $this->verifyCertificate($this->config['certificate']);
    Severity: Minor
    Found in src/Gerencianet/Request.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 map has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function map($method)
        {
            if (!isset($this->endpoints['ENDPOINTS'])) {
                if (array_column($this->endpoints['PIX'], $method)) {
                    $this->endpoints = $this->endpoints['PIX'];
    Severity: Minor
    Found in src/Gerencianet/Endpoints.php - About 1 hr to fix

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

          public function send($method, $route, $requestOptions)
          {
              try {
                  if (isset($this->config['certificate'])) {
                      $requestOptions['cert'] = $this->verifyCertificate($this->config['certificate']);
      Severity: Minor
      Found in src/Gerencianet/Request.php - About 1 hr to fix

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

            private function getCorrections(): array
            {
                $corrections = [];
        
                foreach ($this->getPhpFiles() as $filePath) {
        Severity: Minor
        Found in migrationChecker.php - About 1 hr to fix

          Method verifyCertificate has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function verifyCertificate($certificate)
              {
                  if ($this->certified_path) {
                      $this->client->setDefaultOption('verify', $this->certified_path);
                  }
          Severity: Minor
          Found in src/Gerencianet/Request.php - About 1 hr to fix

            Method options has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function options($options)
                {
                    $conf = [];
                    $conf['sandbox'] = isset($options['sandbox']) ? $options['sandbox'] : false;
                    $conf['debug'] = isset($options['debug']) ? $options['debug'] : false;
            Severity: Minor
            Found in src/Gerencianet/Config.php - About 1 hr to fix

              Method send has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function send($method, $route, $body)
                  {
                      if (!$this->auth->expires || $this->auth->expires <= time()) {
                          $this->auth->authorize();
                      }
              Severity: Minor
              Found in src/Gerencianet/ApiRequest.php - About 1 hr to fix

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

                    public function checkSDKInstallation(): array
                    {
                        $resultSdkInfo = [];
                        foreach ($this->installedPackages['packages'] as $package) {
                            if ($package['name'] === 'efipay/sdk-php-apis-efi' || $package['name'] === 'gerencianet/gerencianet-sdk-php') {
                Severity: Minor
                Found in migrationChecker.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 apiReturns has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function apiReturns($error, $code){
                        if (isset($error['message'])) {
                            $message = $error['message'];
                
                            $this->code = $code;
                Severity: Minor
                Found in src/Gerencianet/Exception/GerencianetException.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 CRC16Checksum has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function CRC16Checksum($str)
                    {
                        $crc = 0xFFFF;
                        $strlen = strlen($str);
                        for ($c = 0; $c < $strlen; $c++) {
                Severity: Minor
                Found in src/Gerencianet/Utils.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 options has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function options($options)
                    {
                        $conf = [];
                        $conf['sandbox'] = isset($options['sandbox']) ? $options['sandbox'] : false;
                        $conf['debug'] = isset($options['debug']) ? $options['debug'] : false;
                Severity: Minor
                Found in src/Gerencianet/Config.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

                Severity
                Category
                Status
                Source
                Language