MPOS/php-mpos

View on GitHub
include/smarty/libs/sysplugins/smarty_internal_compile_private_special_variable.php

Summary

Maintainability
C
1 day
Test Coverage

Method compile has 69 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function compile($args, $compiler, $parameter)
    {
        $_index = preg_split("/\]\[/",substr($parameter, 1, strlen($parameter)-2));
        $compiled_ref = ' ';
        $variable = trim($_index[0], "'");

    Function compile has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        public function compile($args, $compiler, $parameter)
        {
            $_index = preg_split("/\]\[/",substr($parameter, 1, strlen($parameter)-2));
            $compiled_ref = ' ';
            $variable = trim($_index[0], "'");

    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 "@constant({$_index[1]})";

      Avoid too many return statements within this method.
      Open

                          return "\$_smarty_tpl->getConfigVariable($_index[1])";

        Avoid too many return statements within this method.
        Open

                        return "'$_ldelim'";

          Avoid too many return statements within this method.
          Open

                  return $compiled_ref;

            Avoid too many return statements within this method.
            Open

                            return '$_smarty_tpl';

              Avoid too many return statements within this method.
              Open

                              return "'$_rdelim'";

                Avoid too many return statements within this method.
                Open

                                return "'$_version'";

                  Avoid too many return statements within this method.
                  Open

                                  return 'basename($_smarty_tpl->source->filepath)';

                    Avoid too many return statements within this method.
                    Open

                                        return "(is_array(\$tmp = \$_smarty_tpl->getConfigVariable($_index[1])) ? \$tmp[$_index[2]] : null)";

                      Avoid too many return statements within this method.
                      Open

                                      return 'dirname($_smarty_tpl->source->filepath)';

                        There are no issues that match your filters.

                        Category
                        Status