| Conditions | 2 |
| Paths | 2 |
| Total Lines | 8 |
| Code Lines | 4 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 36 | 2 | public function useSession() |
|
|
1 ignored issue
–
show
|
|||
| 37 | { |
||
| 38 | 2 | $this->session = $this->getRequest()->getAttribute('session'); |
|
| 39 | |||
| 40 | 2 | if (!isset($this->session)) { |
|
| 41 | 1 | $this->session =& $_SESSION; |
|
| 42 | 1 | } |
|
| 43 | 2 | } |
|
| 44 | |||
| 66 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: