atelierspierrot/reflectors

View on GitHub

Showing 26 of 26 total issues

File index.php has 442 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Show errors at least initially
 *
Severity: Minor
Found in demo/index.php - About 6 hrs to fix

    Function getArguments has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getArguments()
        {
            $args               = $this->getArgs();
            $this->arguments    = array();
            if (empty($this->arguments) && !empty($args) && count($args) > 0) {
    Severity: Minor
    Found in src/Reflectors/ReflectionTrace.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 getSource has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getSource()
        {
            if (empty($this->source)) {
                $lines      = $this->_getFileSource();
                $lineno     = $this->getLineNo();
    Severity: Minor
    Found in src/Reflectors/ReflectionSource.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 _populate has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function _populate()
        {
            $callback = $this->getCallback();
            if ($this->isClosure()) {
                $this->function_name = $callback;
    Severity: Minor
    Found in src/Reflectors/ReflectionCallback.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 getCallbackType has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function getCallbackType(callable $callback)
        {
            if (is_object($callback) && ($callback instanceof \Closure)) {
                return self::CALLBACK_CLOSURE;
            } else {
    Severity: Minor
    Found in src/Reflectors/ValueType.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 getArguments has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getArguments()
        {
            $args               = $this->getArgs();
            $this->arguments    = array();
            if (empty($this->arguments) && !empty($args) && count($args) > 0) {
    Severity: Minor
    Found in src/Reflectors/ReflectionTrace.php - About 1 hr to fix

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

      if (file_exists($a = __DIR__.'/../../../autoload.php')) {
          require_once $a;
      } elseif (file_exists($b = __DIR__.'/../vendor/autoload.php')) {
          require_once $b;
      
      
      Severity: Major
      Found in demo/console.php and 1 other location - About 1 hr to fix
      demo/index.php on lines 31..45

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

      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 __construct($value, $flag = ValueType::MODE_STRICT)
          {
              if (!ValueType::isArray($value)) {
                  throw new \ReflectionException(
                      sprintf(__METHOD__.' expects parameter one to be array, %s given', gettype($value))
      Severity: Major
      Found in src/Reflectors/Value/ReflectionArray.php and 1 other location - About 1 hr to fix
      src/Reflectors/Value/ReflectionResource.php on lines 53..64

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

      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 __construct($value, $flag = ValueType::MODE_STRICT)
          {
              if (!ValueType::isResource($value)) {
                  throw new \ReflectionException(
                      sprintf(__METHOD__.' expects parameter one to be resource, %s given', gettype($value))
      Severity: Major
      Found in src/Reflectors/Value/ReflectionResource.php and 1 other location - About 1 hr to fix
      src/Reflectors/Value/ReflectionArray.php on lines 54..65

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

      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

      if (file_exists($a = __DIR__.'/../../../autoload.php')) {
          require_once $a;
      } elseif (file_exists($b = __DIR__.'/../vendor/autoload.php')) {
          require_once $b;
      
      
      Severity: Major
      Found in demo/index.php and 1 other location - About 1 hr to fix
      demo/console.php on lines 26..40

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

      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

      Method renderHighlight has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function renderHighlight($return = false, $info = false)
          {
              $directives = $this->getContext('highlighting');
              $old_values = array();
              foreach ($directives as $name=>$default) {
      Severity: Minor
      Found in src/Reflectors/ReflectionSource.php - About 1 hr to fix

        Function __toString has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            public function __toString()
            {
                try {
                    $str = 'at ' . $this->getCalled();
        
        
        Severity: Minor
        Found in src/Reflectors/ReflectionTrace.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 getSource has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getSource()
            {
                if (empty($this->source)) {
                    $lines      = $this->_getFileSource();
                    $lineno     = $this->getLineNo();
        Severity: Minor
        Found in src/Reflectors/ReflectionSource.php - About 1 hr to fix

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

              public static function getReflector($value, $flag = self::MODE_STRICT, array $order = null)
              {
                  $type       = self::getType($value, $flag, $order);
                  $reflector  = new Value\ReflectionUnknown($value);
                  switch ($type) {
          Severity: Minor
          Found in src/Reflectors/ValueType.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 __toString has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function __toString()
              {
                  try {
                      $str = 'at ' . $this->getCalled();
          
          
          Severity: Minor
          Found in src/Reflectors/ReflectionTrace.php - About 1 hr to fix

            Function renderHighlight has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                public function renderHighlight($return = false, $info = false)
                {
                    $directives = $this->getContext('highlighting');
                    $old_values = array();
                    foreach ($directives as $name=>$default) {
            Severity: Minor
            Found in src/Reflectors/ReflectionSource.php - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
            Open

                public function __construct($value)
                {
                    parent::__construct($value);
                    if (!empty($this::$proxy_class)) {
                        if (class_exists($this::$proxy_class)) {
            Severity: Minor
            Found in src/Reflectors/AbstractReflectionValueProxy.php - About 55 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 _renderSource has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function _renderSource()
                {
                    $str    = '';
                    $lines  = $this->getSource();
                    foreach ($lines as $i=>$line) {
            Severity: Minor
            Found in src/Reflectors/ReflectionSource.php - About 45 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 getType has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function getType($value, $flag = self::MODE_STRICT, array $order = null)
                {
                    if (is_null($order)) {
                        $order = self::$ordered_types;
                    }
            Severity: Minor
            Found in src/Reflectors/ValueType.php - About 45 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 getTraces has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public function getTraces()
                {
                    if (empty($this->traces)) {
                        $this->traces = array();
                        $counter = 1;
            Severity: Minor
            Found in src/Reflectors/ReflectionBacktrace.php - About 45 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