phug-php/phug

View on GitHub

Showing 113 of 115 total issues

Method getDebugError has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getDebugError($error, $code, $path = null)
    {
        /** @var \Throwable $error */
        $line = $this->getSourceLine($error);
        if ($line === false) {
Severity: Minor
Found in src/Phug/Formatter/Formatter.php - About 1 hr to fix

    Method compileNode has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function compileNode(NodeInterface $node, ElementInterface $parent = null)
        {
            $this->getCompiler()->assert(
                $node instanceof ForNode,
                'Unexpected '.get_class($node).' given to for compiler.',
    Severity: Minor
    Found in src/Phug/Compiler/Compiler/NodeCompiler/ForNodeCompiler.php - About 1 hr to fix

      Method __construct has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function __construct(Lexer $lexer, $input, array $options)
          {
              $this->lexer = $lexer;
              $this->setOptionsRecursive([
                  'reader_class_name'        => Reader::class,
      Severity: Minor
      Found in src/Phug/Lexer/Lexer/State.php - About 1 hr to fix

        Method getExposedProperties has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function getExposedProperties($object, $deep)
            {
                $result = "\n";
                foreach (get_class_methods($object) as $method) {
                    if (mb_strlen($result) > 0x80000) {
        Severity: Minor
        Found in src/Phug/Renderer/Renderer/Profiler/Dump.php - About 1 hr to fix

          Method compileNode has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function compileNode(ParserNodeInterface $node, ElementInterface $parent = null)
              {
                  $compiler = $this->getCompiler();
                  $compiler->assert(
                      $node instanceof MixinCallNode,
          Severity: Minor
          Found in src/Phug/Compiler/Compiler/NodeCompiler/MixinCallNodeCompiler.php - About 1 hr to fix

            Method renderDirectory has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function renderDirectory($path, $destination = null, $extension = '.html', array $parameters = [])
                {
                    if (is_array($destination)) {
                        $parameters = $destination;
                        $destination = null;
            Severity: Minor
            Found in src/Phug/Renderer/Renderer.php - About 1 hr to fix

              Method formatKeywordElement has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function formatKeywordElement(KeywordElement $element)
                  {
                      $name = $element->getName();
                      $keyword = $this->getOption(['keywords', $name]);
                      $result = call_user_func($keyword, $element->getValue(), $element, $name);
              Severity: Minor
              Found in src/Phug/Formatter/Formatter/AbstractFormat.php - About 1 hr to fix

                Method getDefaultOptions has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function getDefaultOptions($options)
                    {
                        return [
                            'debug'                 => true,
                            'exit_on_error'         => true,
                Severity: Minor
                Found in src/Phug/Renderer/Renderer/Partial/RendererOptionsTrait.php - About 1 hr to fix

                  Function compose has a Cognitive Complexity of 12 (exceeds 7 allowed). Consider refactoring.
                  Open

                      public function compose($timePrecision, $lineHeight)
                      {
                          $duration = microtime(true) - $this->startTime;
                          $linkedProcesses = new LinkedProcesses($this->events, $this->nodesRegister);
                  
                  
                  Severity: Minor
                  Found in src/Phug/Renderer/Renderer/Profiler/Profile.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

                  Function mergeEventListeners has a Cognitive Complexity of 12 (exceeds 7 allowed). Consider refactoring.
                  Open

                      public function mergeEventListeners($eventListeners)
                      {
                          if ($eventListeners instanceof EventManagerInterface) {
                              $eventListeners = $eventListeners->getEventListeners();
                          }
                  Severity: Minor
                  Found in src/Phug/Event/EventManagerTrait.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

                  Function scan has a Cognitive Complexity of 12 (exceeds 7 allowed). Consider refactoring.
                  Open

                      public function scan(State $state)
                      {
                          $tokens = [];
                  
                          /** @var ImportToken $token */
                  Severity: Minor
                  Found in src/Phug/Lexer/Lexer/Scanner/ImportScanner.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

                  Function formatElementChildren has a Cognitive Complexity of 12 (exceeds 7 allowed). Consider refactoring.
                  Open

                      protected function formatElementChildren(ElementInterface $element, $indentStep = 1)
                      {
                          $indentLevel = $this->formatter->getLevel();
                          $this->formatter->setLevel($indentLevel + $indentStep);
                          $content = '';
                  Severity: Minor
                  Found in src/Phug/Formatter/Formatter/AbstractFormat.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

                  Function formatMixinCallElement has a Cognitive Complexity of 12 (exceeds 7 allowed). Consider refactoring.
                  Open

                      protected function formatMixinCallElement(MixinCallElement $mixinCall)
                      {
                          $hasBlock = $mixinCall->hasChildren();
                          $children = new PhpUnwrap($this->formatElementChildren($mixinCall), $this->formatter);
                          $mixinName = $mixinCall->getName();
                  Severity: Minor
                  Found in src/Phug/Formatter/Formatter/AbstractFormat.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

                  Function mergeOptions has a Cognitive Complexity of 12 (exceeds 7 allowed). Consider refactoring.
                  Open

                      private static function mergeOptions($options, $values)
                      {
                          foreach ($values as $key => &$value) {
                              if (substr($key, 0, 3) === 'on_') {
                                  if (!is_array($value) || is_callable($value)) {
                  Severity: Minor
                  Found in src/Phug/Phug/Phug/Partial/ExtensionsTrait.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 getIndentLevel has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function getIndentLevel(State $state, $maxLevel = INF, callable $getIndentChar = null)
                      {
                          if ($maxLevel <= 0) {
                              return 0;
                          }
                  Severity: Minor
                  Found in src/Phug/Lexer/Lexer/Scanner/IndentationScanner.php - About 1 hr to fix

                    Method enableModules has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private function enableModules()
                        {
                            /* @var ModuleContainerInterface $this */
                    
                            $this->addModules($this->getOption('modules'));
                    Severity: Minor
                    Found in src/Phug/Renderer/Renderer/Partial/RendererOptionsTrait.php - About 1 hr to fix

                      Method getErrorAsHtml has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private function getErrorAsHtml($error, $parameters, $data)
                          {
                              $sandBox = new SandBox(function () use (
                                  $error,
                                  $parameters,
                      Severity: Minor
                      Found in src/Phug/Renderer/Renderer/Partial/Debug/DebuggerTrait.php - About 1 hr to fix

                        Method getProcesses has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private function getProcesses($list, $link, $index, $duration, $maxSpace, $lineHeight, $timePrecision)
                            {
                                $count = count($list);
                                for ($i = $count > 1 ? 1 : 0; $i < $count; $i++) {
                                    /** @var Event $previousEvent */
                        Severity: Minor
                        Found in src/Phug/Renderer/Renderer/Profiler/Profile.php - About 1 hr to fix

                          Method getRendererException has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              private function getRendererException($error, $code, $line, $offset, $source, $sourcePath, $parameters, $options)
                              {
                                  $colorSupport = $options['color_support'];
                                  if (is_null($colorSupport)) {
                                      $colorSupport = $this->hasColorSupport();
                          Severity: Minor
                          Found in src/Phug/Renderer/Renderer/Partial/Debug/DebuggerTrait.php - About 1 hr to fix

                            Method callAdapter has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function callAdapter($method, $path, $input, callable $getSource, array $parameters)
                                {
                                    $source = '';
                            
                                    $this->getCompiler()->reset();
                            Severity: Minor
                            Found in src/Phug/Renderer/Renderer/Partial/AdapterTrait.php - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language