tomaj/nette-errbit

View on GitHub

Showing 10 of 10 total issues

Method asXml has 83 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function asXml() {
        $exception = $this->_exception;
        $options   = $this->_options;
        $builder   = new Errbit_XmlBuilder();
        $self      = $this;
Severity: Major
Found in src/errbit-php/Errbit/Notice.php - About 3 hrs to fix

    Method _checkConfig has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function _checkConfig() {
            if (empty($this->_config['api_key'])) {
                throw new Errbit_Exception("`api_key' must be configured");
            }
    
    
    Severity: Minor
    Found in src/errbit-php/Errbit.php - About 1 hr to fix

      Function _checkConfig has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          private function _checkConfig() {
              if (empty($this->_config['api_key'])) {
                  throw new Errbit_Exception("`api_key' must be configured");
              }
      
      
      Severity: Minor
      Found in src/errbit-php/Errbit.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 tag has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function tag($name /* , $value, $attributes, $callback */) {
              $value      = '';
              $attributes = array();
              $callback   = null;
              $args       = func_get_args();
      Severity: Minor
      Found in src/errbit-php/Errbit/XmlBuilder.php - About 1 hr to fix

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

            public function tag($name /* , $value, $attributes, $callback */) {
                $value      = '';
                $attributes = array();
                $callback   = null;
                $args       = func_get_args();
        Severity: Minor
        Found in src/errbit-php/Errbit/XmlBuilder.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

        Consider simplifying this complex logical expression.
        Open

                        if (!empty($options['url'])
                            || !empty($options['controller'])
                            || !empty($options['action'])
                            || !empty($options['parameters'])
                            || !empty($options['session_data'])
        Severity: Major
        Found in src/errbit-php/Errbit/Notice.php - About 40 mins to fix

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

              private function _filterParams($name) {
                  if (empty($this->_options[$name])) {
                      return;
                  }
          
          
          Severity: Minor
          Found in src/errbit-php/Errbit/Notice.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 log has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function log($message, $priority = null)
              {
                  // If message contains one of ignored messages, shut down
                  foreach (self::$ignoredMessages as $ignoredMessage) {
                      if (strpos($message[1], $ignoredMessage) !== false) {
          Severity: Minor
          Found in src/ErrbitLogger.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 $name;
          Severity: Major
          Found in src/errbit-php/Errbit/Notice.php - About 30 mins to fix

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

                public static function xmlVarsFor($builder, $array) {
                    foreach ($array as $key => $value) {
                        if (is_object($value)) {
                            $value = (array)$value;
                        }
            Severity: Minor
            Found in src/errbit-php/Errbit/Notice.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