OldInputMiddleware   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 1
dl 11
loc 11
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 8 8 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace App\Middleware\FormsMiddleware;
4
5
use App\Middleware\Middleware;
6
7 View Code Duplication
class OldInputMiddleware extends Middleware
8
{
9
    public function __invoke($request, $response, $next)
10
    {
11
        $this->container->view->getEnvironment()->addGlobal('old', $_SESSION['old']);
12
        $_SESSION['old'] = $request->getParams();
13
        
14
        $response = $next($request, $response);
15
        return $response;
16
    }
17
}
18