3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * @package at.app * @version 0.3[20151212] * @author Adrian <adrian@enspi.red> * @copyright 2014 - 2015 * @license GNU GPL V2 <http://gnu.org/licenses/gpl-2.0.txt> */ declare( strict_types = 1 ); namespace at\simple\app; use at\simple\app\api\modelable as modelableAPI; /** * base implementation of modelableAPI. * * concrete classes may define getter methods for any string <offset>, * with the following signature: * get<offset>( void ) : mixed * * concrete classes may define setter methods for any string <offset>, * with the following signature: * set<offset>( mixed $value ) : void * * concrete classes may define unsetter methods for any string <offset>, * with the following signature: * unset<offset>( void ) : void * * concrete classes may define validator methods for any string <offset>, * with the following signature: * validate<offset>( mixed $value, bool $throw ) : bool * any <offset> with a validator method must either be a literal offset, * or have a corresponding set<offset> method (@see self::offsetSet()). * if the $throw argument is TRUE, and validation fails, * the validator method must throw a DomainException. */ abstract class DomainModel extends \SPLFixedArray implements modelableAPI { /** * @const array literal property name => default value map. * if no default is specified for a property, null will be used. */ const DATA = []; /** * @const array|null list of enumerable offsets. * if null, defaults to PROP. */ const ENUM = null; /** * @const array|null list of json-serializable offsets. * if null, defaults to ENUM. */ const JSON = null; /** * @const array list of identifiable literal properties. */ const KEYS = []; /** * @const array literal property name => index map. */ const PROP = []; /** * @const array literal property name => type (data type|classname) map. */ const TYPE = []; /** * @type array runtime list of enumerable properties. */ private $_enum = []; /** * @see <http://php.net/SPLFixedArray.fromArray> */ public static function fromArray( array $array ) { return static::from_array( $array ); } /** * @see modelableAPI::from_array() */ public static function from_array( array $data ) : modelableAPI { $dataObject = new static; foreach( $array as $prop => $value ) { $dataObject->offsetSet( $prop, $value ); } return $dataObject; } public function __construct() { parent::__construct( count( self::PROP ) ); foreach( static::DATA as $prop => $default ) { $this->offsetSet( $prop, $default ); } $this->_enum = static::ENUM ?? array_keys( static::PROP ); } /** * @see <http://php.net/Iterator.current> */ public function current() { return $this->offsetGet( current( $this->_enum ) ); } /** * @see modelableAPI::getDefaults() */ public function getDefaults() : array { return static::DATA; } /** * @see modelableAPI::getKeys() */ public function getKeys() : array { $keys = []; foreach( static::KEYS as $key ) { $keys[$key] = $this->offsetGet( $key ); } return $keys; } /** * @see modelableAPI::getProperties() */ public function getProperties() : array { return $this->_enum; } /** * @see modealableAPI::getTypes() */ public function getTypes() : array { return static::TYPE; } /** * @see <http://php.net/jsonSerializable.jsonSerialize> */ public function jsonSerialize() { $props = static::JSON ?? $this->_enum; $jsonable = []; foreach( $props as $prop ) { $jsonable[$prop] = $this->offsetGet( $prop ); } return $jsonable; } /** * @see <http://php.net/Iterator.key> */ public function key() { return current( $this->_enum ); } /** * @see <http://php.net/Iterator.next> */ public function next() { next( $this->_enum ); } /** * @see <http://php.net/ArrayAccess.offsetExists> */ public function offsetExists( $offset ) { return ( method_exists( [$this, "get{$offset}"] ) || method_exists( [$this, "set{$offset}"] ) || isset( self::PROP[$offset] ) ); } /** * @see <http://php.net/ArrayAccess.offsetGet> * * @throws UnderflowException if offset does not exist or is not readable */ public function offsetGet( $offset ) { if( ! is_string( $offset ) ) { $t = gettype( $offset ); $m = "\$offset must be a string, [{$t}] provided"; throw new \InvalidArgumentException( $m, E_USER_WARNING ); } if( method_exists( [$this, "get{$offset}"] ) ) { return $this->{"get{$offset}"}(); } if( isset( self::PROP[$offset] ) ) { return parent::offsetGet( self::PROP[$offset] ); } $m = "no readable property [{$offset}]"; throw new \UnderflowException( $m, E_USER_WARNING ); } /** * @see <http://php.net/ArrayAccess.offsetSet> * * @throws DomainException if validation fails * @throws OverflowException if offset does not exist or is not settable */ public function offsetSet( $offset, $value ) { $this->offsetValid( $offset, $value, true ); if( method_exists( [$this, "set{$offset}"] ) ) { return $this->{"set{$offset}"}( $value ); } if( isset( self::PROP[$offset] ) ) { return parent::offsetSet( self::PROP[$offset], $value ); } $m = "no setable property [{$offset}]"; throw new \OverflowException( $m, E_USER_WARNING ); } /** * @see <http://php.net/ArrayAccess.offsetUnset> * * @throws UnderflowException if offset does not exist or is not unsettable */ public function offsetUnset( $offset ) { if( ! is_string( $offset ) ) { $t = gettype( $offset ); $m = "\$offset must be a string, [{$t}] provided"; throw new \InvalidArgumentException( $m, E_USER_WARNING ); } if( method_exists( [$this, "unset{$offset}"] ) ) { $this->{"unset{$offset}"}( $value ); } // props with non-null default values are required (cannot be unset) if( isset( static::PROP[$offset] ) && ! isset( static::DATA[$offset] ) ) { parent::offsetUnset( self::PROP[$offset], $value ); } $m = "no unsetable property [{$offset}]"; throw new \UnderflowException( $m, E_USER_WARNING ); } /** * @see modelableAPI::offsetValid() */ public function offsetValid( string $offset, $value, bool $throw=false ) : bool { if( ! $this->offsetExists( $offset ) ) { $m = "no offset [{$offset}] exists"; throw new \OverflowException( $m, E_USER_WARNING ); } $class = static::TYPE[$offset]; if( (! isset( static::TYPE[$offset] )) || ($value instanceof $class || gettype( $value ) === static::TYPE[$offset]) ) { if( (! method_exists( [$this, "validate{$offset}"] )) || $this->{"validate{$offset}"}( $value ) ) { return true; } } if( $throw ){ $m = "invalid value for property [{$offset}]"; throw new \DomainException( $m, E_USER_NOTICE ); } return false; } /** * @see <http://php.net/Iterator.rewind> */ public function rewind() { reset( $this->_enum ); } /** * @see <http://php.net/serializable.serialize> */ public function serialize() { return serialize( parent::toArray() ); } /** nope. */ public function setSize( $size ) {} /** * @see modelableAPI::toArray() */ public function toArray() : array { $enumerable = []; foreach( $this->_enum as $prop ) { $enumerable[$prop] = $this->offsetGet( $prop ); } return $enumerable; } /** * @see <http://php.net/serializable.unserialize> */ public function unserialize( $serialized ) { $props = unserialize( $serialized ); if( ! (is_array( $props ) && (count( $props ) === count( static::PROP ))) ) { $m = '$serialized is not valid property data'; throw new \InvalidArgumentException( $m, E_USER_ERROR ); } $this->__construct(); foreach( (array) unserialize( $serialized ) as $index => $value ) { $offset = array_search( $index, static::PROP ); $this->offsetSet( $offset, $value ); } } /** * @see <http://php.net/Iterator.valid> */ public function valid() { return $this->offsetExists( current( $this->_enum ) ); } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CCc5v
function name:  (null)
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   38     0  E >   DECLARE_CLASS                                            'at%5Csimple%5Capp%5Cdomainmodel', 'splfixedarray'
  315     1      > RETURN                                                   1

Class at\simple\app\DomainModel:
Function fromarray:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CCc5v
function name:  fromArray
number of ops:  6
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   76     0  E >   RECV                                             !0      
   77     1        INIT_STATIC_METHOD_CALL                                  'from_array'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4      > RETURN                                                   $1
   78     5*     > RETURN                                                   null

End of function fromarray

Function from_array:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 12
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 12
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/CCc5v
function name:  from_array
number of ops:  17
compiled vars:  !0 = $data, !1 = $dataObject, !2 = $array, !3 = $value, !4 = $prop
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   82     0  E >   RECV                                             !0      
   83     1        NEW                          static              $5      
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $5
   85     4      > FE_RESET_R                                       $8      !2, ->12
          5    > > FE_FETCH_R                                       ~9      $8, !3, ->12
          6    >   ASSIGN                                                   !4, ~9
   86     7        INIT_METHOD_CALL                                         !1, 'offsetSet'
          8        SEND_VAR_EX                                              !4
          9        SEND_VAR_EX                                              !3
         10        DO_FCALL                                      0          
   85    11      > JMP                                                      ->5
         12    >   FE_FREE                                                  $8
   88    13        VERIFY_RETURN_TYPE                                       !1
         14      > RETURN                                                   !1
   89    15*       VERIFY_RETURN_TYPE                                       
         16*     > RETURN                                                   null

End of function from_array

Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 16
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 16
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/CCc5v
function name:  __construct
number of ops:  27
compiled vars:  !0 = $default, !1 = $prop
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   92     0  E >   INIT_STATIC_METHOD_CALL                                  
          1        INIT_NS_FCALL_BY_NAME                                    'at%5Csimple%5Capp%5Ccount'
          2        FETCH_CLASS_CONSTANT                             ~2      'PROP'
          3        SEND_VAL_EX                                              ~2
          4        DO_FCALL                                      0  $3      
          5        SEND_VAR_NO_REF_EX                                       $3
          6        DO_FCALL                                      0          
   94     7        FETCH_CLASS_CONSTANT                             ~5      'DATA'
          8      > FE_RESET_R                                       $6      ~5, ->16
          9    > > FE_FETCH_R                                       ~7      $6, !0, ->16
         10    >   ASSIGN                                                   !1, ~7
   95    11        INIT_METHOD_CALL                                         'offsetSet'
         12        SEND_VAR_EX                                              !1
         13        SEND_VAR_EX                                              !0
         14        DO_FCALL                                      0          
   94    15      > JMP                                                      ->9
         16    >   FE_FREE                                                  $6
   98    17        FETCH_CLASS_CONSTANT                             ~11     'ENUM'
         18        COALESCE                                         ~12     ~11
   99    19        INIT_NS_FCALL_BY_NAME                                    'at%5Csimple%5Capp%5Carray_keys'
         20        FETCH_CLASS_CONSTANT                             ~13     'PROP'
         21        SEND_VAL_EX                                              ~13
         22        DO_FCALL                                      0  $14     
         23        QM_ASSIGN                                        ~12     $14
   98    24        ASSIGN_OBJ                                               '_enum'
   99    25        OP_DATA                                                  ~12
  100    26      > RETURN                                                   null

End of function __construct

Function current:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CCc5v
function name:  current
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  105     0  E >   INIT_METHOD_CALL                                         'offsetGet'
          1        INIT_NS_FCALL_BY_NAME                                    'at%5Csimple%5Capp%5Ccurrent'
          2        CHECK_FUNC_ARG                                           
          3        FETCH_OBJ_FUNC_ARG                               $0      '_enum'
          4        SEND_FUNC_ARG                                            $0
          5        DO_FCALL                                      0  $1      
          6        SEND_VAR_NO_REF_EX                                       $1
          7        DO_FCALL                                      0  $2      
          8      > RETURN                                                   $2
  106     9*     > RETURN                                                   null

End of function current

Function getdefaults:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CCc5v
function name:  getDefaults
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  111     0  E >   FETCH_CLASS_CONSTANT                             ~0      'DATA'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
  112     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function getdefaults

Function getkeys:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 10
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 10
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/CCc5v
function name:  getKeys
number of ops:  15
compiled vars:  !0 = $keys, !1 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  117     0  E >   ASSIGN                                                   !0, <array>
  118     1        FETCH_CLASS_CONSTANT                             ~3      'KEYS'
          2      > FE_RESET_R                                       $4      ~3, ->10
          3    > > FE_FETCH_R                                               $4, !1, ->10
  119     4    >   INIT_METHOD_CALL                                         'offsetGet'
          5        SEND_VAR_EX                                              !1
          6        DO_FCALL                                      0  $6      
          7        ASSIGN_DIM                                               !0, !1
          8        OP_DATA                                                  $6
  118     9      > JMP                                                      ->3
         10    >   FE_FREE                                                  $4
  121    11        VERIFY_RETURN_TYPE                                       !0
         12      > RETURN                                                   !0
  122    13*       VERIFY_RETURN_TYPE                                       
         14*     > RETURN                                                   null

End of function getkeys

Function getproperties:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CCc5v
function name:  getProperties
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  127     0  E >   FETCH_OBJ_R                                      ~0      '_enum'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
  128     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function getproperties

Function gettypes:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CCc5v
function name:  getTypes
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  133     0  E >   FETCH_CLASS_CONSTANT                             ~0      'TYPE'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
  134     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function gettypes

Function jsonserialize:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 14
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 14
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/CCc5v
function name:  jsonSerialize
number of ops:  17
compiled vars:  !0 = $props, !1 = $jsonable, !2 = $prop
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  139     0  E >   FETCH_CLASS_CONSTANT                             ~3      'JSON'
          1        COALESCE                                         ~4      ~3
  140     2        FETCH_OBJ_R                                      ~5      '_enum'
          3        QM_ASSIGN                                        ~4      ~5
  139     4        ASSIGN                                                   !0, ~4
  142     5        ASSIGN                                                   !1, <array>
  143     6      > FE_RESET_R                                       $8      !0, ->14
          7    > > FE_FETCH_R                                               $8, !2, ->14
  144     8    >   INIT_METHOD_CALL                                         'offsetGet'
          9        SEND_VAR_EX                                              !2
         10        DO_FCALL                                      0  $10     
         11        ASSIGN_DIM                                               !1, !2
         12        OP_DATA                                                  $10
  143    13      > JMP                                                      ->7
         14    >   FE_FREE                                                  $8
  146    15      > RETURN                                                   !1
  147    16*     > RETURN                                                   null

End of function jsonserialize

Function key:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CCc5v
function name:  key
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  152     0  E >   INIT_NS_FCALL_BY_NAME                                    'at%5Csimple%5Capp%5Ccurrent'
          1        CHECK_FUNC_ARG                                           
          2        FETCH_OBJ_FUNC_ARG                               $0      '_enum'
          3        SEND_FUNC_ARG                                            $0
          4        DO_FCALL                                      0  $1      
          5      > RETURN                                                   $1
  153     6*     > RETURN                                                   null

End of function key

Function next:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CCc5v
function name:  next
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  158     0  E >   INIT_NS_FCALL_BY_NAME                                    'at%5Csimple%5Capp%5Cnext'
          1        CHECK_FUNC_ARG                                           
          2        FETCH_OBJ_FUNC_ARG                               $0      '_enum'
          3        SEND_FUNC_ARG                                            $0
          4        DO_FCALL                                      0          
  159     5      > RETURN                                                   null

End of function next

Function offsetexists:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 10, Position 2 = 19
Branch analysis from position: 10
2 jumps found. (Code = 47) Position 1 = 20, Position 2 = 23
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
Branch analysis from position: 19
filename:       /in/CCc5v
function name:  offsetExists
number of ops:  25
compiled vars:  !0 = $offset
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  163     0  E >   RECV                                             !0      
  165     1        INIT_NS_FCALL_BY_NAME                                    'at%5Csimple%5Capp%5Cmethod_exists'
          2        FETCH_THIS                                       ~1      
          3        INIT_ARRAY                                       ~2      ~1
          4        NOP                                                      
          5        FAST_CONCAT                                      ~3      'get', !0
          6        ADD_ARRAY_ELEMENT                                ~2      ~3
          7        SEND_VAL_EX                                              ~2
          8        DO_FCALL                                      0  $4      
          9      > JMPNZ_EX                                         ~5      $4, ->19
  166    10    >   INIT_NS_FCALL_BY_NAME                                    'at%5Csimple%5Capp%5Cmethod_exists'
         11        FETCH_THIS                                       ~6      
         12        INIT_ARRAY                                       ~7      ~6
         13        NOP                                                      
         14        FAST_CONCAT                                      ~8      'set', !0
         15        ADD_ARRAY_ELEMENT                                ~7      ~8
         16        SEND_VAL_EX                                              ~7
         17        DO_FCALL                                      0  $9      
         18        BOOL                                             ~5      $9
         19    > > JMPNZ_EX                                         ~5      ~5, ->23
  167    20    >   FETCH_CLASS_CONSTANT                             ~10     'PROP'
         21        ISSET_ISEMPTY_DIM_OBJ                         0  ~11     ~10, !0
         22        BOOL                                             ~5      ~11
         23    > > RETURN                                                   ~5
  169    24*     > RETURN                                                   null

End of function offsetexists

Function offsetget:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 20
Branch analysis from position: 6
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 34
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 44
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 44
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/CCc5v
function name:  offsetGet
number of ops:  55
compiled vars:  !0 = $offset, !1 = $t, !2 = $m
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  176     0  E >   RECV                                             !0      
  177     1        INIT_NS_FCALL_BY_NAME                                    'at%5Csimple%5Capp%5Cis_string'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $3      
          4        BOOL_NOT                                         ~4      $3
          5      > JMPZ                                                     ~4, ->20
  178     6    >   INIT_NS_FCALL_BY_NAME                                    'at%5Csimple%5Capp%5Cgettype'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0  $5      
          9        ASSIGN                                                   !1, $5
  179    10        ROPE_INIT                                     3  ~8      '%24offset+must+be+a+string%2C+%5B'
         11        ROPE_ADD                                      1  ~8      ~8, !1
         12        ROPE_END                                      2  ~7      ~8, '%5D+provided'
         13        ASSIGN                                                   !2, ~7
  180    14        NEW                                              $11     'InvalidArgumentException'
         15        SEND_VAR_EX                                              !2
         16        FETCH_CONSTANT                                   ~12     'at%5Csimple%5Capp%5CE_USER_WARNING'
         17        SEND_VAL_EX                                              ~12
         18        DO_FCALL                                      0          
         19      > THROW                                         0          $11
  183    20    >   INIT_NS_FCALL_BY_NAME                                    'at%5Csimple%5Capp%5Cmethod_exists'
         21        FETCH_THIS                                       ~14     
         22        INIT_ARRAY                                       ~15     ~14
         23        NOP                                                      
         24        FAST_CONCAT                                      ~16     'get', !0
         25        ADD_ARRAY_ELEMENT                                ~15     ~16
         26        SEND_VAL_EX                                              ~15
         27        DO_FCALL                                      0  $17     
         28      > JMPZ                                                     $17, ->34
  184    29    >   NOP                                                      
         30        FAST_CONCAT                                      ~18     'get', !0
         31        INIT_METHOD_CALL                                         ~18
         32        DO_FCALL                                      0  $19     
         33      > RETURN                                                   $19
  187    34    >   FETCH_CLASS_CONSTANT                             ~20     'PROP'
         35        ISSET_ISEMPTY_DIM_OBJ                         0          ~20, !0
         36      > JMPZ                                                     ~21, ->44
  188    37    >   INIT_STATIC_METHOD_CALL                                  'offsetGet'
         38        CHECK_FUNC_ARG                                           
         39        FETCH_CLASS_CONSTANT                             ~22     'PROP'
         40        FETCH_DIM_FUNC_ARG                               $23     ~22, !0
         41        SEND_FUNC_ARG                                            $23
         42        DO_FCALL                                      0  $24     
         43      > RETURN                                                   $24
  191    44    >   ROPE_INIT                                     3  ~26     'no+readable+property+%5B'
         45        ROPE_ADD                                      1  ~26     ~26, !0
         46        ROPE_END                                      2  ~25     ~26, '%5D'
         47        ASSIGN                                                   !2, ~25
  192    48        NEW                                              $29     'UnderflowException'
         49        SEND_VAR_EX                                              !2
         50        FETCH_CONSTANT                                   ~30     'at%5Csimple%5Capp%5CE_USER_WARNING'
         51        SEND_VAL_EX                                              ~30
         52        DO_FCALL                                      0          
         53      > THROW                                         0          $29
  193    54*     > RETURN                                                   null

End of function offsetget

Function offsetset:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 22
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 33
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/CCc5v
function name:  offsetSet
number of ops:  44
compiled vars:  !0 = $offset, !1 = $value, !2 = $m
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  201     0  E >   RECV                                             !0      
          1        RECV                                             !1      
  202     2        INIT_METHOD_CALL                                         'offsetValid'
          3        SEND_VAR_EX                                              !0
          4        SEND_VAR_EX                                              !1
          5        SEND_VAL_EX                                              <true>
          6        DO_FCALL                                      0          
  204     7        INIT_NS_FCALL_BY_NAME                                    'at%5Csimple%5Capp%5Cmethod_exists'
          8        FETCH_THIS                                       ~4      
          9        INIT_ARRAY                                       ~5      ~4
         10        NOP                                                      
         11        FAST_CONCAT                                      ~6      'set', !0
         12        ADD_ARRAY_ELEMENT                                ~5      ~6
         13        SEND_VAL_EX                                              ~5
         14        DO_FCALL                                      0  $7      
         15      > JMPZ                                                     $7, ->22
  205    16    >   NOP                                                      
         17        FAST_CONCAT                                      ~8      'set', !0
         18        INIT_METHOD_CALL                                         ~8
         19        SEND_VAR_EX                                              !1
         20        DO_FCALL                                      0  $9      
         21      > RETURN                                                   $9
  208    22    >   FETCH_CLASS_CONSTANT                             ~10     'PROP'
         23        ISSET_ISEMPTY_DIM_OBJ                         0          ~10, !0
         24      > JMPZ                                                     ~11, ->33
  209    25    >   INIT_STATIC_METHOD_CALL                                  'offsetSet'
         26        CHECK_FUNC_ARG                                           
         27        FETCH_CLASS_CONSTANT                             ~12     'PROP'
         28        FETCH_DIM_FUNC_ARG                               $13     ~12, !0
         29        SEND_FUNC_ARG                                            $13
         30        SEND_VAR_EX                                              !1
         31        DO_FCALL                                      0  $14     
         32      > RETURN                                                   $14
  212    33    >   ROPE_INIT                                     3  ~16     'no+setable+property+%5B'
         34        ROPE_ADD                                      1  ~16     ~16, !0
         35        ROPE_END                                      2  ~15     ~16, '%5D'
         36        ASSIGN                                                   !2, ~15
  213    37        NEW                                              $19     'OverflowException'
         38        SEND_VAR_EX                                              !2
         39        FETCH_CONSTANT                                   ~20     'at%5Csimple%5Capp%5CE_USER_WARNING'
         40        SEND_VAL_EX                                              ~20
         41        DO_FCALL                                      0          
         42      > THROW                                         0          $19
  214    43*     > RETURN                                                   null

End of function offsetset

Function offsetunset:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 20
Branch analysis from position: 6
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 34
Branch analysis from position: 29
2 jumps found. (Code = 46) Position 1 = 37, Position 2 = 41
Branch analysis from position: 37
2 jumps found. (Code = 43) Position 1 = 42, Position 2 = 49
Branch analysis from position: 42
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 49
Branch analysis from position: 41
Branch analysis from position: 34
filename:       /in/CCc5v
function name:  offsetUnset
number of ops:  60
compiled vars:  !0 = $offset, !1 = $t, !2 = $m, !3 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  221     0  E >   RECV                                             !0      
  222     1        INIT_NS_FCALL_BY_NAME                                    'at%5Csimple%5Capp%5Cis_string'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $4      
          4        BOOL_NOT                                         ~5      $4
          5      > JMPZ                                                     ~5, ->20
  223     6    >   INIT_NS_FCALL_BY_NAME                                    'at%5Csimple%5Capp%5Cgettype'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0  $6      
          9        ASSIGN                                                   !1, $6
  224    10        ROPE_INIT                                     3  ~9      '%24offset+must+be+a+string%2C+%5B'
         11        ROPE_ADD                                      1  ~9      ~9, !1
         12        ROPE_END                                      2  ~8      ~9, '%5D+provided'
         13        ASSIGN                                                   !2, ~8
  225    14        NEW                                              $12     'InvalidArgumentException'
         15        SEND_VAR_EX                                              !2
         16        FETCH_CONSTANT                                   ~13     'at%5Csimple%5Capp%5CE_USER_WARNING'
         17        SEND_VAL_EX                                              ~13
         18        DO_FCALL                                      0          
         19      > THROW                                         0          $12
  228    20    >   INIT_NS_FCALL_BY_NAME                                    'at%5Csimple%5Capp%5Cmethod_exists'
         21        FETCH_THIS                                       ~15     
         22        INIT_ARRAY                                       ~16     ~15
         23        NOP                                                      
         24        FAST_CONCAT                                      ~17     'unset', !0
         25        ADD_ARRAY_ELEMENT                                ~16     ~17
         26        SEND_VAL_EX                                              ~16
         27        DO_FCALL                                      0  $18     
         28      > JMPZ                                                     $18, ->34
  229    29    >   NOP                                                      
         30        FAST_CONCAT                                      ~19     'unset', !0
         31

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
259.27 ms | 1433 KiB | 28 Q