File Session.php
has 320 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Admidio;
use Admidio\UserInterface\Form;
Session
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class Session extends \TableAccess
{
/**
* @var array<string,mixed> Array with all objects of this session object.
*/
Method start
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function start(string $cookiePrefix, int $limit = 0, string $path = '', string $domain = '', bool $secure = null, bool $httpOnly = true)
{
global $gLogger, $gSetCookieForDomain;
if (headers_sent()) {
Function start
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function start(string $cookiePrefix, int $limit = 0, string $path = '', string $domain = '', bool $secure = null, bool $httpOnly = true)
{
global $gLogger, $gSetCookieForDomain;
if (headers_sent()) {
- Read upRead up
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 setCookie
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function setCookie(
string $name,
string $value = '',
int $expire = 0,
string $path = '',
Method refreshAutoLogin
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function refreshAutoLogin()
{
if (array_key_exists($this->cookieAutoLoginId, $_COOKIE)) {
// restore user from auto login session
$this->mAutoLogin = new \AutoLogin($this->db, $_COOKIE[$this->cookieAutoLoginId]);
Function setCookie
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function setCookie(
string $name,
string $value = '',
int $expire = 0,
string $path = '',
- Read upRead up
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 setCookie
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
string $name,
string $value = '',
int $expire = 0,
string $path = '',
string $domain = '',
Method start
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function start(string $cookiePrefix, int $limit = 0, string $path = '', string $domain = '', bool $secure = null, bool $httpOnly = true)
Function isValidLogin
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function isValidLogin(int $userId): bool
{
global $gSettingsManager;
if ($userId > 0) {
- Read upRead up
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 refreshAutoLogin
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function refreshAutoLogin()
{
if (array_key_exists($this->cookieAutoLoginId, $_COOKIE)) {
// restore user from auto login session
$this->mAutoLogin = new \AutoLogin($this->db, $_COOKIE[$this->cookieAutoLoginId]);
- Read upRead up
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 refresh
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function refresh()
{
global $gCurrentSession, $gCheckIpAddress;
// read session data from database to update the reload flag
- Read upRead up
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 __construct
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function __construct(\Database $database, string $cookiePrefix = '')
{
parent::__construct($database, TBL_SESSIONS, 'ses');
// determine session id
- Read upRead up
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"