includes/session/Session.php
Session
has 50 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class Session implements \Countable, \Iterator, \ArrayAccess {
/** @var null|string[] Encryption algorithm to use */
private static $encryptionAlgorithm = null;
/** @var SessionBackend Session backend */
File Session.php
has 315 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/**
* MediaWiki session
*
* This program is free software; you can redistribute it and/or modify
Method getSecret
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getSecret( $key, $default = null ) {
// Fetch
$encrypted = $this->get( $key, null );
if ( $encrypted === null ) {
return $default;
Function getEncryptionAlgorithm
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
private static function getEncryptionAlgorithm() {
if ( self::$encryptionAlgorithm === null ) {
if ( function_exists( 'openssl_encrypt' ) ) {
$methods = openssl_get_cipher_methods();
if ( in_array( 'aes-256-ctr', $methods, true ) ) {
- 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 getSecret
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
public function getSecret( $key, $default = null ) {
// Fetch
$encrypted = $this->get( $key, null );
if ( $encrypted === null ) {
return $default;
- 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
Avoid too many return
statements within this method. Open
Open
return $value;