3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace ProjectInfinity\ReportRTS\command\sub; use pocketmine\command\CommandSender; use pocketmine\IPlayer; use ProjectInfinity\ReportRTS\ReportRTS; use ProjectInfinity\ReportRTS\util\MessageHandler; use ProjectInfinity\ReportRTS\util\PermissionHandler; use ProjectInfinity\ReportRTS\util\ToolBox; class AssignTicket { private $plugin; private $data; public function __construct(ReportRTS $plugin) { $this->plugin = $plugin; $this->data = $plugin->getDataProvider(); } public function handleCommand(CommandSender $sender, $args) { if(!$sender->hasPermission(PermissionHandler::canAssign)) { $sender->sendMessage(sprintf(MessageHandler::$permissionError, PermissionHandler::canAssign)); return true; } if(count($args) < 3) { $sender->sendMessage(sprintf(MessageHandler::$generalError, "You need to specify a ticket ID then a player.")); return true; } if(!ToolBox::isNumber($args[1])) { $sender->sendMessage(sprintf(MessageHandler::$generalError, "Ticket ID must be a number. Provided: ".$args[1])); return true; } $ticketId = intval($args[1]); if(!isset(ReportRTS::$tickets[$ticketId]) or ReportRTS::$tickets[$ticketId]->getStatus() == 1) { # The ticket that the user is trying to claim is not in the array or is already claimed (not open). $sender->sendMessage(MessageHandler::$ticketNotOpen); return true; } $user = $this->data->getUser($args[2]); if($user['id'] == 0) { # Try to get the player from files. $player = $this->plugin->getServer()->getOfflinePlayer($args[2]); if($player->getFirstPlayed() === null) { $sender->sendMessage(sprintf(MessageHandler::$userNotExists, $player->getName())); return true; } # Create the user since it does not exist but is online. $this->data->createUser($player->getName()); $user = $this->data->getUser($player->getName()); } $ticket = ReportRTS::$tickets[$args[1]]; $timestamp = round(microtime(true)); if($resultCode = $this->data->setTicketStatus($ticketId, $user['username'], 1, null, 0, $timestamp) and $resultCode != 1) { if($resultCode == -1) { # Username is invalid or does not exist. $sender->sendMessage(sprintf(MessageHandler::$userNotExists, $user['username'])); return true; } if($resultCode == -2) { # Ticket status incompatibilities. $sender->sendMessage(MessageHandler::$ticketStatusError); return true; } $sender->sendMessage(sprintf(MessageHandler::$generalError, "Unable to assign ticket #".$ticketId." to ".$args[2])); return true; } # Set ticket info in the ticket array too. $ticket->setStatus(1); $ticket->setStaffName($user['username']); $ticket->setStaffId($user['id']); $ticket->setStaffTimestamp($timestamp); ReportRTS::$tickets[$args[1]] = $ticket; $player = $this->plugin->getServer()->getPlayer($ticket->getName()); if($player != null) { $player->sendMessage(MessageHandler::$ticketAssignUser, $user['username']); $player->sendMessage(MessageHandler::$ticketClaimText, $ticket->getMessage()); } # Let staff know about this change. $this->plugin->messageStaff(sprintf(MessageHandler::$ticketAssign, $user['username'], $ticketId)); return true; } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6qKud
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   99     0  E > > RETURN                                                   1

Class ProjectInfinity\ReportRTS\command\sub\AssignTicket:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6qKud
function name:  __construct
number of ops:  8
compiled vars:  !0 = $plugin
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   18     1        ASSIGN_OBJ                                               'plugin'
          2        OP_DATA                                                  !0
   19     3        INIT_METHOD_CALL                                         !0, 'getDataProvider'
          4        DO_FCALL                                      0  $3      
          5        ASSIGN_OBJ                                               'data'
          6        OP_DATA                                                  $3
   20     7      > RETURN                                                   null

End of function __construct

Function handlecommand:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 19
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 34
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 41, Position 2 = 53
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 53
2 jumps found. (Code = 47) Position 1 = 63, Position 2 = 69
Branch analysis from position: 63
2 jumps found. (Code = 43) Position 1 = 70, Position 2 = 76
Branch analysis from position: 70
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 76
2 jumps found. (Code = 43) Position 1 = 86, Position 2 = 124
Branch analysis from position: 86
2 jumps found. (Code = 43) Position 1 = 99, Position 2 = 111
Branch analysis from position: 99
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 111
2 jumps found. (Code = 46) Position 1 = 148, Position 2 = 150
Branch analysis from position: 148
2 jumps found. (Code = 43) Position 1 = 151, Position 2 = 187
Branch analysis from position: 151
2 jumps found. (Code = 43) Position 1 = 153, Position 2 = 165
Branch analysis from position: 153
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 165
2 jumps found. (Code = 43) Position 1 = 167, Position 2 = 173
Branch analysis from position: 167
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 173
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 187
2 jumps found. (Code = 43) Position 1 = 218, Position 2 = 234
Branch analysis from position: 218
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 234
Branch analysis from position: 150
Branch analysis from position: 124
Branch analysis from position: 69
filename:       /in/6qKud
function name:  handleCommand
number of ops:  249
compiled vars:  !0 = $sender, !1 = $args, !2 = $ticketId, !3 = $user, !4 = $player, !5 = $ticket, !6 = $timestamp, !7 = $resultCode
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   24     2        INIT_METHOD_CALL                                         !0, 'hasPermission'
          3        FETCH_CLASS_CONSTANT                             ~8      'ProjectInfinity%5CReportRTS%5Cutil%5CPermissionHandler', 'canAssign'
          4        SEND_VAL_EX                                              ~8
          5        DO_FCALL                                      0  $9      
          6        BOOL_NOT                                         ~10     $9
          7      > JMPZ                                                     ~10, ->19
   25     8    >   INIT_METHOD_CALL                                         !0, 'sendMessage'
          9        INIT_NS_FCALL_BY_NAME                                    'ProjectInfinity%5CReportRTS%5Ccommand%5Csub%5Csprintf'
         10        CHECK_FUNC_ARG                                           
         11        FETCH_STATIC_PROP_FUNC_ARG   unknown             $11     'permissionError'
         12        SEND_FUNC_ARG                                            $11
         13        FETCH_CLASS_CONSTANT                             ~12     'ProjectInfinity%5CReportRTS%5Cutil%5CPermissionHandler', 'canAssign'
         14        SEND_VAL_EX                                              ~12
         15        DO_FCALL                                      0  $13     
         16        SEND_VAR_NO_REF_EX                                       $13
         17        DO_FCALL                                      0          
   26    18      > RETURN                                                   <true>
   29    19    >   INIT_NS_FCALL_BY_NAME                                    'ProjectInfinity%5CReportRTS%5Ccommand%5Csub%5Ccount'
         20        SEND_VAR_EX                                              !1
         21        DO_FCALL                                      0  $15     
         22        IS_SMALLER                                               $15, 3
         23      > JMPZ                                                     ~16, ->34
   30    24    >   INIT_METHOD_CALL                                         !0, 'sendMessage'
         25        INIT_NS_FCALL_BY_NAME                                    'ProjectInfinity%5CReportRTS%5Ccommand%5Csub%5Csprintf'
         26        CHECK_FUNC_ARG                                           
         27        FETCH_STATIC_PROP_FUNC_ARG   unknown             $17     'generalError'
         28        SEND_FUNC_ARG                                            $17
         29        SEND_VAL_EX                                              'You+need+to+specify+a+ticket+ID+then+a+player.'
         30        DO_FCALL                                      0  $18     
         31        SEND_VAR_NO_REF_EX                                       $18
         32        DO_FCALL                                      0          
   31    33      > RETURN                                                   <true>
   34    34    >   INIT_STATIC_METHOD_CALL                                  'ProjectInfinity%5CReportRTS%5Cutil%5CToolBox', 'isNumber'
         35        CHECK_FUNC_ARG                                           
         36        FETCH_DIM_FUNC_ARG                               $20     !1, 1
         37        SEND_FUNC_ARG                                            $20
         38        DO_FCALL                                      0  $21     
         39        BOOL_NOT                                         ~22     $21
         40      > JMPZ                                                     ~22, ->53
   35    41    >   INIT_METHOD_CALL                                         !0, 'sendMessage'
         42        INIT_NS_FCALL_BY_NAME                                    'ProjectInfinity%5CReportRTS%5Ccommand%5Csub%5Csprintf'
         43        CHECK_FUNC_ARG                                           
         44        FETCH_STATIC_PROP_FUNC_ARG   unknown             $23     'generalError'
         45        SEND_FUNC_ARG                                            $23
         46        FETCH_DIM_R                                      ~24     !1, 1
         47        CONCAT                                           ~25     'Ticket+ID+must+be+a+number.+Provided%3A+', ~24
         48        SEND_VAL_EX                                              ~25
         49        DO_FCALL                                      0  $26     
         50        SEND_VAR_NO_REF_EX                                       $26
         51        DO_FCALL                                      0          
   36    52      > RETURN                                                   <true>
   39    53    >   INIT_NS_FCALL_BY_NAME                                    'ProjectInfinity%5CReportRTS%5Ccommand%5Csub%5Cintval'
         54        CHECK_FUNC_ARG                                           
         55        FETCH_DIM_FUNC_ARG                               $28     !1, 1
         56        SEND_FUNC_ARG                                            $28
         57        DO_FCALL                                      0  $29     
         58        ASSIGN                                                   !2, $29
   41    59        FETCH_STATIC_PROP_IS                             ~31     'tickets', 'ProjectInfinity%5CReportRTS%5CReportRTS'
         60        ISSET_ISEMPTY_DIM_OBJ                         0  ~32     ~31, !2
         61        BOOL_NOT                                         ~33     ~32
         62      > JMPNZ_EX                                         ~33     ~33, ->69
         63    >   FETCH_STATIC_PROP_R          unknown             ~34     'tickets'
         64        FETCH_DIM_R                                      ~35     ~34, !2
         65        INIT_METHOD_CALL                                         ~35, 'getStatus'
         66        DO_FCALL                                      0  $36     
         67        IS_EQUAL                                         ~37     $36, 1
         68        BOOL                                             ~33     ~37
         69    > > JMPZ                                                     ~33, ->76
   43    70    >   INIT_METHOD_CALL                                         !0, 'sendMessage'
         71        CHECK_FUNC_ARG                                           
         72        FETCH_STATIC_PROP_FUNC_ARG   unknown             $38     'ticketNotOpen'
         73        SEND_FUNC_ARG                                            $38
         74        DO_FCALL                                      0          
   44    75      > RETURN                                                   <true>
   46    76    >   FETCH_OBJ_R                                      ~40     'data'
         77        INIT_METHOD_CALL                                         ~40, 'getUser'
         78        CHECK_FUNC_ARG                                           
         79        FETCH_DIM_FUNC_ARG                               $41     !1, 2
         80        SEND_FUNC_ARG                                            $41
         81        DO_FCALL                                      0  $42     
         82        ASSIGN                                                   !3, $42
   48    83        FETCH_DIM_R                                      ~44     !3, 'id'
         84        IS_EQUAL                                                 ~44, 0
         85      > JMPZ                                                     ~45, ->124
   50    86    >   FETCH_OBJ_R                                      ~46     'plugin'
         87        INIT_METHOD_CALL                                         ~46, 'getServer'
         88        DO_FCALL                                      0  $47     
         89        INIT_METHOD_CALL                                         $47, 'getOfflinePlayer'
         90        CHECK_FUNC_ARG                                           
         91        FETCH_DIM_FUNC_ARG                               $48     !1, 2
         92        SEND_FUNC_ARG                                            $48
         93        DO_FCALL                                      0  $49     
         94        ASSIGN                                                   !4, $49
   52    95        INIT_METHOD_CALL                                         !4, 'getFirstPlayed'
         96        DO_FCALL                                      0  $51     
         97        TYPE_CHECK                                    2          $51
         98      > JMPZ                                                     ~52, ->111
   53    99    >   INIT_METHOD_CALL                                         !0, 'sendMessage'
        100        INIT_NS_FCALL_BY_NAME                                    'ProjectInfinity%5CReportRTS%5Ccommand%5Csub%5Csprintf'
        101        CHECK_FUNC_ARG                                           
        102        FETCH_STATIC_PROP_FUNC_ARG   unknown             $53     'userNotExists'
        103        SEND_FUNC_ARG                                            $53
        104        INIT_METHOD_CALL                                         !4, 'getName'
        105        DO_FCALL                                      0  $54     
        106        SEND_VAR_NO_REF_EX                                       $54
        107        DO_FCALL                                      0  $55     
        108        SEND_VAR_NO_REF_EX                                       $55
        109        DO_FCALL                                      0          
   54   110      > RETURN                                                   <true>
   57   111    >   FETCH_OBJ_R                                      ~57     'data'
        112        INIT_METHOD_CALL                                         ~57, 'createUser'
        113        INIT_METHOD_CALL                                         !4, 'getName'
        114        DO_FCALL                                      0  $58     
        115        SEND_VAR_NO_REF_EX                                       $58
        116        DO_FCALL                                      0          
   58   117        FETCH_OBJ_R                                      ~60     'data'
        118        INIT_METHOD_CALL                                         ~60, 'getUser'
        119        INIT_METHOD_CALL                                         !4, 'getName'
        120        DO_FCALL                                      0  $61     
        121        SEND_VAR_NO_REF_EX                                       $61
        122        DO_FCALL                                      0  $62     
        123        ASSIGN                                                   !3, $62
   61   124    >   FETCH_DIM_R                                      ~65     !1, 1
        125        FETCH_STATIC_PROP_R          unknown             ~64     'tickets'
        126        FETCH_DIM_R                                      ~66     ~64, ~65
        127        ASSIGN                                                   !5, ~66
   63   128        INIT_NS_FCALL_BY_NAME                                    'ProjectInfinity%5CReportRTS%5Ccommand%5Csub%5Cround'
        129        INIT_NS_FCALL_BY_NAME                                    'ProjectInfinity%5CReportRTS%5Ccommand%5Csub%5Cmicrotime'
        130        SEND_VAL_EX                                              <true>
        131        DO_FCALL                                      0  $68     
        132        SEND_VAR_NO_REF_EX                                       $68
        133        DO_FCALL                                      0  $69     
        134        ASSIGN                                                   !6, $69
   65   135        FETCH_OBJ_R                                      ~71     'data'
        136        INIT_METHOD_CALL                                         ~71, 'setTicketStatus'
        137        SEND_VAR_EX                                              !2
        138        CHECK_FUNC_ARG                                           
        139        FETCH_DIM_FUNC_ARG                               $72     !3, 'username'
        140        SEND_FUNC_ARG                                            $72
        141        SEND_VAL_EX                                              1
        142        SEND_VAL_EX                                              null
        143        SEND_VAL_EX                                              0
        144        SEND_VAR_EX                                              !6
        145        DO_FCALL                                      0  $73     
        146        ASSIGN                                           ~74     !7, $73
        147      > JMPZ_EX                                          ~74     ~74, ->150
        148    >   IS_NOT_EQUAL                                     ~75     !7, 1
        149        BOOL                                             ~74     ~75
        150    > > JMPZ                                                     ~74, ->187
   67   151    >   IS_EQUAL                                                 !7, -1
        152      > JMPZ                                                     ~76, ->165
   69   153    >   INIT_METHOD_CALL                                         !0, 'sendMessage'
        154        INIT_NS_FCALL_BY_NAME                                    'ProjectInfinity%5CReportRTS%5Ccommand%5Csub%5Csprintf'
        155        CHECK_FUNC_ARG                                           
        156        FETCH_STATIC_PROP_FUNC_ARG   unknown             $77     'userNotExists'
        157        SEND_FUNC_ARG                                            $77
        158        CHECK_FUNC_ARG                                           
        159        FETCH_DIM_FUNC_ARG                               $78     !3, 'username'
        160        SEND_FUNC_ARG                                            $78
        161        DO_FCALL                                      0  $79     
        162        SEND_VAR_NO_REF_EX                                       $79
        163        DO_FCALL                                      0          
   70   164      > RETURN                                                   <true>
   72   165    >   IS_EQUAL                                                 !7, -2
        166      > JMPZ                                                     ~81, ->173
   74   167    >   INIT_METHOD_CALL                                         !0, 'sendMessage'
        168        CHECK_FUNC_ARG                                           
        169        FETCH_STATIC_PROP_FUNC_ARG   unknown             $82     'ticketStatusError'
        170        SEND_FUNC_ARG                                            $82
        171        DO_FCALL                                      0          
   75   172      > RETURN                                                   <true>
   77   173    >   INIT_METHOD_CALL                                         !0, 'sendMessage'
        174        INIT_NS_FCALL_BY_NAME                                    'ProjectInfinity%5CReportRTS%5Ccommand%5Csub%5Csprintf'
        175        CHECK_FUNC_ARG                                           
        176        FETCH_STATIC_PROP_FUNC_ARG   unknown             $84     'generalError'
        177        SEND_FUNC_ARG                                            $84
        178        CONCAT                                           ~85     'Unable+to+assign+ticket+%23', !2
        179        CONCAT                                           ~86     ~85, '+to+'
        180        FETCH_DIM_R                                      ~87     !1, 2
        181        CONCAT                                           ~88     ~86, ~87
        182        SEND_VAL_EX                                              ~88
        183        DO_FCALL                                      0  $89     
        184        SEND_VAR_NO_REF_EX                                       $89
        185        DO_FCALL                                      0          
   78   186      > RETURN                                                   <true>
   82   187    >   INIT_METHOD_CALL                                         !5, 'setStatus'
        188        SEND_VAL_EX                                              1
        189        DO_FCALL                                      0          
   83   190        INIT_METHOD_CALL                                         !5, 'setStaffName'
        191        CHECK_FUNC_ARG                                           
        192        FETCH_DIM_FUNC_ARG                               $92     !3, 'username'
        193        SEND_FUNC_ARG                                            $92
        194        DO_FCALL                                      0          
   84   195        INIT_METHOD_CALL                                         !5, 'setStaffId'
        196        CHECK_FUNC_ARG                                           
        197        FETCH_DIM_FUNC_ARG                               $94     !3, 'id'
        198        SEND_FUNC_ARG                                            $94
        199        DO_FCALL                                      0          
   85   200        INIT_METHOD_CALL                                         !5, 'setStaffTimestamp'
        201        SEND_VAR_EX                                              !6
        202        DO_FCALL                                      0          
   86   203        FETCH_DIM_R                                      ~98     !1, 1
        204        FETCH_STATIC_PROP_W          unknown             $97     'tickets'
        205        ASSIGN_DIM                                               $97, ~98
        206        OP_DATA                                                  !5
   88   207        FETCH_OBJ_R                                      ~100    'plugin'
        208        INIT_METHOD_CALL                                         ~100, 'getServer'
        209        DO_FCALL                                      0  $101    
        210        INIT_METHOD_CALL                                         $101, 'getPlayer'
        211        INIT_METHOD_CALL                                         !5, 'getName'
        212        DO_FCALL                                      0  $102    
        213        SEND_VAR_NO_REF_EX                                       $102
        214        DO_FCALL                                      0  $103    
        215        ASSIGN                                                   !4, $103
   89   216        IS_NOT_EQUAL                                             !4, null
        217      > JMPZ                                                     ~105, ->234
   90   218    >   INIT_METHOD_CALL                                         !4, 'sendMessage'
        219        CHECK_FUNC_ARG                                           
        220        FETCH_STATIC_PROP_FUNC_ARG   unknown             $106    'ticketAssignUser'
        221        SEND_FUNC_ARG                                            $106
        222        CHECK_FUNC_ARG                                           
        223        FETCH_DIM_FUNC_ARG                               $107    !3, 'username'
        224        SEND_FUNC_ARG                                            $107
        225        DO_FCALL                                      0          
   91   226        INIT_METHOD_CALL                                         !4, 'sendMessage'
        227        CHECK_FUNC_ARG                                           
        228        FETCH_STATIC_PROP_FUNC_ARG   unknown             $109    'ticketClaimText'
        229        SEND_FUNC_ARG                                            $109
        230        INIT_METHOD_CALL                                         !5, 'getMessage'
        231        DO_FCALL                                      0  $110    
        232        SEND_VAR_NO_REF_EX                                       $110
        233        DO_FCALL                                      0          
   95   234    >   FETCH_OBJ_R                                      ~112    'plugin'
        235        INIT_METHOD_CALL                                         ~112, 'messageStaff'
        236        INIT_NS_FCALL_BY_NAME                                    'ProjectInfinity%5CReportRTS%5Ccommand%5Csub%5Csprintf'
        237        CHECK_FUNC_ARG                                           
        238        FETCH_STATIC_PROP_FUNC_ARG   unknown             $113    'ticketAssign'
        239        SEND_FUNC_ARG                                            $113
        240        CHECK_FUNC_ARG                                           
        241        FETCH_DIM_FUNC_ARG                               $114    !3, 'username'
        242        SEND_FUNC_ARG                                            $114
        243        SEND_VAR_EX                                              !2
        244        DO_FCALL                                      0  $115    
        245        SEND_VAR_NO_REF_EX                                       $115
        246        DO_FCALL                                      0          
   97   247      > RETURN                                                   <true>
   98   248*     > RETURN                                                   null

End of function handlecommand

End of class ProjectInfinity\ReportRTS\command\sub\AssignTicket.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.78 ms | 965 KiB | 24 Q