alexander-emelyanov/opteck-api-client

View on GitHub
src/ApiClient.php

Summary

Maintainability
A
3 hrs
Test Coverage

File ApiClient.php has 303 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Opteck;

use GuzzleHttp;
Severity: Minor
Found in src/ApiClient.php - About 3 hrs to fix

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

        public function openPosition($email, $password, $symbol, $direction, $amount)
    Severity: Minor
    Found in src/ApiClient.php - About 35 mins to fix

      The class ApiClient has a coupling between objects value of 33. Consider to reduce the number of dependencies under 13.
      Open

      class ApiClient implements LoggerAwareInterface
      {
          /**
           * @var \GuzzleHttp\ClientInterface A Guzzle HTTP client.
           */
      Severity: Minor
      Found in src/ApiClient.php by phpmd

      CouplingBetweenObjects

      Since: 1.1.0

      A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

      Example

      class Foo {
          /**
           * @var \foo\bar\X
           */
          private $x = null;
      
          /**
           * @var \foo\bar\Y
           */
          private $y = null;
      
          /**
           * @var \foo\bar\Z
           */
          private $z = null;
      
          public function setFoo(\Foo $foo) {}
          public function setBar(\Bar $bar) {}
          public function setBaz(\Baz $baz) {}
      
          /**
           * @return \SplObjectStorage
           * @throws \OutOfRangeException
           * @throws \InvalidArgumentException
           * @throws \ErrorException
           */
          public function process(\Iterator $it) {}
      
          // ...
      }

      Source https://phpmd.org/rules/design.html#couplingbetweenobjects

      Missing class import via use statement (line '487', column '23').
      Open

                  throw new \Exception($e->getResponse()->getReasonPhrase(), $e->getResponse()->getStatusCode());
      Severity: Minor
      Found in src/ApiClient.php by phpmd

      MissingImport

      Since: 2.7.0

      Importing all external classes in a file through use statements makes them clearly visible.

      Example

      function make() {
          return new \stdClass();
      }

      Source http://phpmd.org/rules/cleancode.html#MissingImport

      Avoid using static access to class '\GuzzleHttp\HandlerStack' in method 'getHttpClient'.
      Open

              $stack = GuzzleHttp\HandlerStack::create();
      Severity: Minor
      Found in src/ApiClient.php by phpmd

      StaticAccess

      Since: 1.4.0

      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

      Example

      class Foo
      {
          public function bar()
          {
              Bar::baz();
          }
      }

      Source https://phpmd.org/rules/cleancode.html#staticaccess

      Avoid using static access to class '\GuzzleHttp\Middleware' in method 'getHttpClient'.
      Open

                  $stack->push(GuzzleHttp\Middleware::log(
                      $this->logger,
                      new GuzzleHttp\MessageFormatter(GuzzleHttp\MessageFormatter::DEBUG)
                  ));
      Severity: Minor
      Found in src/ApiClient.php by phpmd

      StaticAccess

      Since: 1.4.0

      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

      Example

      class Foo
      {
          public function bar()
          {
              Bar::baz();
          }
      }

      Source https://phpmd.org/rules/cleancode.html#staticaccess

      There are no issues that match your filters.

      Category
      Status