stellar-php/stellar

View on GitHub

Showing 17 of 17 total issues

Request has 42 functions (exceeds 20 allowed). Consider refactoring.
Open

class Request implements RequestInterface, OptionableInterface, StringableInterface
{
    use StringableTrait;

    /** @var string */
Severity: Minor
Found in src/Curl/Request/Request.php - About 5 hrs to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    <?php declare(strict_types=1);
    
    namespace Stellar\Encoding\Base32;
    
    // https://tools.ietf.org/html/rfc2938
    Severity: Major
    Found in src/Encoding/Base32/Base32Hex.php and 1 other location - About 5 hrs to fix
    src/Encoding/Base32/Rfc4648.php on lines 1..42

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 185.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    <?php declare(strict_types=1);
    
    namespace Stellar\Encoding\Base32;
    
    // https://tools.ietf.org/html/rfc4648
    Severity: Major
    Found in src/Encoding/Base32/Rfc4648.php and 1 other location - About 5 hrs to fix
    src/Encoding/Base32/Base32Hex.php on lines 1..42

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 185.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    MultiRequest has 21 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class MultiRequest implements RequestInterface
    {
        /** @var resource */
        protected $_resource;
    
    
    Severity: Minor
    Found in src/Curl/Request/MultiRequest.php - About 2 hrs to fix

      Method withMethod has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function withMethod(string $method) : self
          {
              $this->_method = $method;
      
              unset(
      Severity: Minor
      Found in src/Curl/Request/Request.php - About 1 hr to fix

        Method details has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function details($var) : string
            {
                $result = self::get($var);
                $format = '%s';
                $args = [ $result ];
        Severity: Minor
        Found in src/Common/Type.php - About 1 hr to fix

          Function details has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function details($var) : string
              {
                  $result = self::get($var);
                  $format = '%s';
                  $args = [ $result ];
          Severity: Minor
          Found in src/Common/Type.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

          Function flattenKeys has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function flattenKeys(array $array, string $glue = '.', ?int $depth = null, string $prefix = '')
              {
                  if ('' !== $prefix && !StringUtil::endsWith($prefix, $glue)) {
                      $prefix .= $glue;
                  }
          Severity: Minor
          Found in src/Common/ArrayUtil.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

          Function withMethod has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function withMethod(string $method) : self
              {
                  $this->_method = $method;
          
                  unset(
          Severity: Minor
          Found in src/Curl/Request/Request.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 callable has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function callable(callable $callable) : ?string
              {
                  $result = null;
                  switch (true) {
                      case ($callable instanceof \Closure):
          Severity: Minor
          Found in src/Common/Identify.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 request has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function request(string $id, callable $callback, array $params = [])
              {
                  if (!$this->has($id)) {
                      $createdService = $callback(...$params);
          
          
          Severity: Minor
          Found in src/Container/Container.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 joinFormat has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function joinFormat(string $format, iterable $iterator, bool $exclEmpty = true) : array
              {
                  $formatHasKey = (false !== \strpos($format, '%k'));
                  $formatHasIndex = (false !== \strpos($format, '%i'));
                  $formatHasValue = (false !== \strpos($format, '%v'));
          Severity: Minor
          Found in src/Common/ArrayUtil.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 unset has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function unset(...$idOrService) : array
              {
                  $result = [];
                  foreach ($idOrService as $param) {
                      $id = false;
          Severity: Minor
          Found in src/Container/BasicContainer.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 _filterOptions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function _filterOptions(array $options) : array
              {
                  $constants = Curl::infoConstants();
          
                  $result = [];
          Severity: Minor
          Found in src/Curl/Info.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 execute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function execute() : self
              {
                  $this->init();
                  $this->_queueTotal = \count($this->_queue);
                  $this->_queueLeft = $this->_queueTotal;
          Severity: Minor
          Found in src/Curl/Request/MultiRequest.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 flatten has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function flatten(array $array, ?int $depth = null)
              {
                  if (0 === $depth) {
                      return \array_values($array);
                  }
          Severity: Minor
          Found in src/Common/ArrayUtil.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 __construct has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function __construct(string $ownerClass, array $customValues = [])
              {
                  parent::__construct($ownerClass);
          
                  $this->_hasCustomValues = !empty($customValues);
          Severity: Minor
          Found in src/Enum/EnumerablesList.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