squirrelphp/entities

View on GitHub

Showing 53 of 59 total issues

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

    private function buildSelectQueryFreeform(array $options): array
    {
        // Process options and make sure all values are valid
        [
            $sanitizedOptions,
Severity: Minor
Found in src/MultiRepositoryReadOnly.php - About 1 hr to fix

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

            private string $connectionName,
            private string $tableName,
            /** Conversion from table to object fields */
            private array $tableToObjectFields,
            /** Conversion from object to table fields */
    Severity: Major
    Found in src/RepositoryConfig.php - About 1 hr to fix

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

          private function buildSelectQueryStructured(array $query): array
          {
              // Process options and make sure all values are valid
              [
                  $sanitizedOptions,
      Severity: Minor
      Found in src/MultiRepositoryReadOnly.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

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

              array $selectOptions,
              array $objectToTableFields,
              array $objectTypes,
              array $objectTypesNullable,
              bool $generateSql = false,
      Severity: Minor
      Found in src/MultiRepositoryReadOnly.php - About 35 mins to fix

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

            private function convertResultToObject(array $tableResult): object
            {
                // Only create reflection class once we need it, to be resource efficient
                if (!isset($this->reflectionClass)) {
                    /**
        Severity: Minor
        Found in src/RepositoryReadOnly.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 Coerce::toFloat($value);
        Severity: Major
        Found in src/RepositoryReadOnly.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                              return \strval($value);
          Severity: Major
          Found in src/RepositoryReadOnly.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return new LargeObject(\strval($value));
            Severity: Major
            Found in src/RepositoryReadOnly.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                                  return \boolval($value) === true ? 1 : 0;
              Severity: Major
              Found in src/RepositoryReadOnly.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                    return \intval($value);
                Severity: Major
                Found in src/RepositoryReadOnly.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                      return \floatval($value);
                  Severity: Major
                  Found in src/RepositoryReadOnly.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                        return Coerce::toString($value);
                    Severity: Major
                    Found in src/RepositoryReadOnly.php - About 30 mins to fix

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

                          public function insertOrUpdate(array $fields, array $indexFields = [], ?array $updateFields = null): void
                          {
                              // Fields after conversion to table notation
                              $actualIndexFields = [];
                      
                      
                      Severity: Minor
                      Found in src/RepositoryWriteable.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