KonstantinCodes/messenger-kafka

View on GitHub

Showing 7 of 9 total issues

Method send has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function send(Envelope $envelope): Envelope
    {
        $producer = $this->getProducer();
        $topic = $producer->newTopic($this->properties->getTopicName());
        $payload = $this->serializer->encode($envelope);
Severity: Minor
Found in src/Messenger/KafkaSender.php - About 1 hr to fix

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

        public function send(Envelope $envelope): Envelope
        {
            $producer = $this->getProducer();
            $topic = $producer->newTopic($this->properties->getTopicName());
            $payload = $this->serializer->encode($envelope);
    Severity: Minor
    Found in src/Messenger/KafkaSender.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 get has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function get(): iterable
        {
            $message = $this->getSubscribedConsumer()->consume($this->properties->getReceiveTimeoutMs());
    
            switch ($message->err) {
    Severity: Minor
    Found in src/Messenger/KafkaReceiver.php - About 1 hr to fix

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

              UriInterface $baseUri,
              string $topicName,
              SerializerInterface $serializer,
              ClientInterface $client,
              RequestFactoryInterface $requestFactory,
      Severity: Major
      Found in src/Messenger/RestProxyTransport.php - About 1 hr to fix

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

                UriInterface $baseUri,
                string $topicName,
                SerializerInterface $serializer,
                ClientInterface $client,
                RequestFactoryInterface $requestFactory,
        Severity: Major
        Found in src/Messenger/RestProxySender.php - About 50 mins to fix

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

                  LoggerInterface $logger,
                  SerializerInterface $serializer,
                  RdKafkaFactory $rdKafkaFactory,
                  KafkaSenderProperties $kafkaSenderProperties,
                  KafkaReceiverProperties $kafkaReceiverProperties
          Severity: Minor
          Found in src/Messenger/KafkaTransport.php - About 35 mins to fix

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

                    ?LoggerInterface $logger,
                    ?ClientInterface $client,
                    ?RequestFactoryInterface $requestFactory,
                    ?UriFactoryInterface $uriFactory,
                    ?StreamFactoryInterface $streamFactory
            Severity: Minor
            Found in src/Messenger/RestProxyTransportFactory.php - About 35 mins to fix
              Severity
              Category
              Status
              Source
              Language