e107inc/e107

View on GitHub
e107_handlers/shortcode_handler.php

Summary

Maintainability
A
3 hrs
Test Coverage
F
58%

Consider simplifying this complex logical expression.
Open

        if(empty($code)
        || empty($this->editableCodes)
        || empty($this->editableCodes['shortcodes'][$lcode])
        || !isset($this->editableCodes['perms'])
        || empty($this->editableCodes['table'])
Severity: Critical
Found in e107_handlers/shortcode_handler.php - About 1 hr to fix

    Avoid too many return statements within this method.
    Open

                                        return '';
    Severity: Major
    Found in e107_handlers/shortcode_handler.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                      return $matches[0];
      Severity: Major
      Found in e107_handlers/shortcode_handler.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return null;
        Severity: Major
        Found in e107_handlers/shortcode_handler.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return isset($ret) ? $ret: '';
          Severity: Major
          Found in e107_handlers/shortcode_handler.php - About 30 mins to fix

            Argument 1 (filename) is ?string but \is_readable() takes string
            Open

                    if (is_readable($path))
            Severity: Minor
            Found in e107_handlers/shortcode_handler.php by phan

            Returning type null but getScObject() is declared to return \e_shortcode
            Open

                    return null;
            Severity: Minor
            Found in e107_handlers/shortcode_handler.php by phan

            Returning type null but loadThemeShortcodes() is declared to return \e_parse_shortcode
            Open

                        return null;
            Severity: Minor
            Found in e107_handlers/shortcode_handler.php by phan

            Returning type null but getScObject() is declared to return \e_shortcode
            Open

                    if(trim($className)==""){ return null; }
            Severity: Minor
            Found in e107_handlers/shortcode_handler.php by phan

            Returning type null but initShortcodeClass() is declared to return \e_shortcode
            Open

                    return null;
            Severity: Minor
            Found in e107_handlers/shortcode_handler.php by phan

            Assigning object to property but \e_parse_shortcode->addedCodes is null
            Open

                        $this->addedCodes = &$extraCodes;
            Severity: Minor
            Found in e107_handlers/shortcode_handler.php by phan

            Argument 1 (object) is null but \method_exists() takes object|string
            Open

                        if($this->editableActive && method_exists($this->addedCodes, 'editable'))
            Severity: Minor
            Found in e107_handlers/shortcode_handler.php by phan

            Argument 1 (eVars) is \e_object|\e_vars|string but \e_shortcode::setParserVars() takes array defined at /code/e107_handlers/shortcode_handler.php:1808
            Open

                    return $this->setParserVars($eVars);    
            Severity: Minor
            Found in e107_handlers/shortcode_handler.php by phan

            Call to method wrapper on non-class type null
            Open

                            $tmpWrap = e107::templateWrapper($this->addedCodes->wrapper());
            Severity: Critical
            Found in e107_handlers/shortcode_handler.php by phan

            Argument 1 (object) is null but \method_exists() takes object|string
            Open

                    if (!isset($this->addonOverride[$_method]) && is_object($this->addedCodes) && method_exists($this->addedCodes, $_method)) //It is class-based batch shortcode.  Class already loaded; call the method
            Severity: Minor
            Found in e107_handlers/shortcode_handler.php by phan

            Invalid offset "pid" of array type array{}
            Open

                    $pid        = $this->editableCodes['pid'];
            Severity: Minor
            Found in e107_handlers/shortcode_handler.php by phan

            Invalid offset "perms" of array type array{}
            Open

                    || !getperms($this->editableCodes['perms'])
            Severity: Minor
            Found in e107_handlers/shortcode_handler.php by phan

            Argument 1 (object) is null but \get_class() takes object
            Open

                            $_class = get_class($this->addedCodes); // "(class loaded)"; // debug. 
            Severity: Minor
            Found in e107_handlers/shortcode_handler.php by phan

            Call to deprecated function \getperms() defined at /code/class2.php:1322
            Open

                    || !getperms($this->editableCodes['perms'])
            Severity: Minor
            Found in e107_handlers/shortcode_handler.php by phan

            Argument 2 (search) is null but \array_key_exists() takes array
            Open

                    elseif(is_array($this->addedCodes) && array_key_exists($code, $this->addedCodes)) // Its array-based shortcode. Load the code for evaluation later.
            Severity: Minor
            Found in e107_handlers/shortcode_handler.php by phan

            Assigning array to property but \e_parse_shortcode->addedCodes is null
            Open

                        $this->addedCodes = &$extraCodes;
            Severity: Minor
            Found in e107_handlers/shortcode_handler.php by phan

            Argument 3 (fullShortcodeKey) is ?string but \e_parse_shortcode::makeWrapper() takes string defined at /code/e107_handlers/shortcode_handler.php:1503
            Open

                            $ret = $this->makeWrapper($ret, $code, $fullShortcodeKey, $sc_mode);
            Severity: Minor
            Found in e107_handlers/shortcode_handler.php by phan

            Call to method getVars on non-class type null
            Open

                        $var = $this->addedCodes->getVars();
            Severity: Critical
            Found in e107_handlers/shortcode_handler.php by phan

            Invalid offset "shortcodes" of array type array{}
            Open

                    || empty($this->editableCodes['shortcodes'][$lcode])
            Severity: Minor
            Found in e107_handlers/shortcode_handler.php by phan

            Call to method editable on non-class type null
            Open

                            $this->editableCodes = $this->addedCodes->editable();
            Severity: Critical
            Found in e107_handlers/shortcode_handler.php by phan

            Argument 1 (object) is null but \get_class() takes object
            Open

                        $debugArr = array('class_original'=>get_class($this->addedCodes), 'class_override'=>$this->addonOverride[$_method], 'function'=>$_method);
            Severity: Minor
            Found in e107_handlers/shortcode_handler.php by phan

            Invalid offset "shortcodes" of array type array{}
            Open

                    $container  = empty($this->editableCodes['shortcodes'][$lcode]['container']) ? 'span' : $this->editableCodes['shortcodes'][$lcode]['container'];
            Severity: Minor
            Found in e107_handlers/shortcode_handler.php by phan

            Assigning string to property but \e_parse_shortcode->nowrap is false
            Open

                        $this->nowrap = $code;
            Severity: Minor
            Found in e107_handlers/shortcode_handler.php by phan

            Call to deprecated function \getperms() defined at /code/class2.php:1322
            Open

                            if(isset($this->editableCodes['perms']) && getperms($this->editableCodes['perms']))
            Severity: Minor
            Found in e107_handlers/shortcode_handler.php by phan

            Call to method getWrapperID on non-class type null
            Open

                            $this->wrapper = $this->addedCodes->getWrapperID();
            Severity: Critical
            Found in e107_handlers/shortcode_handler.php by phan

            Assigning null to property but \e_parse_shortcode->debug_legacy is array{}
            Open

                    $this->debug_legacy = null;
            Severity: Minor
            Found in e107_handlers/shortcode_handler.php by phan

            Assigning string to property but \e_parse_shortcode->nowrap is false
            Open

                        $this->nowrap = $code;
            Severity: Minor
            Found in e107_handlers/shortcode_handler.php by phan

            Saw possibly unextractable annotation for a fragment of comment '* @param string mod': after string, did not see an element name (will guess based on comment order)
            Open

                 * @param string mod
            Severity: Info
            Found in e107_handlers/shortcode_handler.php by phan

            Invalid offset "shortcodes" of array type array{}
            Open

                    || empty($this->editableCodes['shortcodes'][$lcode]['field'])
            Severity: Minor
            Found in e107_handlers/shortcode_handler.php by phan

            Call to method getScVar on non-class type null
            Open

                        $var = $this->addedCodes->getScVar($varID);
            Severity: Critical
            Found in e107_handlers/shortcode_handler.php by phan

            Returning type ?string but getWrapperID() is declared to return null
            Open

                    return $this->wrapper;
            Severity: Minor
            Found in e107_handlers/shortcode_handler.php by phan

            Argument 1 (object) is null but \method_exists() takes object|string
            Open

                        if(method_exists($this->addedCodes, 'wrapper'))
            Severity: Minor
            Found in e107_handlers/shortcode_handler.php by phan

            Invalid offset "perms" of array type array{}
            Open

                            if(isset($this->editableCodes['perms']) && getperms($this->editableCodes['perms']))
            Severity: Minor
            Found in e107_handlers/shortcode_handler.php by phan

            Argument 1 (object) is null but \method_exists() takes object|string
            Open

                    if((E107_DBG_BBSC || E107_DBG_SC) && isset($this->addonOverride[$_method]) && is_object($this->addedCodes) && method_exists($this->addedCodes, $_method))
            Severity: Minor
            Found in e107_handlers/shortcode_handler.php by phan

            Invalid offset "vars" of array type array{}
            Open

                        $varID = $this->editableCodes['vars'];
            Severity: Minor
            Found in e107_handlers/shortcode_handler.php by phan

            There are no issues that match your filters.

            Category
            Status