Kentico/delivery-sdk-php

View on GitHub
src/KenticoCloud/Delivery/DeliveryClient.php

Summary

Maintainability
A
45 mins
Test Coverage
A
93%

The class DeliveryClient has 17 fields. Consider redesigning DeliveryClient to keep the number of fields under 15.
Open

class DeliveryClient
{
    private $sdkVersion = '2.0.0';

    private $urlBuilder = null;

Since: PHPMD 0.1

Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.

Example:

class Person {
     protected $one;
     private $two;
     private $three;
     [... many more fields ...]
  }

Source: http://phpmd.org/rules/codesize.txt

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

    public function __construct(string $projectId, string $previewApiKey = null, string $securedProductionApiKey = null, bool $waitForLoadingNewContent = null, bool $debugRequests = null, int $retryAttempts = null)
Severity: Minor
Found in src/KenticoCloud/Delivery/DeliveryClient.php - About 45 mins to fix

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

    class DeliveryClient
    {
        private $sdkVersion = '2.0.0';
    
        private $urlBuilder = null;

    Since: PHPMD 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: http://phpmd.org/rules/design.txt

    Avoid using static access to class '\Httpful\Request' in method 'initRequestTemplate'.
    Invalid

            Request::ini($template);

    Since: PHPMD 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: http://phpmd.org/rules/cleancode.txt

    Avoid using static access to class '\Httpful\Request' in method 'sendRequest'.
    Invalid

            $request = Request::get($uri);

    Since: PHPMD 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: http://phpmd.org/rules/cleancode.txt

    There are no issues that match your filters.

    Category
    Status