3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait MarkupTrait { /** * The safe string. * * @var string */ protected $string; /** * Creates a Markup object if necessary. * * If $string is equal to a blank string then it is not necessary to create a * Markup object. If $string is an object that implements MarkupInterface it * is returned unchanged. * * @param mixed $string * The string to mark as safe. This value will be cast to a string. * * @return string|\Drupal\Component\Render\MarkupInterface * A safe string. */ public static function create($string) { if ($string instanceof MarkupInterface) { return $string; } $string = (string) $string; if ($string === '') { return ''; } $safe_string = new static(); $safe_string->string = $string; return $safe_string; } } $markup = MarkupTrait::create('foo');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CpIhN
function name:  (null)
number of ops:  5
compiled vars:  !0 = $markup
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   39     0  E >   INIT_STATIC_METHOD_CALL                                  'MarkupTrait', 'create'
          1        SEND_VAL                                                 'foo'
          2        DO_FCALL                                      0  $1      
          3        ASSIGN                                                   !0, $1
          4      > RETURN                                                   1

Class MarkupTrait:
Function create:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 4
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 9
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CpIhN
function name:  create
number of ops:  16
compiled vars:  !0 = $string, !1 = $safe_string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   RECV                                             !0      
   26     1        INSTANCEOF                                               !0, 'MarkupInterface'
          2      > JMPZ                                                     ~2, ->4
   27     3    > > RETURN                                                   !0
   29     4    >   CAST                                          6  ~3      !0
          5        ASSIGN                                                   !0, ~3
   30     6        IS_IDENTICAL                                             !0, ''
          7      > JMPZ                                                     ~5, ->9
   31     8    > > RETURN                                                   ''
   33     9    >   NEW                          static              $6      
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !1, $6
   34    12        ASSIGN_OBJ                                               !1, 'string'
         13        OP_DATA                                                  !0
   35    14      > RETURN                                                   !1
   36    15*     > RETURN                                                   null

End of function create

End of class MarkupTrait.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
123.24 ms | 997 KiB | 13 Q