phug-php/renderer

View on GitHub

Showing 35 of 35 total issues

File DebuggerTrait.php has 300 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Phug\Renderer\Partial\Debug;

use Phug\Formatter;
Severity: Minor
Found in Renderer/Partial/Debug/DebuggerTrait.php - About 3 hrs to fix

    File ProfilerModule.php has 296 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace Phug\Renderer\Profiler;
    
    use Phug\Compiler\Event\CompileEvent;
    Severity: Minor
    Found in Renderer/Profiler/ProfilerModule.php - About 3 hrs to fix

      Function scanDirectory has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          public function scanDirectory($directory, $extensions = null, $directoryCallback = null, $fileCallback = null)
          {
              if ($extensions === null) {
                  $extensions = $this->getOption('extensions');
              }
      Severity: Minor
      Found in Renderer/Partial/FileSystemTrait.php - About 2 hrs 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

      ProfilerModule has 23 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class ProfilerModule extends AbstractModule
      {
          /**
           * @var int
           */
      Severity: Minor
      Found in Renderer/Profiler/ProfilerModule.php - About 2 hrs to fix

        Function getExposedProperties has a Cognitive Complexity of 18 (exceeds 5 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 Renderer/Profiler/Dump.php - About 2 hrs 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 getErrorMessage has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            private function getErrorMessage($error, SourceLocation $location, $data)
            {
                /* @var \Throwable $error */
                $source = explode("\n", rtrim($data->source));
                $errorType = get_class($error);
        Severity: Minor
        Found in Renderer/Partial/Debug/DebuggerTrait.php - About 2 hrs 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

        File FileAdapter.php has 253 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        namespace Phug\Renderer\Adapter;
        
        use Phug\Compiler\LocatorInterface;
        Severity: Minor
        Found in Renderer/Adapter/FileAdapter.php - About 2 hrs to fix

          Method getErrorMessage has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function getErrorMessage($error, SourceLocation $location, $data)
              {
                  /* @var \Throwable $error */
                  $source = explode("\n", rtrim($data->source));
                  $errorType = get_class($error);
          Severity: Minor
          Found in Renderer/Partial/Debug/DebuggerTrait.php - About 2 hrs to fix

            Method compose has 49 lines of code (exceeds 25 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 Renderer/Profiler/Profile.php - About 1 hr to fix

              Method initProperties has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function initProperties($name, $events)
                  {
                      $style = [];
                      foreach ([
                          ['current', EndLexEvent::class, 'lexing', [
              Severity: Minor
              Found in Renderer/Profiler/LinkDump.php - About 1 hr to fix

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

                    protected function initDebugOptions(Renderer $profilerContainer)
                    {
                        $profilerContainer->setOptionsDefaults([
                            'memory_limit'       => $profilerContainer->getOption('debug') ? 0x3200000 : -1, // 50MB by default in debug
                            'execution_max_time' => $profilerContainer->getOption('debug') ? 30000 : -1, // 30s by default in debug
                Severity: Minor
                Found in Renderer/Partial/Debug/DebuggerTrait.php - About 1 hr to fix

                  Function compose has a Cognitive Complexity of 12 (exceeds 5 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 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 handleError has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function handleError($error, $code, $path, $source, $parameters, $options)
                      {
                          /* @var \Throwable $error */
                          $exception = $options['debug']
                              ? $this->getDebuggedException($error, $code, $source, $path, $parameters, $options)
                  Severity: Minor
                  Found in Renderer/Partial/Debug/DebuggerTrait.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 getEventListeners has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function getEventListeners()
                      {
                          $eventListeners = array_map(function (callable $eventListener) {
                              return function (Event $event) use ($eventListener) {
                                  if ($this->isAlive() && $eventListener($event) !== false) {
                  Severity: Minor
                  Found in Renderer/Profiler/ProfilerModule.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 Renderer.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 Renderer/Profiler/Dump.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 Renderer/Partial/RendererOptionsTrait.php - About 1 hr to fix

                          Function calculateIndex has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private function calculateIndex($lines, $min, $max)
                              {
                                  $index = 0;
                                  foreach ($lines as $level => $line) {
                                      foreach ($line as $process) {
                          Severity: Minor
                          Found in 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 __construct has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function __construct(EventList $events, SplObjectStorage $nodesRegister)
                              {
                                  $this->nodesRegister = $nodesRegister;
                          
                                  if ($events) {
                          Severity: Minor
                          Found in Renderer/Profiler/LinkedProcesses.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 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 Renderer/Partial/RendererOptionsTrait.php - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language