e107_handlers/application.php
File application.php
has 2980 lines of code (exceeds 2000 allowed). Consider refactoring. Open
Open
<?php
/*
* e107 website system
*
* Copyright (C) 2008-2012 e107 Inc (e107.org)
Avoid deeply nested control flow statements. Open
Open
if($rule->allowVars)
{
foreach ($rule->allowVars as $key)
{
if(isset($_GET[$key]) && !$request->isRequestParam($key))
Avoid too many return
statements within this method. Open
Open
return $base.$route.$urlSuffix.'?'.$params.$anc;
Avoid too many return
statements within this method. Open
Open
return $base.$route.$urlSuffix.'?'.$params.$anc;
Avoid too many return
statements within this method. Open
Open
return $url !== '' ? $url.$suffix : $url;
Avoid too many return
statements within this method. Open
Open
return rtrim($url, '/');
Avoid too many return
statements within this method. Open
Open
return null;
Avoid too many return
statements within this method. Open
Open
return $format === self::FORMAT_GET ? $base.'?'.$this->routeVar.'='.$route.$anc : $base.$route.$urlSuffix.$anc;
Avoid too many return
statements within this method. Open
Open
return null;
Avoid too many return
statements within this method. Open
Open
return $base.$route.$urlSuffix.$anc;
Avoid too many return
statements within this method. Open
Open
return $base.$tmp.$anc;
Avoid too many return
statements within this method. Open
Open
return self::underscore($title);
Avoid too many return
statements within this method. Open
Open
return $base.rtrim(($this->isMainModule($module) ? '' : $alias.'/').$url, '/').$anc;
Avoid too many return
statements within this method. Open
Open
return $title;
Avoid too many return
statements within this method. Open
Open
return str_replace(' ', '+', $title);
Avoid too many return
statements within this method. Open
Open
return str_replace(' ', '+', $tp->ustrtolower($title));
Avoid too many return
statements within this method. Open
Open
return str_replace(' ', '+', self::camelize($title, true, ' '));
Invalid offset "en"
of array type array{}
Open
Open
$alias = (!empty($this->_alias[e_LAN][$plug][$k])) ? $this->_alias[e_LAN][$plug][$k] : $v['alias'];
- Exclude checks
Returning type null
but getDispatchLocationPath()
is declared to return string
Open
Open
return null;
- Exclude checks
Argument 2 (location)
is null
but \eRouter::file2config()
takes string
defined at /code/e107_handlers/application.php:1271
Open
Open
$c = eRouter::file2config($file, $location);
- Exclude checks
Argument 1 (pathInfo)
is \eRequest
but \eRouter::parsePathInfo()
takes string
defined at /code/e107_handlers/application.php:2448
Open
Open
$manager->parsePathInfo($request, ltrim(substr($pathInfo, strlen($matches[0])), '/'));
- Exclude checks
false
to array comparison Open
Open
if(false !== $params) $request->setRequestParams($params);
- Exclude checks
Assigning null
to property but \eRequest->_action
is string
Open
Open
$this->_action = null;
- Exclude checks
Returning type null
but getRouteHistory()
is declared to return array|string
Open
Open
if(!$this->_routeHistory) return null;
- Exclude checks
Suspicious type \str
of a variable or expression used to build a string. (Expected type to be able to cast to a string) Open
Open
$("#'.$metaTitleID.'").attr("placeholder",title);
- Exclude checks
Argument 2 (params)
is ''
but \eRouter::assemble()
takes array
defined at /code/e107_handlers/application.php:2133
Open
Open
$redirect = $this->assemble($this->notFoundUrl, '', 'encode=0&full=1');
- Exclude checks
Argument 1 (route)
is null
but \eRequest::setRoute()
takes string
defined at /code/e107_handlers/application.php:3834
Open
Open
$request->setRequestInfo($url)->setPathInfo(null)->setRoute(null);
- Exclude checks
Argument 2 (params)
is ''
but \eRouter::assemble()
takes array
defined at /code/e107_handlers/application.php:2133
Open
Open
$url = eFront::instance()->getRouter()->assemble($url, '', 'encode=0');
- Exclude checks
Argument 3 (options)
is 'encode=0'
but \eRouter::assemble()
takes array
defined at /code/e107_handlers/application.php:2133
Open
Open
$url = eFront::instance()->getRouter()->assemble($url, '', 'encode=0');
- Exclude checks
Parameter $titleID
has undeclared type \str
Open
Open
public static function syncSEOTitle($titleID, $metaTitleID)
- Exclude checks
Suspicious type \str
of a variable or expression used to build a string. (Expected type to be able to cast to a string) Open
Open
$("#'.$metaTitleID.'").addClass("has-error");
- Exclude checks
Suspicious array access to true
Open
Open
if(!empty($status[0]) && ($status[0] === '{'))
- Exclude checks
Call to deprecated function \getperms()
defined at /code/class2.php:1322
Open
Open
elseif(getperms('0'))
- Exclude checks
Returning type null
but getConfigObject()
is declared to return \eUrlConfig
Open
Open
if(!class_exists($className, false)) return null;
- Exclude checks
Suspicious type object
of a variable or expression used to build a string. (Expected type to be able to cast to a string) Open
Open
throw new eException("Controller $controller is not an instance of eController");
- Exclude checks
Invalid offset "format"
of array type array{configClass:string}|array{configPath:string}|array{location:mixed}|array{}
Open
Open
if(!isset($_config['config']['format']) || !in_array($_config['config']['format'], array(self::FORMAT_GET, self::FORMAT_PATH)))
- Exclude checks
Returning type null
but getModuleFromAlias()
is declared to return string
Open
Open
return (isset($this->_aliases[$alias]) ? $this->_aliases[$alias] : null);
- Exclude checks
Saw possibly unextractable annotation for a fragment of comment '* @param void':
after void,
did not see an element name (will guess based on comment order) Open
Open
* @param void
- Exclude checks
Suspicious type \str
of a variable or expression used to build a string. (Expected type to be able to cast to a string) Open
Open
var title = $("#'.$titleID.'").val() + " | " + "'.SITENAME.'";
- Exclude checks
Returning type false
but isDispatchableModule()
is declared to return string
Open
Open
return false;
- Exclude checks
Variable $tr
was undeclared, but array fields are being added to it. Open
Open
$tr2['/'] = $tr['/'] = '\\/';
- Exclude checks
Suspicious type \str
of a variable or expression used to build a string. (Expected type to be able to cast to a string) Open
Open
var charlimit = $("#'.$metaTitleID.'").attr("data-char-count");
- Exclude checks
Suspicious type \str
of a variable or expression used to build a string. (Expected type to be able to cast to a string) Open
Open
$("#'.$metaTitleID.'").attr("placeholder",title);
- Exclude checks
Variable $file
is undeclared Open
Open
define('e_PAGE', basename($file));
- Exclude checks
Returning type null
but getControllerPath()
is declared to return string
Open
Open
return ($location ? self::getDispatchPath($module, $location, $sc).$controller.'.php': null);
- Exclude checks
Returning type false
but isDispatchableModule()
is declared to return string
Open
Open
if(!$class_name) return false;
- Exclude checks
Saw possibly unextractable annotation for a fragment of comment '* @param array available URL modules as detected by {@link eDispatcher::adminReadModules()} and stored as url_modules core preference value':
after array,
did not see an element name (will guess based on comment order) Open
Open
* @param array available URL modules as detected by {@link eDispatcher::adminReadModules()} and stored as url_modules core preference value
- Exclude checks
Argument 3 (options)
is 'encode=0&full=1'
but \eRouter::assemble()
takes array
defined at /code/e107_handlers/application.php:2133
Open
Open
$redirect = $this->assemble($this->notFoundUrl, '', 'encode=0&full=1');
- Exclude checks
Variable $tr2
was undeclared, but array fields are being added to it. Open
Open
$tr2['/'] = $tr['/'] = '\\/';
- Exclude checks
Assigning \e_validator
to property but \eControllerFront->_validator
is array
Open
Open
$this->_validator = new e_validator('controller');
- Exclude checks
Returning type null
but getRouteHistory()
is declared to return array|string
Open
Open
return isset($this->_routeHistory[$source]) ? $this->_routeHistory[$source] : null;
- Exclude checks
Assigning array<string></string>
to property but \eResponse->_title
is array<string>>|array<string>|array<string>|array{default:array{}}</string></string></string>
Open
Open
$this->_title['default'] = '';
- Exclude checks
Suspicious type \str
of a variable or expression used to build a string. (Expected type to be able to cast to a string) Open
Open
$("#'.$titleID.'").on("input change focus", function()
- Exclude checks
Invalid offset "en"
of array type array{}
Open
Open
$arr = (!empty($this->_legacyAliases[e_LAN])) ? array_merge($this->_legacy,$this->_legacyAliases[e_LAN]) : $this->_legacy;
- Exclude checks
Returning type false
but isDispatchableModule()
is declared to return string
Open
Open
if(($location = eDispatcher::getModuleRealLocation($module)) === null) return false;
- Exclude checks
Returning type null
but getConfigObject()
is declared to return \eUrlConfig
Open
Open
if(!is_readable($path)) return null;
- Exclude checks
Argument 1 (status)
is ''
but \eFront::isLegacy()
takes bool
defined at /code/e107_handlers/application.php:554
Open
Open
eFront::isLegacy(''); // reset legacy - not found route isn't legacy call
- Exclude checks
Saw possibly unextractable annotation for a fragment of comment '* @param string module':
after string,
did not see an element name (will guess based on comment order) Open
Open
* @param string module
- Exclude checks
Argument 1 (route)
is ?string
but \eRequest::initFromRoute()
takes string
defined at /code/e107_handlers/application.php:3902
Open
Open
return $this->initFromRoute($route);
- Exclude checks
Assigning \e_vars
to property but \eUrlRule->_regexTemplates
is \e_var
Open
Open
$this->_regexTemplates = new e_vars($this->regexTemplates);
- Exclude checks
Argument 2 (vars)
is \e_var
but \e_parse::simpleParse()
takes \e_vars|array
defined at /code/e107_handlers/e_parse_class.php:886
Open
Open
$value = $tp->simpleParse($value, $this->_regexTemplates, '[^\/]+');
- Exclude checks
Reference to undeclared constant \e_UC_PUBLIC
Open
Open
protected $userclass = e_UC_PUBLIC;
- Exclude checks
Assigning null
to property but \eRequest->_controller
is string
Open
Open
$this->_controller = null;
- Exclude checks
Suspicious type \str
of a variable or expression used to build a string. (Expected type to be able to cast to a string) Open
Open
if(!$("#'.$metaTitleID.'").val())
- Exclude checks
Suspicious type \str
of a variable or expression used to build a string. (Expected type to be able to cast to a string) Open
Open
var title = $("#'.$titleID.'").val() + " | " + "'.SITENAME.'";
- Exclude checks
Returning type null
but getAliasFromModule()
is declared to return string
Open
Open
return (in_array($module, $aliases) ? array_search($module, $aliases) : null);
- Exclude checks
Argument 1 (text)
is true
but \e_parse::replaceConstants()
takes string
defined at /code/e107_handlers/e_parse_class.php:3025
Open
Open
$status = e107::getParser()->replaceConstants($status);
- Exclude checks
Returning type string
but isLegacy()
is declared to return bool
Open
Open
return self::$_legacy;
- Exclude checks
Returning type null
but getDispatchLocationPath()
is declared to return string
Open
Open
if(!$plugin) return null;
- Exclude checks
Returning type null
but getConfigObject()
is declared to return \eUrlConfig
Open
Open
if(!$location) return null;
- Exclude checks
Returning type null
but getAliasFromModule()
is declared to return string
Open
Open
return (in_array($module, $this->_aliases) ? array_search($module, $this->_aliases) : null);
- Exclude checks
Argument 1 (status)
is array
but \eFront::isLegacy()
takes bool
defined at /code/e107_handlers/application.php:554
Open
Open
eFront::isLegacy($this->getConfigValue($module, 'legacy'));
- Exclude checks
Assigning \e_vars
to property but \eUrlRule->_regexTemplates
is \e_var
Open
Open
$this->_regexTemplates = new e_vars($this->regexTemplates);
- Exclude checks
Parameter $metaTitleID
has undeclared type \str
Open
Open
public static function syncSEOTitle($titleID, $metaTitleID)
- Exclude checks
Returning type null
but getConfigPath()
is declared to return string
Open
Open
return null;
- Exclude checks
Returning type null
but getConfigLocationPath()
is declared to return string
Open
Open
return null;
- Exclude checks
Returning type null
but getController()
is declared to return \eController
Open
Open
if(!$class_name) return null;
- Exclude checks
Saw possibly unextractable annotation for a fragment of comment '* @param array current configuration array (url_config core preference like)':
after array,
did not see an element name (will guess based on comment order) Open
Open
* @param array current configuration array (url_config core preference like)
- Exclude checks
Argument 1 (encoded_string)
is array
but \parse_str()
takes string
Open
Open
parse_str($this->defaultParams, $this->defaultParams);
- Exclude checks
array to false
comparison Open
Open
if($this->allowVars === false) $this->allowVars = array_keys($this->params);
- Exclude checks
Argument 2 (options)
is '/'
but \eRouter::createPathInfo()
takes array
defined at /code/e107_handlers/application.php:2406
Open
Open
if ($this->append) $url .= '/'.$manager->createPathInfo($params, '/', '/').$suffix;
- Exclude checks
Returning type array
but getValidator()
is declared to return \e_validator
Open
Open
return $this->_validator;
- Exclude checks
Argument 2 (args)
is null
but \array_merge()
takes array
Open
Open
$arr = (!empty($this->_legacyAliases[e_LAN])) ? array_merge($this->_legacy,$this->_legacyAliases[e_LAN]) : $this->_legacy;
- Exclude checks
Returning type null
but getRouteHistory()
is declared to return array|string
Open
Open
return null;
- Exclude checks
Suspicious type \str
of a variable or expression used to build a string. (Expected type to be able to cast to a string) Open
Open
var title = $("#'.$titleID.'").val() + " | " + "'.SITENAME.'";
- Exclude checks
Argument 1 (pathInfo)
is null
but \eRequest::setPathInfo()
takes string
defined at /code/e107_handlers/application.php:3660
Open
Open
$request->setRequestInfo($url)->setPathInfo(null)->setRoute(null);
- Exclude checks
Returning type false
but parse()
is declared to return string
Open
Open
return false;
- Exclude checks
Returning type null
but getControllerClass()
is declared to return string
Open
Open
return ($location ? $location.'_'.$module.'_'.$controllerName.'_controller' : null);
- Exclude checks
Argument 2 (mode)
is 'mix'
but \e_parse::createConstants()
takes int
defined at /code/e107_handlers/e_parse_class.php:3255
Open
Open
return e107::getParser()->createConstants($url, 'mix');
- Exclude checks
Method \eUrlConfig::create
is declared to return array|string
but has no return value Open
Open
public function create($route, $params = array(), $options = array()) {}
- Exclude checks
Assigning null
to property but \eRequest->_module
is string
Open
Open
$this->_module = null;
- Exclude checks
Returning type null
but retrieveModule()
is declared to return string
Open
Open
return null;
- Exclude checks
When appending to a value of type array{},
found an array access index of type ?string,
but expected the index to be of type int|string
Open
Open
$this->_meta[$name] = $attr;
- Exclude checks
Argument 1 (action)
is null
but \e_jshelper::sendJsonResponse()
takes string
defined at /code/e107_handlers/js_helper.php:222
Open
Open
$jshelper->sendJsonResponse(null);
- Exclude checks
Suspicious type \str
of a variable or expression used to build a string. (Expected type to be able to cast to a string) Open
Open
$("#'.$metaTitleID.'").on("ready focus", function() {
- Exclude checks
Returning type null
but getDispatchPath()
is declared to return string
Open
Open
return null;
- Exclude checks
Property \eUrlRule->_regexTemplates
has undeclared type \e_var
(Did you mean class \e_vars) Open
Open
protected $_regexTemplates;
- Exclude checks