ringcentral/glip-botman

View on GitHub

Showing 5 of 5 total issues

Function buildServicePayload has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function buildServicePayload($message, $matchingMessage, $additionalParameters = [])
    {
        $recipient = $matchingMessage->getRecipient() === '' ? $matchingMessage->getSender() : $matchingMessage->getRecipient();
        $parameters = array_merge_recursive([
            'groupId' => $recipient,
Severity: Minor
Found in GlipBotman.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 buildServicePayload has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function buildServicePayload($message, $matchingMessage, $additionalParameters = [])
    {
        $recipient = $matchingMessage->getRecipient() === '' ? $matchingMessage->getSender() : $matchingMessage->getRecipient();
        $parameters = array_merge_recursive([
            'groupId' => $recipient,
Severity: Minor
Found in GlipBotman.php - About 1 hr to fix

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

        public function reply($message, $matchingMessage, $additionalParameters = [])
        {
    
            print 'Inside Reply method' . PHP_EOL;
            $endpoint = 'sendMessage';
    Severity: Minor
    Found in GlipBotman.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 reply has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function reply($message, $matchingMessage, $additionalParameters = [])
        {
    
            print 'Inside Reply method' . PHP_EOL;
            $endpoint = 'sendMessage';
    Severity: Minor
    Found in GlipBotman.php - About 1 hr to fix

      Method getPlatform has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getPlatform()
          {
      
              $rcsdk = new SDK($this->config->get('GLIP_APPKEY'), $this->config->get('GLIP_APPSECRET'), $this->config->get('GLIP_SERVER'), 'Sample-Bot', '1.0.0');
              $platform = $rcsdk->platform();
      Severity: Minor
      Found in GlipBotman.php - About 1 hr to fix
        Severity
        Category
        Status
        Source
        Language