atelierspierrot/reflectors

View on GitHub

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

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

            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 loadClass has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public function loadClass($className)
                {
                    if ($filePath = $this->resolveFileName($className)) {
                        if ($this->getFailureFlag() & self::FAIL_GRACEFULLY) {
                            if ($this->classFileExists($filePath)) {
            Severity: Minor
            Found in src/SplClassLoader.php - About 35 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 getReflector has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public function getReflector()
                {
                    if (empty($this->reflector)) {
                        if ($this->isFunction() || $this->isClosure()) {
                            $this->reflector = new \ReflectionFunction($this->getFunctionName());
            Severity: Minor
            Found in src/Reflectors/ReflectionCallback.php - About 35 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

            Avoid too many return statements within this method.
            Open

                    return null;
            Severity: Major
            Found in src/Reflectors/ValueType.php - About 30 mins to fix

              Function setReadOnlyProperties has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function setReadOnlyProperties(array $data)
                  {
                      foreach ($data as $var=>$val) {
                          if (!property_exists(get_called_class(), $var)) {
                              throw new \InvalidArgumentException(
              Severity: Minor
              Found in src/Reflectors/ReadOnlyPropertiesTrait.php - About 25 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