evseevnn/php-cassandra-binary

View on GitHub

Showing 52 of 52 total issues

Function readBigInt has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

     function readBigInt($isCollectionElement = false) {
        if ($isCollectionElement) {
            $length = $this->readShort();
        } else {
            $length = 8;
Severity: Minor
Found in src/Protocol/Response/DataStream.php - About 2 hrs 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 getErrorData has 67 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function getErrorData() {
        $stream = $this->dataStream;
        $error = $stream->readInt();

        $errorMessages = [
Severity: Major
Found in src/Protocol/Response.php - About 2 hrs to fix

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

    class DataStream {
    
        /**
         * @var string
         */
    Severity: Minor
    Found in src/Protocol/Response/DataStream.php - About 2 hrs to fix

      Method readBigInt has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

           function readBigInt($isCollectionElement = false) {
              if ($isCollectionElement) {
                  $length = $this->readShort();
              } else {
                  $length = 8;
      Severity: Minor
      Found in src/Protocol/Response/DataStream.php - About 1 hr to fix

        Method readByType has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function readByType(array $type, $isCollectionElement = false) {
        
                if ( $this->data === null ) {
                    return null;
                }
        Severity: Minor
        Found in src/Protocol/Response/DataStream.php - About 1 hr to fix

          Method __toString has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function __toString() {
                  switch($this->type) {
                      case DataTypeEnum::CUSTOM:
                      case DataTypeEnum::BLOB:
                          return $this->getBlob();
          Severity: Minor
          Found in src/Protocol/BinaryData.php - About 1 hr to fix

            Function query has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                public function query($cql, array $values = [], $consistency = ConsistencyEnum::CONSISTENCY_QUORUM) {
                    if ($this->batchQuery && in_array(substr($cql, 0, 6), ['INSERT', 'UPDATE', 'DELETE'])) {
                        $this->appendQueryToStack($cql, $values);
                        return true;
                    }
            Severity: Minor
            Found in src/Database.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

            Method getMetadata has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function getMetadata() {
                    $flags = $this->dataStream->readInt();
                    $columnCount = $this->dataStream->readInt();
                    $globalTableSpec = $flags & 0x0001;
                    if ($globalTableSpec) {
            Severity: Minor
            Found in src/Protocol/Response.php - About 1 hr to fix

              Method query has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function query($cql, array $values = [], $consistency = ConsistencyEnum::CONSISTENCY_QUORUM) {
                      if ($this->batchQuery && in_array(substr($cql, 0, 6), ['INSERT', 'UPDATE', 'DELETE'])) {
                          $this->appendQueryToStack($cql, $values);
                          return true;
                      }
              Severity: Minor
              Found in src/Database.php - About 1 hr to fix

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

                    public function __construct($version, $opcode, $body, $stream = 0, $flags = 0) {
                Severity: Minor
                Found in src/Protocol/Frame.php - About 35 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                  return $this->readBoolean();
                  Severity: Major
                  Found in src/Protocol/Response/DataStream.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                        return "Is_bootstrapping: {$stream->readString()}";
                    Severity: Major
                    Found in src/Protocol/Response.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                      return $this->readList($type['value']);
                      Severity: Major
                      Found in src/Protocol/Response/DataStream.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                        return $this->getList();
                        Severity: Major
                        Found in src/Protocol/BinaryData.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                          return $this->getDouble();
                          Severity: Major
                          Found in src/Protocol/BinaryData.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                            return $this->getText();
                            Severity: Major
                            Found in src/Protocol/BinaryData.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                              return $this->readFloat($isCollectionElement);
                              Severity: Major
                              Found in src/Protocol/Response/DataStream.php - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                                return $this->getDecimal();
                                Severity: Major
                                Found in src/Protocol/BinaryData.php - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                          return '';
                                  Severity: Major
                                  Found in src/Protocol/BinaryData.php - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                                    return $this->getInet();
                                    Severity: Major
                                    Found in src/Protocol/BinaryData.php - About 30 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language