Aerendir/console-styles-bundle

View on GitHub
src/Console/Style/SerendipityHQStyleSF5.php

Summary

Maintainability
F
6 days
Test Coverage

SerendipityHQStyleSF5 has 50 functions (exceeds 20 allowed). Consider refactoring.
Open

class SerendipityHQStyleSF5 extends OutputStyle
{
    /** @var int */
    private const MAX_LINE_LENGTH = 120;

Severity: Minor
Found in src/Console/Style/SerendipityHQStyleSF5.php - About 7 hrs to fix

    File SerendipityHQStyleSF5.php has 401 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /*
     * This file is part of the Serendipity HQ Console Styles Component.
     *
    Severity: Minor
    Found in src/Console/Style/SerendipityHQStyleSF5.php - About 5 hrs to fix

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

          protected function createBlock($messages, $type = null, $style = null, string $prefix = ' ', bool $padding = false, bool $escape = false): array
          {
              $indentLength = 0;
              $prefixLength = Helper::strlenWithoutDecoration($this->getFormatter(), $prefix);
              $lines        = [];
      Severity: Minor
      Found in src/Console/Style/SerendipityHQStyleSF5.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 createBlock has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function createBlock($messages, $type = null, $style = null, string $prefix = ' ', bool $padding = false, bool $escape = false): array
          {
              $indentLength = 0;
              $prefixLength = Helper::strlenWithoutDecoration($this->getFormatter(), $prefix);
              $lines        = [];
      Severity: Minor
      Found in src/Console/Style/SerendipityHQStyleSF5.php - About 1 hr to fix

        Method createBlock has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            protected function createBlock($messages, $type = null, $style = null, string $prefix = ' ', bool $padding = false, bool $escape = false): array
        Severity: Minor
        Found in src/Console/Style/SerendipityHQStyleSF5.php - About 45 mins to fix

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

              protected function createLine(string $message, $type = null, $style = null, string $prefix = '', bool $escape = false): string
          Severity: Minor
          Found in src/Console/Style/SerendipityHQStyleSF5.php - About 35 mins to fix

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

                public function block($messages, ?string $type = null, ?string $style = null, string $prefix = ' ', bool $padding = false): void
            Severity: Minor
            Found in src/Console/Style/SerendipityHQStyleSF5.php - About 35 mins to fix

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  protected function createBlock($messages, $type = null, $style = null, string $prefix = ' ', bool $padding = false, bool $escape = false): array
                  {
                      $indentLength = 0;
                      $prefixLength = Helper::strlenWithoutDecoration($this->getFormatter(), $prefix);
                      $lines        = [];
              Severity: Major
              Found in src/Console/Style/SerendipityHQStyleSF5.php and 1 other location - About 2 days to fix
              src/Console/Style/SF4/SerendipityHQStyleSF4.php on lines 717..764

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 479.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                  protected function createLine(string $message, $type = null, $style = null, string $prefix = '', bool $escape = false): string
                  {
                      if ($escape) {
                          $message = OutputFormatter::escape($message);
                      }
              Severity: Major
              Found in src/Console/Style/SerendipityHQStyleSF5.php and 1 other location - About 5 hrs to fix
              src/Console/Style/SF4/SerendipityHQStyleSF4.php on lines 773..795

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 183.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                  public function askQuestion(Question $question): string
                  {
                      trigger_error('Use Symfony\Component\Console\Style\SymfonyStyle corresponding method instead.', E_USER_DEPRECATED);
                      if ($this->input->isInteractive()) {
                          $this->autoPrependBlock();
              Severity: Major
              Found in src/Console/Style/SerendipityHQStyleSF5.php and 1 other location - About 1 hr to fix
              src/Console/Style/SF4/SerendipityHQStyleSF4.php on lines 557..576

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 118.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  public function table(array $headers, array $rows): void
                  {
                      trigger_error('Use Symfony\Component\Console\Style\SymfonyStyle corresponding method instead.', E_USER_DEPRECATED);
                      $style = clone Table::getStyleDefinition('symfony-style-guide');
                      $style->setCellHeaderFormat('<fg=green>%s</>');
              Severity: Major
              Found in src/Console/Style/SerendipityHQStyleSF5.php and 1 other location - About 1 hr to fix
              src/Console/Style/SF4/SerendipityHQStyleSF4.php on lines 425..438

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 106.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                  public function choice($question, array $choices, $default = null): string
                  {
                      trigger_error('Use Symfony\Component\Console\Style\SymfonyStyle corresponding method instead.', E_USER_DEPRECATED);
                      if (null !== $default) {
                          $values  = \Safe\array_flip($choices);
              Severity: Minor
              Found in src/Console/Style/SerendipityHQStyleSF5.php and 1 other location - About 45 mins to fix
              src/Console/Style/SF4/SerendipityHQStyleSF4.php on lines 486..495

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 96.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 4 locations. Consider refactoring.
              Open

                  public function section($message): void
                  {
                      trigger_error('Use Symfony\Component\Console\Style\SymfonyStyle corresponding method instead.', E_USER_DEPRECATED);
                      $this->autoPrependBlock();
                      $this->writeln([
              Severity: Major
              Found in src/Console/Style/SerendipityHQStyleSF5.php and 3 other locations - About 45 mins to fix
              src/Console/Style/SF4/SerendipityHQStyleSF4.php on lines 112..121
              src/Console/Style/SF4/SerendipityHQStyleSF4.php on lines 128..137
              src/Console/Style/SerendipityHQStyleSF5.php on lines 104..113

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 95.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 4 locations. Consider refactoring.
              Open

                  public function title($message): void
                  {
                      trigger_error('Use Symfony\Component\Console\Style\SymfonyStyle corresponding method instead.', E_USER_DEPRECATED);
                      $this->autoPrependBlock();
                      $this->writeln([
              Severity: Major
              Found in src/Console/Style/SerendipityHQStyleSF5.php and 3 other locations - About 45 mins to fix
              src/Console/Style/SF4/SerendipityHQStyleSF4.php on lines 112..121
              src/Console/Style/SF4/SerendipityHQStyleSF4.php on lines 128..137
              src/Console/Style/SerendipityHQStyleSF5.php on lines 120..129

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 95.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                  public function block($messages, ?string $type = null, ?string $style = null, string $prefix = ' ', bool $padding = false): void
                  {
                      trigger_error('Use Symfony\Component\Console\Style\SymfonyStyle corresponding method instead.', E_USER_DEPRECATED);
                      $messages = \is_array($messages) ? \array_values($messages) : [$messages];
              
              
              Severity: Minor
              Found in src/Console/Style/SerendipityHQStyleSF5.php and 1 other location - About 40 mins to fix
              src/Console/Style/SF4/SerendipityHQStyleSF4.php on lines 97..105

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 93.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              There are no issues that match your filters.

              Category
              Status