3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Cache { public static function has( $name ){ return false; } public static function get( $name ){ return null; } public static function put( $name, $value, $time = 1440 ){ return true; } } class Collivery { protected $token; protected $client; protected $config; protected $errors = array(); protected $check_cache = 2; protected $default_address_id; protected $client_id; protected $user_id; /** * Setup class with basic Config * * @param Array $config Configuration Array */ function __construct( array $config = array() ) { $this->config = (object) array( 'app_name' => 'Default App Name', // Application Name 'app_version' => '0.0.1', // Application Version 'app_host' => '', // Framework/CMS name and version, eg 'Wordpress 3.8.1 WooCommerce 2.0.20' / 'Joomla! 2.5.17 VirtueMart 2.0.26d' 'app_url' => '', // URL your site is hosted on 'user_email' => 'demo@collivery.co.za', 'user_password' => 'demo', 'demo' => false, ); foreach ( $config as $key => $value ) { $this->config->$key = $value; } if ( $this->config->demo ){ $this->config->user_email = 'demo@collivery.co.za'; $this->config->user_password = 'demo'; } $this->authenticate(); } /** * Setup the Soap Object * * @return SoapClient MDS Collivery Soap Client */ protected function init () { if ( ! $this->client ){ try { $this->client = new SoapClient( // Setup the soap client 'http://www.collivery.co.za/wsdl/v2', // URL to WSDL File array( 'cache_wsdl' => WSDL_CACHE_NONE ) // Don't cache the WSDL file ); } catch (SoapFault $e) { $this->catchSoapFault( $e ); return false; } } return true; } /** * Checks if the Soap Client has been set, and returns it. * * @return SoapClient Webserver Soap Client */ protected function client() { if ( ! $this->client ) { $this->init(); } if ( ! $this->token ) { $this->authenticate(); } return $this->client; } /** * Authenticate and set the token * * @return string */ protected function authenticate() { if ( ( $this->check_cache == 2 ) && Cache::has('collivery.auth') ) { $authenticate = Cache::get('collivery.auth'); $this->default_address_id = $authenticate['default_address_id']; $this->client_id = $authenticate['client_id']; $this->user_id = $authenticate['user_id']; $this->token = $authenticate['token']; return true; } else { if ( ! $this->init() ) return false; $user_email = $this->config->user_email; $user_password = $this->config->user_password; try { $authenticate = $this->client->authenticate($user_email, $user_password, $this->token, array( 'name' => $this->config->app_name . ' mds/collivery/class', 'version' => $this->config->app_version, 'host' => $this->config->app_host, 'url' => $this->config->app_url, 'lang' => 'PHP '. phpversion(), )); } catch (SoapFault $e) { $this->catchSoapFault( $e ); return false; } if ( is_array( $authenticate ) && isset( $authenticate['token'] ) ){ if ( $this->check_cache != 0 ) Cache::put( 'collivery.auth', $authenticate, 50 ); $this->default_address_id = $authenticate['default_address_id']; $this->client_id = $authenticate['client_id']; $this->user_id = $authenticate['user_id']; $this->token = $authenticate['token']; return true; } else { if ( isset( $result['error_id'] ) ) $this->setError( $result['error_id'], $result['error'] ); else $this->setError( 'result_unexpected', 'No address_id returned.' ); return false; } } } /** * Returns the available Parcel Type ID and value array for use in adding a collivery. * * @param int $address_id The ID of the address you wish to retrieve. * @return array Address */ public function getAddress( $address_id ) { if ( ( $this->check_cache == 2 ) && Cache::has( 'collivery.address.'. $this->client_id .'.'. $address_id ) ) { return Cache::get( 'collivery.address.'. $this->client_id .'.'. $address_id ); } else { try { $result = $this->client()->get_address( $address_id, $this->token ); } catch (SoapFault $e) { $this->catchSoapFault( $e ); return false; } if ( isset( $result['address'] ) ) { if ( $this->check_cache != 0 ) Cache::put( 'collivery.address.'. $this->client_id .'.'. $address_id, $result['address'], 60*24 ); return $result['address']; } else { if ( isset( $result['error_id'] ) ) $this->setError( $result['error_id'], $result['error'] ); else $this->setError( 'result_unexpected', 'No address_id returned.' ); return false; } } } /** * Returns all the addresses belonging to a client. * * @param array $filter Filter Addresses * @return array */ public function getAddresses( array $filter = array() ) { if ( ( $this->check_cache == 2 ) && empty( $filter ) && Cache::has( 'collivery.addresses.'. $this->client_id ) ) { return Cache::get( 'collivery.addresses.'. $this->client_id ); } else { try { $result = $this->client()->get_addresses( $this->token, $filter ); } catch (SoapFault $e) { $this->catchSoapFault( $e ); return false; } if ( isset( $result['addresses'] ) ) { if ( $this->check_cache != 0 ) Cache::put( 'collivery.addresses.'. $this->client_id, $result['addresses'], 60*24 ); return $result['addresses']; } else { if ( isset( $result['error_id'] ) ) $this->setError( $result['error_id'], $result['error'] ); else $this->setError( 'result_unexpected', 'No address_id returned.' ); return false; } } } /** * Returns the Contact people of a given Address ID. * * @param int $address_id Address ID * @return array */ public function getContacts( $address_id ) { if ( ( $this->check_cache == 2 ) && Cache::has( 'collivery.contacts.'. $this->client_id .'.'. $address_id ) ) { return Cache::get( 'collivery.contacts.'. $this->client_id .'.'. $address_id ); } else { try { $result = $this->client()->get_contacts( $address_id, $this->token ); } catch (SoapFault $e) { $this->catchSoapFault( $e ); return false; } if ( isset( $result['contacts'] ) ) { if ( $this->check_cache != 0 ) Cache::put( 'collivery.contacts.'. $this->client_id .'.'. $address_id, $result['contacts'], 60*24 ); return $result['contacts']; } else { if ( isset( $result['error_id'] ) ) $this->setError( $result['error_id'], $result['error'] ); else $this->setError( 'result_unexpected', 'No address_id returned.' ); return false; } } } /** * Returns the POD image for a given Waybill Number. * * @param int $collivery_id Collivery waybill number * @return array */ public function getPod( $collivery_id ) { if ( ( $this->check_cache == 2 ) && Cache::has( 'collivery.pod.'. $this->client_id .'.'. $collivery_id ) ) { return Cache::get( 'collivery.pod.'. $this->client_id .'.'. $collivery_id ); } else { try { $result = $this->client()->get_pod( $collivery_id, $this->token ); } catch (SoapFault $e) { $this->catchSoapFault( $e ); return false; } if ( isset( $result['pod'] ) ) { if ( isset( $result['error_id'] ) ) $this->setError( $result['error_id'], $result['error'] ); else if ( $this->check_cache != 0 ) Cache::put( 'collivery.pod.'. $this->client_id .'.'. $collivery_id, $result['pod'], 60*24 ); return $result['pod']; } else { if ( isset( $result['error_id'] ) ) $this->setError( $result['error_id'], $result['error'] ); else $this->setError( 'result_unexpected', 'No address_id returned.' ); return false; } } } /** * Returns a list of avaibale parcel images for a given Waybill Number. * * @param int $collivery_id Collivery waybill number * @return array */ public function getParcelImageList( $collivery_id ) { if ( ( $this->check_cache == 2 ) && Cache::has( 'collivery.parcel_image_list.'. $this->client_id .'.'. $collivery_id ) ) { return Cache::get( 'collivery.parcel_image_list.'. $this->client_id .'.'. $collivery_id ); } else { try { $result = $this->client()->get_parcel_image_list( $collivery_id, $this->token ); } catch (SoapFault $e) { $this->catchSoapFault( $e ); return false; } if ( isset( $result['images'] ) ) { if ( isset( $result['error_id'] ) ) $this->setError( $result['error_id'], $result['error'] ); else if ( $this->check_cache != 0 ) Cache::put( 'collivery.parcel_image_list.'. $this->client_id .'.'. $collivery_id, $result['images'], 60*12 ); return $result['images']; } else { if ( isset( $result['error_id'] ) ) $this->setError( $result['error_id'], $result['error'] ); else $this->setError( 'result_unexpected', 'No address_id returned.' ); return false; } } } /** * Returns the image of a given parcel-id of a waybill. * If the Waybill number is 54321 and there are 3 parcels, they would * be referenced by id's 54321-1, 54321-2 and 54321-3. * * @param string $parcel_id Parcel ID * @return array Array containing all the information * about the image including the image * itself in base64 */ public function getParcelImage( $parcel_id ) { if ( ( $this->check_cache == 2 ) && Cache::has( 'collivery.parcel_image.'. $this->client_id .'.'. $parcel_id ) ) { return Cache::get( 'collivery.parcel_image.'. $this->client_id .'.'. $parcel_id ); } else { try { $result = $this->client()->get_parcel_image( $parcel_id, $this->token ); } catch (SoapFault $e) { $this->catchSoapFault( $e ); return false; } if ( isset( $result['image'] ) ) { if ( isset( $result['error_id'] ) ) $this->setError( $result['error_id'], $result['error'] ); else if ( $this->check_cache != 0 ) Cache::put( 'collivery.parcel_image.'. $this->client_id .'.'. $parcel_id, $result['image'], 60*24 ); return $result['image']; } else { if ( isset( $result['error_id'] ) ) $this->setError( $result['error_id'], $result['error'] ); else $this->setError( 'result_unexpected', 'No address_id returned.' ); return false; } } } /** * Returns the status tracking detail of a given Waybill number. * If the collivery is still active, the estimated time of delivery * will be provided. If delivered, the time and receivers name (if availble) * with returned. * * @param int $collivery_id Collivery ID * @return array Collivery Status Information */ public function getStatus( $collivery_id ) { if ( ( $this->check_cache == 2 ) && Cache::has( 'collivery.status.'. $this->client_id .'.'. $collivery_id ) ) { return Cache::get( 'collivery.status.'. $this->client_id .'.'. $collivery_id ); } else { try { $result = $this->client()->get_collivery_status( $collivery_id, $this->token ); } catch (SoapFault $e) { $this->catchSoapFault( $e ); return false; } if ( isset( $result['status_id'] ) ) { if ( isset( $result['error_id'] ) ) $this->setError( $result['error_id'], $result['error'] ); else if ( $this->check_cache != 0 ) Cache::put( 'collivery.status.'. $this->client_id .'.'. $collivery_id, $result, 60*12 ); return $result; } else { if ( isset( $result['error_id'] ) ) $this->setError( $result['error_id'], $result['error'] ); else $this->setError( 'result_unexpected', 'No address_id returned.' ); return false; } } } /** * Handle error messages in SoapFault * * @param SoapFault $e SoapFault Object */ protected function catchSoapFault( $e ) { $this->setError( $e->faultcode, $e->faultstring ); } /** * Add a new error * * @param string $id Error ID * @param string $text Error text */ protected function setError( $id, $text ) { $this->errors[ $id ] = $text; } /** * Retrieve errors */ public function getErrors() { return $this->errors; } /** * Check if this instance has an error */ public function hasErrors() { return !empty($this->errors); } /** * Clears all the Errors */ public function clearErrors() { $this->errors = array(); } /** * Disable Cached completely and retrieve data directly from the webservice */ public function disableCache() { $this->check_cache = 0; } /** * Ignore Cached data and retrieve data directly from the webservice * Save returned data to Cache */ public function ignoreCache() { $this->check_cache = 1; } /** * Check if cache exists before querying the webservice * If webservice was queried, save returned data to Cache */ public function enableCache() { $this->check_cache = 2; } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MHUg7
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  467     0  E > > RETURN                                                   1

Class Cache:
Function has:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MHUg7
function name:  has
number of ops:  3
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1      > RETURN                                                   <false>
    7     2*     > RETURN                                                   null

End of function has

Function get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MHUg7
function name:  get
number of ops:  3
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1      > RETURN                                                   null
   10     2*     > RETURN                                                   null

End of function get

Function put:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MHUg7
function name:  put
number of ops:  5
compiled vars:  !0 = $name, !1 = $value, !2 = $time
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      1440
   12     3      > RETURN                                                   <true>
   13     4*     > RETURN                                                   null

End of function put

End of class Cache.

Class Collivery:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 11
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 11
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 21
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
Branch analysis from position: 11
filename:       /in/MHUg7
function name:  __construct
number of ops:  24
compiled vars:  !0 = $config, !1 = $value, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   RECV_INIT                                        !0      <array>
   36     1        CAST                                          8  ~4      <array>
   35     2        ASSIGN_OBJ                                               'config'
   36     3        OP_DATA                                                  ~4
   44     4      > FE_RESET_R                                       $5      !0, ->11
          5    > > FE_FETCH_R                                       ~6      $5, !1, ->11
          6    >   ASSIGN                                                   !2, ~6
   45     7        FETCH_OBJ_W                                      $8      'config'
          8        ASSIGN_OBJ                                               $8, !2
          9        OP_DATA                                                  !1
   44    10      > JMP                                                      ->5
         11    >   FE_FREE                                                  $5
   47    12        FETCH_OBJ_R                                      ~10     'config'
         13        FETCH_OBJ_R                                      ~11     ~10, 'demo'
         14      > JMPZ                                                     ~11, ->21
   48    15    >   FETCH_OBJ_W                                      $12     'config'
         16        ASSIGN_OBJ                                               $12, 'user_email'
         17        OP_DATA                                                  'demo%40collivery.co.za'
   49    18        FETCH_OBJ_W                                      $14     'config'
         19        ASSIGN_OBJ                                               $14, 'user_password'
         20        OP_DATA                                                  'demo'
   51    21    >   INIT_METHOD_CALL                                         'authenticate'
         22        DO_FCALL                                      0          
   52    23      > RETURN                                                   null

End of function __construct

Function init:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 17
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
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/MHUg7
function name:  init
number of ops:  19
compiled vars:  !0 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   61     0  E >   FETCH_OBJ_R                                      ~1      'client'
          1        BOOL_NOT                                         ~2      ~1
          2      > JMPZ                                                     ~2, ->17
   63     3    >   NEW                                              $4      'SoapClient'
   64     4        SEND_VAL_EX                                              'http%3A%2F%2Fwww.collivery.co.za%2Fwsdl%2Fv2'
   65     5        FETCH_CONSTANT                                   ~5      'WSDL_CACHE_NONE'
          6        INIT_ARRAY                                       ~6      ~5, 'cache_wsdl'
          7        SEND_VAL_EX                                              ~6
          8        DO_FCALL                                      0          
   63     9        ASSIGN_OBJ                                               'client'
   65    10        OP_DATA                                                  $4
         11      > JMP                                                      ->17
   67    12  E > > CATCH                                       last         'SoapFault'
   68    13    >   INIT_METHOD_CALL                                         'catchSoapFault'
         14        SEND_VAR_EX                                              !0
         15        DO_FCALL                                      0          
   69    16      > RETURN                                                   <false>
   72    17    > > RETURN                                                   <true>
   73    18*     > RETURN                                                   null

End of function init

Function client:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
Branch analysis from position: 5
filename:       /in/MHUg7
function name:  client
number of ops:  13
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   82     0  E >   FETCH_OBJ_R                                      ~0      'client'
          1        BOOL_NOT                                         ~1      ~0
          2      > JMPZ                                                     ~1, ->5
   83     3    >   INIT_METHOD_CALL                                         'init'
          4        DO_FCALL                                      0          
   86     5    >   FETCH_OBJ_R                                      ~3      'token'
          6        BOOL_NOT                                         ~4      ~3
          7      > JMPZ                                                     ~4, ->10
   87     8    >   INIT_METHOD_CALL                                         'authenticate'
          9        DO_FCALL                                      0          
   90    10    >   FETCH_OBJ_R                                      ~6      'client'
         11      > RETURN                                                   ~6
   91    12*     > RETURN                                                   null

End of function client

Function authenticate:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 26
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 31
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 70
Branch analysis from position: 70
2 jumps found. (Code = 46) Position 1 = 72, Position 2 = 74
Branch analysis from position: 72
2 jumps found. (Code = 43) Position 1 = 75, Position 2 = 97
Branch analysis from position: 75
2 jumps found. (Code = 43) Position 1 = 78, Position 2 = 83
Branch analysis from position: 78
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 83
Branch analysis from position: 97
2 jumps found. (Code = 43) Position 1 = 99, Position 2 = 108
Branch analysis from position: 99
1 jumps found. (Code = 42) Position 1 = 112
Branch analysis from position: 112
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 108
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 74
Branch analysis from position: 7
Found catch point at position: 65
Branch analysis from position: 65
2 jumps found. (Code = 107) Position 1 = 66, Position 2 = -2
Branch analysis from position: 66
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MHUg7
function name:  authenticate
number of ops:  114
compiled vars:  !0 = $authenticate, !1 = $user_email, !2 = $user_password, !3 = $e, !4 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  100     0  E >   FETCH_OBJ_R                                      ~5      'check_cache'
          1        IS_EQUAL                                         ~6      ~5, 2
          2      > JMPZ_EX                                          ~6      ~6, ->7
          3    >   INIT_STATIC_METHOD_CALL                                  'Cache', 'has'
          4        SEND_VAL                                                 'collivery.auth'
          5        DO_FCALL                                      0  $7      
          6        BOOL                                             ~6      $7
          7    > > JMPZ                                                     ~6, ->26
  101     8    >   INIT_STATIC_METHOD_CALL                                  'Cache', 'get'
          9        SEND_VAL                                                 'collivery.auth'
         10        DO_FCALL                                      0  $8      
         11        ASSIGN                                                   !0, $8
  103    12        FETCH_DIM_R                                      ~11     !0, 'default_address_id'
         13        ASSIGN_OBJ                                               'default_address_id'
         14        OP_DATA                                                  ~11
  104    15        FETCH_DIM_R                                      ~13     !0, 'client_id'
         16        ASSIGN_OBJ                                               'client_id'
         17        OP_DATA                                                  ~13
  105    18        FETCH_DIM_R                                      ~15     !0, 'user_id'
         19        ASSIGN_OBJ                                               'user_id'
         20        OP_DATA                                                  ~15
  106    21        FETCH_DIM_R                                      ~17     !0, 'token'
         22        ASSIGN_OBJ                                               'token'
         23        OP_DATA                                                  ~17
  108    24      > RETURN                                                   <true>
         25*       JMP                                                      ->113
  110    26    >   INIT_METHOD_CALL                                         'init'
         27        DO_FCALL                                      0  $18     
         28        BOOL_NOT                                         ~19     $18
         29      > JMPZ                                                     ~19, ->31
         30    > > RETURN                                                   <false>
  112    31    >   FETCH_OBJ_R                                      ~20     'config'
         32        FETCH_OBJ_R                                      ~21     ~20, 'user_email'
         33        ASSIGN                                                   !1, ~21
  113    34        FETCH_OBJ_R                                      ~23     'config'
         35        FETCH_OBJ_R                                      ~24     ~23, 'user_password'
         36        ASSIGN                                                   !2, ~24
  116    37        FETCH_OBJ_R                                      ~26     'client'
         38        INIT_METHOD_CALL                                         ~26, 'authenticate'
         39        SEND_VAR_EX                                              !1
         40        SEND_VAR_EX                                              !2
         41        CHECK_FUNC_ARG                                           
         42        FETCH_OBJ_FUNC_ARG                               $27     'token'
         43        SEND_FUNC_ARG                                            $27
  118    44        FETCH_OBJ_R                                      ~28     'config'
         45        FETCH_OBJ_R                                      ~29     ~28, 'app_name'
         46        CONCAT                                           ~30     ~29, '+mds%2Fcollivery%2Fclass'
         47        INIT_ARRAY                                       ~31     ~30, 'name'
  119    48        FETCH_OBJ_R                                      ~32     'config'
         49        FETCH_OBJ_R                                      ~33     ~32, 'app_version'
         50        ADD_ARRAY_ELEMENT                                ~31     ~33, 'version'
  120    51        FETCH_OBJ_R                                      ~34     'config'
         52        FETCH_OBJ_R                                      ~35     ~34, 'app_host'
         53        ADD_ARRAY_ELEMENT                                ~31     ~35, 'host'
  121    54        FETCH_OBJ_R                                      ~36     'config'
         55        FETCH_OBJ_R                                      ~37     ~36, 'app_url'
         56        ADD_ARRAY_ELEMENT                                ~31     ~37, 'url'
  122    57        INIT_FCALL                                               'phpversion'
         58        DO_ICALL                                         $38     
         59        CONCAT                                           ~39     'PHP+', $38
         60        ADD_ARRAY_ELEMENT                                ~31     ~39, 'lang'
         61        SEND_VAL_EX                                              ~31
         62        DO_FCALL                                      0  $40     
  116    63        ASSIGN                                                   !0, $40
         64      > JMP                                                      ->70
  124    65  E > > CATCH                                       last         'SoapFault'
  125    66    >   INIT_METHOD_CALL                                         'catchSoapFault'
         67        SEND_VAR_EX                                              !3
         68        DO_FCALL                                      0          
  126    69      > RETURN                                                   <false>
  129    70    >   TYPE_CHECK                                  128  ~43     !0
         71      > JMPZ_EX                                          ~43     ~43, ->74
         72    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~44     !0, 'token'
         73        BOOL                                             ~43     ~44
         74    > > JMPZ                                                     ~43, ->97
  130    75    >   FETCH_OBJ_R                                      ~45     'check_cache'
         76        IS_NOT_EQUAL                                             ~45, 0
         77      > JMPZ                                                     ~46, ->83
         78    >   INIT_STATIC_METHOD_CALL                                  'Cache', 'put'
         79        SEND_VAL                                                 'collivery.auth'
         80        SEND_VAR                                                 !0
         81        SEND_VAL                                                 50
         82        DO_FCALL                                      0          
  132    83    >   FETCH_DIM_R                                      ~49     !0, 'default_address_id'
         84        ASSIGN_OBJ                                               'default_address_id'
         85        OP_DATA                                                  ~49
  133    86        FETCH_DIM_R                                      ~51     !0, 'client_id'
         87        ASSIGN_OBJ                                               'client_id'
         88        OP_DATA                                                  ~51
  134    89        FETCH_DIM_R                                      ~53     !0, 'user_id'
         90        ASSIGN_OBJ                                               'user_id'
         91        OP_DATA                                                  ~53
  135    92        FETCH_DIM_R                                      ~55     !0, 'token'
         93        ASSIGN_OBJ                                               'token'
         94        OP_DATA                                                  ~55
  137    95      > RETURN                                                   <true>
         96*       JMP                                                      ->113
  139    97    >   ISSET_ISEMPTY_DIM_OBJ                         0          !4, 'error_id'
         98      > JMPZ                                                     ~56, ->108
  140    99    >   INIT_METHOD_CALL                                         'setError'
        100        CHECK_FUNC_ARG                                           
        101        FETCH_DIM_FUNC_ARG                               $57     !4, 'error_id'
        102        SEND_FUNC_ARG                                            $57
        103        CHECK_FUNC_ARG                                           
        104        FETCH_DIM_FUNC_ARG                               $58     !4, 'error'
        105        SEND_FUNC_ARG                                            $58
        106        DO_FCALL                                      0          
        107      > JMP                                                      ->112
  142   108    >   INIT_METHOD_CALL                                         'setError'
        109        SEND_VAL_EX                                              'result_unexpected'
        110        SEND_VAL_EX                                              'No+address_id+returned.'
        111        DO_FCALL                                      0          
  144   112    > > RETURN                                                   <false>
  147   113*     > RETURN                                                   null

End of function authenticate

Function getaddress:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 4, Position 2 = 12
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 22
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
2 jumps found. (Code = 43) Position 1 = 39, Position 2 = 55
Branch analysis from position: 39
2 jumps found. (Code = 43) Position 1 = 42, Position 2 = 52
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 52
Branch analysis from position: 55
2 jumps found. (Code = 43) Position 1 = 57, Position 2 = 66
Branch analysis from position: 57
1 jumps found. (Code = 42) Position 1 = 70
Branch analysis from position: 70
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 66
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
Found catch point at position: 32
Branch analysis from position: 32
2 jumps found. (Code = 107) Position 1 = 33, Position 2 = -2
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MHUg7
function name:  getAddress
number of ops:  72
compiled vars:  !0 = $address_id, !1 = $result, !2 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  155     0  E >   RECV                                             !0      
  157     1        FETCH_OBJ_R                                      ~3      'check_cache'
          2        IS_EQUAL                                         ~4      ~3, 2
          3      > JMPZ_EX                                          ~4      ~4, ->12
          4    >   INIT_STATIC_METHOD_CALL                                  'Cache', 'has'
          5        FETCH_OBJ_R                                      ~5      'client_id'
          6        CONCAT                                           ~6      'collivery.address.', ~5
          7        CONCAT                                           ~7      ~6, '.'
          8        CONCAT                                           ~8      ~7, !0
          9        SEND_VAL                                                 ~8
         10        DO_FCALL                                      0  $9      
         11        BOOL                                             ~4      $9
         12    > > JMPZ                                                     ~4, ->22
  158    13    >   INIT_STATIC_METHOD_CALL                                  'Cache', 'get'
         14        FETCH_OBJ_R                                      ~10     'client_id'
         15        CONCAT                                           ~11     'collivery.address.', ~10
         16        CONCAT                                           ~12     ~11, '.'
         17        CONCAT                                           ~13     ~12, !0
         18        SEND_VAL                                                 ~13
         19        DO_FCALL                                      0  $14     
         20      > RETURN                                                   $14
         21*       JMP                                                      ->71
  161    22    >   INIT_METHOD_CALL                                         'client'
         23        DO_FCALL                                      0  $15     
         24        INIT_METHOD_CALL                                         $15, 'get_address'
         25        SEND_VAR_EX                                              !0
         26        CHECK_FUNC_ARG                                           
         27        FETCH_OBJ_FUNC_ARG                               $16     'token'
         28        SEND_FUNC_ARG                                            $16
         29        DO_FCALL                                      0  $17     
         30        ASSIGN                                                   !1, $17
         31      > JMP                                                      ->37
  162    32  E > > CATCH                                       last         'SoapFault'
  163    33    >   INIT_METHOD_CALL                                         'catchSoapFault'
         34        SEND_VAR_EX                                              !2
         35        DO_FCALL                                      0          
  164    36      > RETURN                                                   <false>
  167    37    >   ISSET_ISEMPTY_DIM_OBJ                         0          !1, 'address'
         38      > JMPZ                                                     ~20, ->55
  168    39    >   FETCH_OBJ_R                                      ~21     'check_cache'
         40        IS_NOT_EQUAL                                             ~21, 0
         41      > JMPZ                                                     ~22, ->52
         42    >   INIT_STATIC_METHOD_CALL                                  'Cache', 'put'
         43        FETCH_OBJ_R                                      ~23     'client_id'
         44        CONCAT                                           ~24     'collivery.address.', ~23
         45        CONCAT                                           ~25     ~24, '.'
         46        CONCAT                                           ~26     ~25, !0
         47        SEND_VAL                                                 ~26
         48        FETCH_DIM_R                                      ~27     !1, 'address'
         49        SEND_VAL                                                 ~27
         50        SEND_VAL                                                 1440
         51        DO_FCALL                                      0          
  169    52    >   FETCH_DIM_R                                      ~29     !1, 'address'
         53      > RETURN                                                   ~29
         54*       JMP                                                      ->71
  171    55    >   ISSET_ISEMPTY_DIM_OBJ                         0          !1, 'error_id'
         56      > JMPZ                                                     ~30, ->66
  172    57    >   INIT_METHOD_CALL                                         'setError'
         58        CHECK_FUNC_ARG                                           
         59        FETCH_DIM_FUNC_ARG                               $31     !1, 'error_id'
         60        SEND_FUNC_ARG                                            $31
         61        CHECK_FUNC_ARG                                           
         62        FETCH_DIM_FUNC_ARG                               $32     !1, 'error'
         63        SEND_FUNC_ARG                                            $32
         64        DO_FCALL                                      0          
         65      > JMP                                                      ->70
  174    66    >   INIT_METHOD_CALL                                         'setError'
         67        SEND_VAL_EX                                              'result_unexpected'
         68        SEND_VAL_EX                                              'No+address_id+returned.'
         69        DO_FCALL                                      0          
  176    70    > > RETURN                                                   <false>
  179    71*     > RETURN                                                   null

End of function getaddress

Function getaddresses:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
2 jumps found. (Code = 46) Position 1 = 7, Position 2 = 13
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 21
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 52
Branch analysis from position: 38
2 jumps found. (Code = 43) Position 1 = 41, Position 2 = 49
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 49
Branch analysis from position: 52
2 jumps found. (Code = 43) Position 1 = 54, Position 2 = 63
Branch analysis from position: 54
1 jumps found. (Code = 42) Position 1 = 67
Branch analysis from position: 67
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 63
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
Branch analysis from position: 6
Found catch point at position: 31
Branch analysis from position: 31
2 jumps found. (Code = 107) Position 1 = 32, Position 2 = -2
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MHUg7
function name:  getAddresses
number of ops:  69
compiled vars:  !0 = $filter, !1 = $result, !2 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  187     0  E >   RECV_INIT                                        !0      <array>
  189     1        FETCH_OBJ_R                                      ~3      'check_cache'
          2        IS_EQUAL                                         ~4      ~3, 2
          3      > JMPZ_EX                                          ~4      ~4, ->6
          4    >   ISSET_ISEMPTY_CV                                 ~5      !0
          5        BOOL                                             ~4      ~5
          6    > > JMPZ_EX                                          ~4      ~4, ->13
          7    >   INIT_STATIC_METHOD_CALL                                  'Cache', 'has'
          8        FETCH_OBJ_R                                      ~6      'client_id'
          9        CONCAT                                           ~7      'collivery.addresses.', ~6
         10        SEND_VAL                                                 ~7
         11        DO_FCALL                                      0  $8      
         12        BOOL                                             ~4      $8
         13    > > JMPZ                                                     ~4, ->21
  190    14    >   INIT_STATIC_METHOD_CALL                                  'Cache', 'get'
         15        FETCH_OBJ_R                                      ~9      'client_id'
         16        CONCAT                                           ~10     'collivery.addresses.', ~9
         17        SEND_VAL                                                 ~10
         18        DO_FCALL                                      0  $11     
         19      > RETURN                                                   $11
         20*       JMP                                                      ->68
  193    21    >   INIT_METHOD_CALL                                         'client'
         22        DO_FCALL                                      0  $12     
         23        INIT_METHOD_CALL                                         $12, 'get_addresses'
         24        CHECK_FUNC_ARG                             

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.76 ms | 1428 KiB | 15 Q