GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — 3.0 ( fea5eb...c29f0e )
by Vermeulen
02:17
created

Session::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace BFW\Core\AppSystems;
4
5
class Session extends AbstractSystem
6
{
7
    /**
8
     * {@inheritdoc}
9
     * 
10
     * @return null
11
     */
12
    public function __invoke()
13
    {
14
        return null;
15
    }
16
17
    /**
18
     * Initialize sessions system
19
     * Automaticaly destroy cookie if browser quit and start sessions
20
     * 
21
     * @return void
22
     */
23
    public function init()
24
    {
25
        if ($this->obtainRunSession() === false) {
26
            $this->initStatus = true;
27
            return;
28
        }
29
30
        //Destroy session cookie if browser quit
31
        session_set_cookie_params(0);
32
33
        //Run session
34
        session_start();
35
        
36
        $this->initStatus = true;
37
    }
38
    
39
    /**
40
     * Obtain the value of the option runSession passed to Application
41
     * 
42
     * @return boolean
43
     */
44
    protected function obtainRunSession()
45
    {
46
        return \BFW\Application::getInstance()
0 ignored issues
show
Documentation Bug introduced by
The method getOptions does not exist on object<BFW\Application>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
47
            ->getOptions()
48
            ->getValue('runSession')
49
        ;
50
    }
51
}
52