kylekatarnls/sbp

View on GitHub

Showing 30 of 32 total issues

Method container has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public static function container($container, $file, $content = null, $basename = null, $name = null)
Severity: Minor
Found in src/Sbp/Sbp.php - About 35 mins to fix

    Function fileExists has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function fileExists($file, &$phpFile = null)
        {
            $file = preg_replace('#(\.sbp)?(\.php)?$#', '', $file);
            $sbpFile = $file.'.sbp.php';
    
    
    Severity: Minor
    Found in src/Sbp/Sbp.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 replace has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function replace($content, $replace)
        {
            if (is_array($replace) && count($replace) === 2 && key($replace) === 0) {
                $replace = array($replace[0] => $replace[1]);
            }
    Severity: Minor
    Found in src/Sbp/Sbp.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 findLastBlock has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        protected static function findLastBlock(&$line, array $blocks)
        {
            $position = false;
            foreach ($blocks as $block) {
                if (preg_match('#(?<![a-zA-Z0-9$_])'.$block.'(?![a-zA-Z0-9_])#s', $line, $match, PREG_OFFSET_CAPTURE)) {
    Severity: Minor
    Found in src/Sbp/Plugins/Core/Indentation.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 call_user_func(array($compiler, '__replaceSuperMethods'),
                    call_user_func(array($caller, 'replace'), $content, $replacements),
                    $caller
                );
    Severity: Major
    Found in src/Sbp/Plugins/Core/Compiler.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                              return ' __sbp_'.$keyWord.$subst.$value.$id.$value.$subst;
      Severity: Major
      Found in src/Sbp/Plugins/Core/Compiler.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return $subst.$value.$id.$value.$subst;
        Severity: Major
        Found in src/Sbp/Plugins/Core/Compiler.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return $content;
          Severity: Major
          Found in src/Sbp/Plugins/Core/Compiler.php - About 30 mins to fix

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

                public function __call($method, $args)
                {
                    if (is_object($this->value) && method_exists($this->value, $method)) {
                        return call_user_func_array(array($this->value, $method), $args);
                    }
            Severity: Minor
            Found in src/Sbp/Handler.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

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

                protected function callOnStringValue($method, $args)
                {
                    if (function_exists('preg_'.$method)) {
                        $function = 'preg_'.$method;
                        switch ($method) {
            Severity: Minor
            Found in src/Sbp/Handler.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