phug-php/formatter

View on GitHub

Showing 48 of 48 total issues

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

        CodeElement $variable = null,
        ExpressionElement $expression = null,
        ParserNode $originNode = null,
        NodeInterface $parent = null,
        array $children = null
Severity: Minor
Found in Formatter/Element/VariableElement.php - About 35 mins to fix

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

            $name,
            $value,
            ParserNode $originNode = null,
            NodeInterface $parent = null,
            array $children = null
    Severity: Minor
    Found in Formatter/Element/KeywordElement.php - About 35 mins to fix

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

          public function dump()
          {
              $name = preg_replace('/^Phug\\\\.*\\\\([^\\\\]+)Element$/', '$1', get_class($this));
              if (method_exists($this, 'getName')) {
                  $name .= ': '.$this->getName();
      Severity: Minor
      Found in Formatter/AbstractElement.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 __construct has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function __construct($options = null)
          {
              $this->initFormats()->setOptionsDefaults($options ?: [], [
                  'debug'                        => false,
                  'located_exception_class_name' => LocatedException::class,
      Severity: Minor
      Found in Formatter.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 __construct has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function __construct(Formatter $formatter = null)
          {
              $patterns = [
                  'class_attribute'        => static::CLASS_ATTRIBUTE,
                  'string_attribute'       => static::STRING_ATTRIBUTE,
      Severity: Minor
      Found in Formatter/AbstractFormat.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 $this->pattern(
                  'attribute_pattern',
                  $this->format($name),
                  $this->format($value)
              );
      Severity: Major
      Found in Formatter/Format/XmlFormat.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return false;
        Severity: Major
        Found in Formatter.php - About 30 mins to fix

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

              protected function formatDynamicValue($formattedName, $value)
              {
                  if ($value instanceof ExpressionElement &&
                      strtolower($value->getValue()) === 'undefined'
                  ) {
          Severity: Minor
          Found in Formatter/AbstractFormat.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