bluefyn-international/ShipEngine

View on GitHub

Showing 8 of 10 total issues

Method sendRequest has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private static function sendRequest(
        string $method,
        string $path,
        ?array $body,
        ShipEngineConfig $config
Severity: Major
Found in src/ShipEngineClient.php - About 2 hrs to fix

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

        public function __construct(array $config = [])
        {
            $assert = new Assert();
            $api_key = $config['apiKey'] ?? config('shipengine.credentials.key');
            $assert->isApiKeyValid($api_key);
    Severity: Minor
    Found in src/ShipEngineConfig.php - About 1 hr to fix

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

              string $message,
              public string|null $requestId = null,
              public string|null $source = null,
              public string|null $type = null,
              public string|null $errorCode = null,
      Severity: Minor
      Found in src/Message/ShipEngineException.php - About 45 mins to fix

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

                string $directory,
                string $subDirectory,
                string $fileName,
                array $params = [],
                array|ShipEngineConfig|null $config = null,
        Severity: Minor
        Found in src/Traits/Downloads.php - About 35 mins to fix

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

                  string $warehouse_id,
                  string $name,
                  array $origin_address,
                  array $return_address = [],
                  array|ShipEngineConfig|null $config = null,
          Severity: Minor
          Found in src/Traits/Warehouse.php - About 35 mins to fix

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

                    string $path,
                    array|null $params,
                    array|ShipEngineConfig $config,
                    string $responseKey,
                    string $responseType,
            Severity: Minor
            Found in src/Traits/BaseCalls.php - About 35 mins to fix

              Function sendRequest has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  private static function sendRequest(
                      string $method,
                      string $path,
                      ?array $body,
                      ShipEngineConfig $config
              Severity: Minor
              Found in src/ShipEngineClient.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

              Function sendRequestWithRetries has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  private static function sendRequestWithRetries(
                      string $method,
                      string $path,
                      ?array $body,
                      ShipEngineConfig $config
              Severity: Minor
              Found in src/ShipEngineClient.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