symphonycms/symphony-2

View on GitHub
symphony/lib/core/class.session.php

Summary

Maintainability
B
6 hrs
Test Coverage

Function write has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function write($id, $data)
    {
        // Only prevent this record from saving if there isn't already a record
        // in the database. This prevents empty Sessions from being created, but
        // allows them to be nulled.
Severity: Minor
Found in symphony/lib/core/class.session.php - About 1 hr 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 start has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public static function start($lifetime = 0, $path = '/', $domain = null, $httpOnly = true)
    {
        if (!self::$_initialized) {
            if (!is_object(Symphony::Database()) || !Symphony::Database()->isConnected()) {
                throw new Exception('Failed to start session, no Database found.');
Severity: Minor
Found in symphony/lib/core/class.session.php - About 1 hr 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

Method start has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function start($lifetime = 0, $path = '/', $domain = null, $httpOnly = true)
    {
        if (!self::$_initialized) {
            if (!is_object(Symphony::Database()) || !Symphony::Database()->isConnected()) {
                throw new Exception('Failed to start session, no Database found.');
Severity: Minor
Found in symphony/lib/core/class.session.php - About 1 hr to fix

    Method write has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function write($id, $data)
        {
            // Only prevent this record from saving if there isn't already a record
            // in the database. This prevents empty Sessions from being created, but
            // allows them to be nulled.
    Severity: Minor
    Found in symphony/lib/core/class.session.php - About 1 hr to fix

      There are no issues that match your filters.

      Category
      Status