gdbots/pbj-php

View on GitHub

Showing 68 of 77 total issues

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

    public function __construct($message, $code, string $propertyPath = null, $value = null, array $constraints = [])
Severity: Minor
Found in src/Exception/AssertionFailed.php - About 35 mins to fix

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

        public static function isValid(string $hashtag): bool
        {
            $hashtag = ltrim($hashtag, '#');
            if (empty($hashtag)) {
                return false;
    Severity: Minor
    Found in src/Util/HashtagUtil.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 doMarshal has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        private function doMarshal(Message $message): array
        {
            $schema = $message::schema();
            $message->validate();
            $payload = [];
    Severity: Minor
    Found in src/Marshaler/Elastica/DocumentMarshaler.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 getSupportedMessages has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function getSupportedMessages(Field $field): array
        {
            if (!$field->hasAnyOfCuries()) {
                return MessageResolver::all();
            }
    Severity: Minor
    Found in src/Marshaler/Elastica/MappingBuilder.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 applyNumericOptions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        private function applyNumericOptions(?int $min = null, ?int $max = null, int $precision = 10, int $scale = 2): void
        {
            if (null !== $max) {
                $this->max = $max;
            }
    Severity: Minor
    Found in src/Field.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 doSerialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        private function doSerialize(Message $message): array
        {
            $schema = $message::schema();
            $message->validate();
            $payload = [];
    Severity: Minor
    Found in src/Serializer/PhpArraySerializer.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

    Avoid too many return statements within this method.
    Open

            return true;
    Severity: Major
    Found in src/Field.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return $properties;
      Severity: Major
      Found in src/Marshaler/Elastica/MappingBuilder.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                            return [self::TYPE_BINARY => $value];
        Severity: Major
        Found in src/Marshaler/DynamoDb/ItemMarshaler.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                          return true;
          Severity: Major
          Found in src/Util/HashtagUtil.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return $this->default;
            Severity: Major
            Found in src/Field.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return 'true';
              Severity: Major
              Found in src/Util/StringUtil.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return true;
                Severity: Major
                Found in src/AbstractMessage.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                          return true;
                  Severity: Major
                  Found in src/AbstractMessage.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                    return $this->withAnalyzer(self::TYPES['text'], $field);
                    Severity: Major
                    Found in src/Marshaler/Elastica/MappingBuilder.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                              return (string)$var;
                      Severity: Major
                      Found in src/Util/StringUtil.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                    return $default;
                        Severity: Major
                        Found in src/Field.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                      return false;
                          Severity: Major
                          Found in src/Field.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                                return ['NULL' => true];
                            Severity: Major
                            Found in src/Marshaler/DynamoDb/ItemMarshaler.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                      return false;
                              Severity: Major
                              Found in src/Util/HashtagUtil.php - About 30 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language