ShortListController   B
last analyzed

Complexity

Total Complexity 41

Size/Duplication

Total Lines 220
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 7

Importance

Changes 0
Metric Value
wmc 41
lcom 1
cbo 7
dl 0
loc 220
rs 8.2769
c 0
b 0
f 0

14 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 10 2
B dontPerformAction() 0 5 5
A index() 0 16 4
A Link() 0 11 2
B renderList() 0 22 4
B performAction() 0 25 4
A shortListCount() 0 14 4
A getShortListSession() 0 4 1
A getSecurityToken() 0 4 1
A determineAction() 0 14 3
A getSessionShortList() 0 7 1
A renderAjax() 0 14 3
A dontRender() 0 4 4
A isSessionValid() 0 4 3

How to fix   Complexity   

Complex Class

Complex classes like ShortListController often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use ShortListController, and based on these observations, apply Extract Interface, too.

1
<?php
2
3
class ShortListController extends Page_Controller
4
{
5
    private static $allowed_actions = array(
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
6
        'renderList',
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
7
        'performAction'
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
8
    );
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
9
10
    private static $url_handlers = array(
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
11
        'add'       => 'performAction',
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
12
        'remove'    => 'performAction',
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
13
        '$URL!'     => 'renderList',
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
14
    );
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
15
16
    private static $extensions = array(
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
17
        'ShortListPaginationExtension'
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
18
    );
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
19
20
    public function init()
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
21
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
22
        parent::init();
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
23
24
        Session::start();
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
25
26
        if ($this->request->getVar('page')) {
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
27
            $this->currentPage = $this->request->getVar('page');
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
28
        }
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
29
    }
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
30
31
    /**
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
32
     * When landing on the homepage, if there is a shortlist for the current
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
33
     * user, redirect to the correct URL. Otherwise, 404.
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
34
     * */
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
35
    public function index($request)
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
36
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
37
        $shortlist = $this->getSessionShortList();
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
38
39
        if (!empty($shortlist)) {
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
40
            return $this->redirect(Config::inst()->get('ShortList', 'URLSegment') . $shortlist->URL);
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
41
        } else {
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
42
            if (!$shortlist || !$shortlist->exists()) {
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
43
                $shortlist = new ShortList();
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
44
                $shortlist->write();
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
45
            }
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
46
        }
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
47
48
        // render with empty template.
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
49
        return $this->renderWith(array('Page', 'ShortList_empty'));
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
50
    }
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
51
52
    /**
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
53
     * Get the absolute URL of this controller.
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
54
     * */
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
55
    public function Link($action = null)
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
56
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
57
        $shortlist = $this->getSessionShortList();
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
58
        $url = Config::inst()->get('ShortList', 'URLSegment');
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
59
60
        if ($shortlist) {
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
61
            $url .= $shortlist->URL;
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
62
        }
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
63
64
        return $url;
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
65
    }
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
66
67
    public function renderList($request)
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
68
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
69
        $shortlist = DataObject::get_one('ShortList', $filter = array('URL' => $request->param('URL')));
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
70
        $link = false;
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
71
        $count = 0;
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
72
73
        if ($this->dontRender($shortlist, $request)) {
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
74
            return $this->httpError(404);
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
75
        }
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
76
77
        if ($shortlist && $shortlist->exists()) {
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
78
            $link = $shortlist->Link();
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
79
            $count = $shortlist->ShortListItems()->Count();
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
80
        }
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
81
82
        return $this->customise(array(
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
83
            'ShortlistURL' => $link,
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
84
            'ShortlistCount' => $count
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
85
        ))->renderWith(
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
86
            array('ShortList', 'Page')
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
87
        );
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
88
    }
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
89
90
    public function performAction($request)
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
91
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
92
        if ($this->dontPerformAction($request)) {
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
93
            return $this->httpError(404);
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
94
        }
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
95
96
        $action = $this->determineAction($request->getURL());
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
97
98
        $status = $action->performAction(
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
99
            $shortlist = $this->getSessionShortList(),
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
100
            $ID = $request->getVar('id'),
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
101
            $type = $request->getVar('type'),
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
102
            $session = $request->getVar('s')
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
103
        );
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
104
105
        if ($request->isAjax()) {
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
106
            return $this->renderAjax($session);
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
107
        }
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
108
109
        if (array_key_exists('output', $request->getVars())) {
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
110
            return $status;
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
111
        }
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
112
113
        return $this->redirectBack();
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
114
    }
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
115
116
117
    /**
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
118
     * Get the number of items in the current short list.
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
119
     *
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
120
     * @param session The session to check & find a shortlist for.
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
121
     * @return mixed false if no session exists - else the number of items in the shortlist.
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
122
     * */
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
123
    public function shortListCount($session = false)
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
124
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
125
        if ($this->isSessionValid($session)) {
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
126
            return false;
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
127
        }
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
128
129
        $shortlist = $this->getSessionShortList();
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
130
131
        if (!$shortlist || !$shortlist->exists()) {
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
132
            return 0;
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
133
        }
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
134
135
        return $shortlist->Items()->count();
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
136
    }
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
137
138
    public static function getShortListSession()
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
139
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
140
        return DataObject::get_one('ShortList', $filter = array('SessionID' => self::getSecurityToken()));
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
141
    }
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
142
143
    /**
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
144
     * Get the token to use to add/remove from shortlist.
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
145
     * */
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
146
    public static function getSecurityToken()
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
147
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
148
        return Utilities::getSecurityToken();
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
149
    }
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
150
151
    /**
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
152
     * Determine the action based upon the url requested.
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
153
     * */
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
154
    private function determineAction($url)
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
155
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
156
        $matches = array();
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
157
        preg_match('/remove|add/', $url, $matches);
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
158
159
        switch ($matches[0]) {
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
160
            case 'remove':
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
161
                return new RemoveFromshortlistAction();
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
162
            case 'add':
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
163
                return new AddToshortlistAction();
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
164
            default:
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
165
                return null;
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
166
        }
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
167
    }
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
168
169
    /**
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
170
     * Return a valid shortlist - or null.
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
171
     * */
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
172
    private function getSessionShortList()
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
173
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
174
        return DataObject::get_one('ShortList',
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
175
            $filter = array('SessionID' => self::getSecurityToken()),
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
176
            $cache = false
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
177
        );
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
178
    }
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
179
180
    /**
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
181
     * Return the json encoded count & url for the current session
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
182
     * */
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
183
    private function renderAjax($session)
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
184
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
185
        $shortlist = $this->getSessionShortList();
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
186
        $url = false;
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
187
188
        if ($shortlist && $shortlist->exists()) {
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
189
            $url = $shortlist->Link();
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
190
        }
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
191
192
        return json_encode(array(
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
193
            'count' => $this->shortListCount($session),
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
194
            'url' => $url
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
195
        ));
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
196
    }
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
197
198
    /**
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
199
     * Don't render the template!
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
200
     * */
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
201
    private function dontRender($shortlist, $request)
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
202
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
203
        return is_null(self::getSecurityToken()) || !$request->param('URL') || !$shortlist || !$shortlist->exists();
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
204
    }
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
205
206
    /**
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
207
     * Is this session valid?
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
208
     * */
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
209
    private function isSessionValid($session)
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
210
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
211
        return is_null(self::getSecurityToken()) || !$session || $session != self::getSecurityToken();
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
212
    }
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
213
214
    /**
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
215
     * Don't perform an action.
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
216
     * */
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
217
    private function dontPerformAction($request)
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
218
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
219
        return is_null(self::getSecurityToken()) || !$request->getVar('id') || !$request->getVar('type') ||
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
220
            !$request->getVar('s') || $request->getVar('s') != self::getSecurityToken();
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
221
    }
0 ignored issues
show
introduced by
Tabs must be used to indent lines; spaces are not allowed
Loading history...
222
}
223