penicylline/skype-bot-sdk

View on GitHub

Showing 13 of 13 total issues

Function callCommand has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private function callCommand(Command $command)
    {
        $api = $command->getApi();
        $fullUrl = $api->getRequestUrl();
        if (!($command instanceof AnonymousCommand)) {
Severity: Minor
Found in src/Api/ApiClient.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 validateBearerHeader has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function validateBearerHeader($header)
    {
        $bearerData = $this->extractBearerData($header);
        $tokenParts = explode('.', $bearerData);
        if (count($tokenParts) !== 3) {
Severity: Minor
Found in src/Listener/Security.php - About 1 hr to fix

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

        private function callCommand(Command $command)
        {
            $api = $command->getApi();
            $fullUrl = $api->getRequestUrl();
            if (!($command instanceof AnonymousCommand)) {
    Severity: Minor
    Found in src/Api/ApiClient.php - About 1 hr to fix

      Function validateBearerHeader has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          public function validateBearerHeader($header)
          {
              $bearerData = $this->extractBearerData($header);
              $tokenParts = explode('.', $bearerData);
              if (count($tokenParts) !== 3) {
      Severity: Minor
      Found in src/Listener/Security.php - About 55 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 get has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function get($url, $params = array())
          {
              if (empty($params)) {
                  $params = array();
              }
      Severity: Minor
      Found in src/Api/HttpClient.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 __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public function  __construct($appId, $appSecret, $apiEndpoint = null, $authEndpoint = null, $openIdEndpoint = null)
      Severity: Minor
      Found in src/Config.php - About 35 mins to fix

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

            private function verify($keyInfo, $payload, $signature, $key, $algorithm)
        Severity: Minor
        Found in src/Listener/Security.php - About 35 mins to fix

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

              private function doRequest($type, $url, $params = array())
              {
                  $method = strtoupper($type);
                  $this->log('>>>>>> ' . $method . ' >>>>>>');
                  $this->log($url);
          Severity: Minor
          Found in src/Api/HttpClient.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 new Request();
          Severity: Major
          Found in src/SkypeBot.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return new Security(SkypeBot::getInstance()->getOpenIdKeysProvider());
            Severity: Major
            Found in src/SkypeBot.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return HttpClient::getInstance();
              Severity: Major
              Found in src/SkypeBot.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return new Dispatcher(SkypeBot::getInstance()->getSecurity());
                Severity: Major
                Found in src/SkypeBot.php - About 30 mins to fix

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

                      public function set($key, $value, $xmlSafe = true)
                      {
                          $this->validateInput($key, $value);
                          if ($value instanceof Entity) {
                              $this->rawObj->{$key} = $value->getRaw();
                  Severity: Minor
                  Found in src/Entity/Entity.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