@@ -246,8 +246,7 @@ public function startup(Controller $controller) {
246
246
* @link http://book.cakephp.org/2.0/en/core-libraries/components/security-component.html#SecurityComponent::requirePost
247
247
*/
248
248
public function requirePost () {
249
- $ args = func_get_args ();
250
- $ this ->_requireMethod ('Post ' , $ args );
249
+ $ this ->_requireMethod ('Post ' , func_get_args ());
251
250
}
252
251
253
252
/**
@@ -256,8 +255,7 @@ public function requirePost() {
256
255
* @return void
257
256
*/
258
257
public function requireGet () {
259
- $ args = func_get_args ();
260
- $ this ->_requireMethod ('Get ' , $ args );
258
+ $ this ->_requireMethod ('Get ' , func_get_args ());
261
259
}
262
260
263
261
/**
@@ -266,8 +264,7 @@ public function requireGet() {
266
264
* @return void
267
265
*/
268
266
public function requirePut () {
269
- $ args = func_get_args ();
270
- $ this ->_requireMethod ('Put ' , $ args );
267
+ $ this ->_requireMethod ('Put ' , func_get_args ());
271
268
}
272
269
273
270
/**
@@ -276,8 +273,7 @@ public function requirePut() {
276
273
* @return void
277
274
*/
278
275
public function requireDelete () {
279
- $ args = func_get_args ();
280
- $ this ->_requireMethod ('Delete ' , $ args );
276
+ $ this ->_requireMethod ('Delete ' , func_get_args ());
281
277
}
282
278
283
279
/**
@@ -287,8 +283,7 @@ public function requireDelete() {
287
283
* @link http://book.cakephp.org/2.0/en/core-libraries/components/security-component.html#SecurityComponent::requireSecure
288
284
*/
289
285
public function requireSecure () {
290
- $ args = func_get_args ();
291
- $ this ->_requireMethod ('Secure ' , $ args );
286
+ $ this ->_requireMethod ('Secure ' , func_get_args ());
292
287
}
293
288
294
289
/**
@@ -298,8 +293,7 @@ public function requireSecure() {
298
293
* @link http://book.cakephp.org/2.0/en/core-libraries/components/security-component.html#SecurityComponent::requireAuth
299
294
*/
300
295
public function requireAuth () {
301
- $ args = func_get_args ();
302
- $ this ->_requireMethod ('Auth ' , $ args );
296
+ $ this ->_requireMethod ('Auth ' , func_get_args ());
303
297
}
304
298
305
299
/**
@@ -316,9 +310,8 @@ public function requireAuth() {
316
310
public function blackHole (Controller $ controller , $ error = '' ) {
317
311
if ($ this ->blackHoleCallback == null ) {
318
312
throw new BadRequestException (__d ('cake_dev ' , 'The request has been black-holed ' ));
319
- } else {
320
- return $ this ->_callback ($ controller , $ this ->blackHoleCallback , array ($ error ));
321
313
}
314
+ return $ this ->_callback ($ controller , $ this ->blackHoleCallback , array ($ error ));
322
315
}
323
316
324
317
/**
@@ -593,11 +586,10 @@ protected function _expireTokens($tokens) {
593
586
* @throws BadRequestException When a the blackholeCallback is not callable.
594
587
*/
595
588
protected function _callback (Controller $ controller , $ method , $ params = array ()) {
596
- if (is_callable (array ($ controller , $ method ))) {
597
- return call_user_func_array (array (&$ controller , $ method ), empty ($ params ) ? null : $ params );
598
- } else {
589
+ if (!is_callable (array ($ controller , $ method ))) {
599
590
throw new BadRequestException (__d ('cake_dev ' , 'The request has been black-holed ' ));
600
591
}
592
+ return call_user_func_array (array (&$ controller , $ method ), empty ($ params ) ? null : $ params );
601
593
}
602
594
603
595
}
0 commit comments