3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Blend\Model; use SebastianBergmann\Money\Money; abstract class MoneyFactory { public static function __callstatic($meth, array $args) { $meth = strtoupper($meth); if (!self::isValidCurrency($meth)) { throw new InvalidArgumentException("Unknown currency"); } if (!isset($args[0])) { throw new InvalidArgumentException("Missing amount"); } return new Money($args[0] * 100, new Currency($meth)); } private static function isValidCurrency($currency) { if (strlen($currency) != 3) { return false; } try { new Currency($currency); } catch (InvalidArgumentException $e) { return false; } return true; } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s3TE7
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E > > RETURN                                                   1

Class Blend\Model\MoneyFactory:
Function __callstatic:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 15
Branch analysis from position: 11
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 22
Branch analysis from position: 18
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s3TE7
function name:  __callstatic
number of ops:  33
compiled vars:  !0 = $meth, !1 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   10     2        INIT_NS_FCALL_BY_NAME                                    'Blend%5CModel%5Cstrtoupper'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $2      
          5        ASSIGN                                                   !0, $2
   11     6        INIT_STATIC_METHOD_CALL                                  'isValidCurrency'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0  $4      
          9        BOOL_NOT                                         ~5      $4
         10      > JMPZ                                                     ~5, ->15
   12    11    >   NEW                                              $6      'Blend%5CModel%5CInvalidArgumentException'
         12        SEND_VAL_EX                                              'Unknown+currency'
         13        DO_FCALL                                      0          
         14      > THROW                                         0          $6
   14    15    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~8      !1, 0
         16        BOOL_NOT                                         ~9      ~8
         17      > JMPZ                                                     ~9, ->22
   15    18    >   NEW                                              $10     'Blend%5CModel%5CInvalidArgumentException'
         19        SEND_VAL_EX                                              'Missing+amount'
         20        DO_FCALL                                      0          
         21      > THROW                                         0          $10
   17    22    >   NEW                                              $12     'SebastianBergmann%5CMoney%5CMoney'
         23        FETCH_DIM_R                                      ~13     !1, 0
         24        MUL                                              ~14     ~13, 100
         25        SEND_VAL_EX                                              ~14
         26        NEW                                              $15     'Blend%5CModel%5CCurrency'
         27        SEND_VAR_EX                                              !0
         28        DO_FCALL                                      0          
         29        SEND_VAR_NO_REF_EX                                       $15
         30        DO_FCALL                                      0          
         31      > RETURN                                                   $12
   18    32*     > RETURN                                                   null

End of function __callstatic

Function isvalidcurrency:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 12
Branch analysis from position: 12
2 jumps found. (Code = 107) Position 1 = 13, Position 2 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s3TE7
function name:  isValidCurrency
number of ops:  16
compiled vars:  !0 = $currency, !1 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
   22     1        INIT_NS_FCALL_BY_NAME                                    'Blend%5CModel%5Cstrlen'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $2      
          4        IS_NOT_EQUAL                                             $2, 3
          5      > JMPZ                                                     ~3, ->7
   23     6    > > RETURN                                                   <false>
   26     7    >   NEW                                              $4      'Blend%5CModel%5CCurrency'
          8        SEND_VAR_EX                                              !0
          9        DO_FCALL                                      0          
         10        FREE                                                     $4
         11      > JMP                                                      ->14
   27    12  E > > CATCH                                       last         'Blend%5CModel%5CInvalidArgumentException'
   28    13    > > RETURN                                                   <false>
   30    14    > > RETURN                                                   <true>
   31    15*     > RETURN                                                   null

End of function isvalidcurrency

End of class Blend\Model\MoneyFactory.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.78 ms | 1400 KiB | 17 Q