User::user_in()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 10
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
use HnrAzevedo\Filter\Filter;
4
5
class User extends Filter{
6
7
    public function user_in(): bool
8
    {
9
        /* Set message to be displayed in case of error  */
10
        $this->addMessage('user_in','User required to be logged in.');
11
12
        /* OPTIONAL: Defines function to be executed before the error is returned to the client */
13
        $this->addTreat('user_in','report_notLogged');
14
15
        /* Test something and return your result */
16
        return (array_key_exists('user',$_SESSION));
17
    }
18
19
    public function report_notLogged(): void
20
    {
21
        /* Do something before the error is returned to the client */
22
    }
23
24
    /* Other filters and treatments ... */
25
26
}
27
28