3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Qihoo\Controller\Decorator; use Beahoo\Controller\Request; use Beahoo\Controller\Response; /** * 前端JSONP回调函数装饰器 * * @package Qihoo\Controller\Decorator */ class CallbackDecorator extends \Beahoo\Controller\Decorator { /** * 执行 * * @param \Beahoo\Controller\Request $request * @param \Beahoo\Controller\Response $response * * @result void */ public function execute(Request $request, Response $response) { parent::execute($request, $response); $callback = $request->getQueryArg('callback'); if ($callback && preg_match('/^[\._a-z0-9]+$/i', $callback)) { $body = $response->getBody(); if (is_array($body)) { $body = json_encode($body); } $body = "{$callback}({$body})"; $response->setBody($body); } } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hEo4g
function name:  (null)
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   DECLARE_CLASS                                            'qihoo%5Ccontroller%5Cdecorator%5Ccallbackdecorator', 'beahoo%5Ccontroller%5Cdecorator'
   41     1      > RETURN                                                   1

Class Qihoo\Controller\Decorator\CallbackDecorator:
Function execute:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 11, Position 2 = 16
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 36
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 28
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
Branch analysis from position: 36
Branch analysis from position: 16
filename:       /in/hEo4g
function name:  execute
number of ops:  37
compiled vars:  !0 = $request, !1 = $response, !2 = $callback, !3 = $body
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   25     2        INIT_STATIC_METHOD_CALL                                  'execute'
          3        SEND_VAR_EX                                              !0
          4        SEND_VAR_EX                                              !1
          5        DO_FCALL                                      0          
   27     6        INIT_METHOD_CALL                                         !0, 'getQueryArg'
          7        SEND_VAL_EX                                              'callback'
          8        DO_FCALL                                      0  $5      
          9        ASSIGN                                                   !2, $5
   29    10      > JMPZ_EX                                          ~7      !2, ->16
         11    >   INIT_NS_FCALL_BY_NAME                                    'Qihoo%5CController%5CDecorator%5Cpreg_match'
         12        SEND_VAL_EX                                              '%2F%5E%5B%5C._a-z0-9%5D%2B%24%2Fi'
         13        SEND_VAR_EX                                              !2
         14        DO_FCALL                                      0  $8      
         15        BOOL                                             ~7      $8
         16    > > JMPZ                                                     ~7, ->36
   30    17    >   INIT_METHOD_CALL                                         !1, 'getBody'
         18        DO_FCALL                                      0  $9      
         19        ASSIGN                                                   !3, $9
   32    20        INIT_NS_FCALL_BY_NAME                                    'Qihoo%5CController%5CDecorator%5Cis_array'
         21        SEND_VAR_EX                                              !3
         22        DO_FCALL                                      0  $11     
         23      > JMPZ                                                     $11, ->28
   33    24    >   INIT_NS_FCALL_BY_NAME                                    'Qihoo%5CController%5CDecorator%5Cjson_encode'
         25        SEND_VAR_EX                                              !3
         26        DO_FCALL                                      0  $12     
         27        ASSIGN                                                   !3, $12
   36    28    >   ROPE_INIT                                     4  ~15     !2
         29        ROPE_ADD                                      1  ~15     ~15, '%28'
         30        ROPE_ADD                                      2  ~15     ~15, !3
         31        ROPE_END                                      3  ~14     ~15, '%29'
         32        ASSIGN                                                   !3, ~14
   38    33        INIT_METHOD_CALL                                         !1, 'setBody'
         34        SEND_VAR_EX                                              !3
         35        DO_FCALL                                      0          
   40    36    > > RETURN                                                   null

End of function execute

End of class Qihoo\Controller\Decorator\CallbackDecorator.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.01 ms | 1400 KiB | 19 Q