tableau-mkt/elomentary

View on GitHub

Showing 9 of 22 total issues

Function onRequestError has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  public function onRequestError(Event $event) {
    /** @var $request \Guzzle\Http\Message\Request */
    $request = $event['request'];
    $response = $request->getResponse();

Severity: Minor
Found in src/HttpClient/Listener/ErrorListener.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

Consider simplifying this complex logical expression.
Open

    if (isset($limit) && isset($offset) && $limit > 0 && $offset >= 0){
      return $this->get("$uri/data?limit=$limit&offset=$offset");
    } elseif (isset($limit) && !isset($offset) && $limit > 0) {
      return $this->get("$uri/data?limit=$limit");
    } elseif (!isset($limit) && isset($offset) && $offset >= 0) {
Severity: Critical
Found in src/Api/AbstractBulkApi.php - About 1 hr to fix

    Method api has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      public function api($name) {
        switch ($name) {
          case 'campaign':
          case 'campaigns':
            $api = new Api\Assets\Campaign($this);
    Severity: Minor
    Found in src/Client.php - About 1 hr to fix

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

        public function api($name) {
          switch ($name) {
            case 'campaign':
            case 'campaigns':
              $api = new Api\Assets\Campaign($this);
      Severity: Minor
      Found in src/Client.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 createRequest has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        protected function createRequest($httpMethod, $path, $body = null, array $headers = array(), array $options = array()) {
      Severity: Minor
      Found in src/HttpClient/HttpClient.php - About 35 mins to fix

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

          public function request($path, $body = null, $httpMethod = 'GET', array $headers = array(), array $options = array()) {
        Severity: Minor
        Found in src/HttpClient/HttpClient.php - About 35 mins to fix

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

            public function authenticate($site, $login, $password, $baseUrl = null, $version = null) {
          Severity: Minor
          Found in src/Client.php - About 35 mins to fix

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

              public function create($optionsList) {
                if (!isset($optionsList['name'])) {
                  throw new InvalidArgumentException('New OptionLists are required to have a name parameter');
                }
            
            
            Severity: Minor
            Found in src/Api/Assets/OptionList.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

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

              public function download($statusResponse = null, $limit = null, $offset = null) {
                $statusResponse = $this->getResponse('status', $statusResponse);
                $uri = trim($statusResponse['syncedInstanceUri'], '/');
            
                if (isset($limit) && isset($offset) && $limit > 0 && $offset >= 0){
            Severity: Minor
            Found in src/Api/AbstractBulkApi.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