phug-php/renderer

View on GitHub
Renderer/Partial/Debug/DebuggerTrait.php

Summary

Maintainability
D
1 day
Test Coverage

Showing 10 of 10 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

    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

    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 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 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

        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 Renderer/Partial/Debug/DebuggerTrait.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 Renderer/Partial/Debug/DebuggerTrait.php - About 1 hr to fix

            Method getRendererException has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            private function getRendererException($error, $code, $line, $offset, $source, $sourcePath, $parameters, $options)
            Severity: Major
            Found in Renderer/Partial/Debug/DebuggerTrait.php - About 1 hr to fix

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

              public function handleError($error, $code, $path, $source, $parameters, $options)
              Severity: Minor
              Found in Renderer/Partial/Debug/DebuggerTrait.php - About 45 mins to fix

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

                private function getDebuggedException($error, $code, $source, $path, $parameters, $options)
                Severity: Minor
                Found in Renderer/Partial/Debug/DebuggerTrait.php - About 45 mins to fix
                  Category
                  Status