3v4l.org

run code in 300+ PHP versions simultaneously
<?php 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 [ '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->initSoap() ) 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 a list of towns and their ID's for creating new addresses. * Town can be filtered by country of province (ZAF Only). * * @param string $country Filter towns by Country * @param string $province Filter towns by South African Provinces * @return array List of towns and their ID's */ public function getTowns( $country = "ZAF", $province = null ) { if ( ( $this->check_cache == 2 ) && is_null( $province ) && Cache::has( 'collivery.towns.'. $country ) ) { return Cache::get( 'collivery.towns.'.$country ); } elseif ( ( $this->check_cache == 2 ) && ! is_null( $province ) && Cache::has( 'collivery.towns.'. $country .'.'. $province ) ) { return Cache::get( 'collivery.towns.'.$country.'.'.$province ); } else { try { $result = $this->client()->get_towns( $this->token, $country, $province ); } catch (SoapFault $e) { $this->catchSoapFault( $e ); return false; } if ( isset( $result['towns'] ) ) { if ( is_null( $province ) ) { if ( $this->check_cache != 0 ) Cache::put( 'collivery.towns.'. $country, $result['towns'], 60*24 ); } else { if ( $this->check_cache != 0 ) Cache::put( 'collivery.towns.'. $country .'.'. $province, $result['towns'], 60*24 ); } return $result['towns']; } else { if ( isset( $result['error_id'] ) ) $this->setError( $result['error_id'], $result['error'] ); else $this->setError( 'result_unexpected', 'No address_id returned.' ); return false; } } } /** * Allows you to search for town and suburb names starting with the given string. * The minimum string length to search is two characters. * Returns a list of towns, suburbs, and the towns the suburbs belong to with their ID's for creating new addresses. * The idea is that this could be used in an auto complete function. * * @param string $name Start of town/suburb name * @return array List of towns and their ID's */ function searchTowns( $name ) { if ( strlen( $name ) < 2 ) { return $this->get_towns(); } elseif ( ( $this->check_cache == 2 ) && Cache::has( 'collivery.search_towns.'. $name ) ) { return Cache::get( 'collivery.search_towns.'. $name ); } else { try { $result = $this->client()->search_towns( $name, $this->token ); } catch (SoapFault $e) { $this->catchSoapFault( $e ); return false; } if ( isset( $result ) ) { if ( $this->check_cache != 0 ) Cache::put( 'collivery.search_towns.'. $name, $result, 60*24 ); 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; } } } /** * Returns all the suburbs of a town. * * @param int $town_id ID of the Town to return suburbs for * @return array */ public function getSuburbs( $town_id ) { if ( ( $this->check_cache == 2 ) && Cache::has( 'collivery.suburbs.'. $town_id ) ) { return Cache::get( 'collivery.suburbs.'. $town_id ); } else { try { $result = $this->client()->get_suburbs( $town_id, $this->token ); } catch (SoapFault $e) { $this->catchSoapFault( $e ); return false; } if ( isset( $result['suburbs'] ) ) { if ( $this->check_cache != 0 ) Cache::put( 'collivery.suburbs.'. $town_id, $result['suburbs'], 60*24*7 ); return $result['suburbs']; } 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 type of Address Locations. * Certain location type incur a surcharge due to time spent during * delivery. * * @return array */ public function getLocationTypes() { if ( ( $this->check_cache == 2 ) && Cache::has( 'collivery.location_types' ) ) { return Cache::get( 'collivery.location_types' ); } else { try { $result = $this->client()->get_location_types( $this->token ); } catch (SoapFault $e) { $this->catchSoapFault( $e ); return false; } if ( isset( $result['results'] ) ) { if ( $this->check_cache != 0 ) Cache::put( 'collivery.location_types', $result['results'], 60*24*7 ); return $result['results']; } 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 Collivery services types. * * @return array */ public function getServices() { if ( ( $this->check_cache == 2 ) && Cache::has( 'collivery.services' ) ) { return Cache::get( 'collivery.services' ); } else { try { $result = $this->client()->get_services( $this->token ); } catch (SoapFault $e) { $this->catchSoapFault( $e ); return false; } if ( isset( $result['results'] ) ) { if ( $this->check_cache != 0 ) Cache::put( 'collivery.services', $result['results'], 60*24*7 ); return $result['results']; } 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. * * @return array Parcel Types */ public function getParcelTypes() { if ( ( $this->check_cache == 2 ) && Cache::has( 'collivery.parcel_types' ) ) { return Cache::get( 'collivery.parcel_types' ); } else { try { $result = $this->client()->get_parcel_types( $this->token ); } catch (SoapFault $e) { $this->catchSoapFault( $e ); return false; } if ( is_array( $result ) ) { if ( $this->check_cache != 0 ) Cache::put( 'collivery.parcel_types', $result, 60*24*7 ); 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; } } } /** * 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; } } } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/35cJ5
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  405     0  E > > RETURN                                                   1

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/35cJ5
function name:  __construct
number of ops:  24
compiled vars:  !0 = $config, !1 = $value, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV_INIT                                        !0      <array>
   23     1        CAST                                          8  ~4      <array>
   22     2        ASSIGN_OBJ                                               'config'
   23     3        OP_DATA                                                  ~4
   31     4      > FE_RESET_R                                       $5      !0, ->11
          5    > > FE_FETCH_R                                       ~6      $5, !1, ->11
          6    >   ASSIGN                                                   !2, ~6
   32     7        FETCH_OBJ_W                                      $8      'config'
          8        ASSIGN_OBJ                                               $8, !2
          9        OP_DATA                                                  !1
   31    10      > JMP                                                      ->5
         11    >   FE_FREE                                                  $5
   34    12        FETCH_OBJ_R                                      ~10     'config'
         13        FETCH_OBJ_R                                      ~11     ~10, 'demo'
         14      > JMPZ                                                     ~11, ->21
   35    15    >   FETCH_OBJ_W                                      $12     'config'
         16        ASSIGN_OBJ                                               $12, 'user_email'
         17        OP_DATA                                                  'demo%40collivery.co.za'
   36    18        FETCH_OBJ_W                                      $14     'config'
         19        ASSIGN_OBJ                                               $14, 'user_password'
         20        OP_DATA                                                  'demo'
   38    21    >   INIT_METHOD_CALL                                         'authenticate'
         22        DO_FCALL                                      0          
   39    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/35cJ5
function name:  init
number of ops:  19
compiled vars:  !0 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   48     0  E >   FETCH_OBJ_R                                      ~1      'client'
          1        BOOL_NOT                                         ~2      ~1
          2      > JMPZ                                                     ~2, ->17
   50     3    >   NEW                                              $4      'SoapClient'
   51     4        SEND_VAL_EX                                              'http%3A%2F%2Fwww.collivery.co.za%2Fwsdl%2Fv2'
   52     5        FETCH_CONSTANT                                   ~5      'WSDL_CACHE_NONE'
          6        INIT_ARRAY                                       ~6      ~5, 'cache_wsdl'
          7        SEND_VAL_EX                                              ~6
          8        DO_FCALL                                      0          
   50     9        ASSIGN_OBJ                                               'client'
   52    10        OP_DATA                                                  $4
         11      > JMP                                                      ->17
   54    12  E > > CATCH                                       last         'SoapFault'
   55    13    >   INIT_METHOD_CALL                                         'catchSoapFault'
         14        SEND_VAR_EX                                              !0
         15        DO_FCALL                                      0          
   56    16      > RETURN                                                   <false>
   59    17    > > RETURN                                                   <true>
   60    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/35cJ5
function name:  client
number of ops:  13
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   69     0  E >   FETCH_OBJ_R                                      ~0      'client'
          1        BOOL_NOT                                         ~1      ~0
          2      > JMPZ                                                     ~1, ->5
   70     3    >   INIT_METHOD_CALL                                         'init'
          4        DO_FCALL                                      0          
   73     5    >   FETCH_OBJ_R                                      ~3      'token'
          6        BOOL_NOT                                         ~4      ~3
          7      > JMPZ                                                     ~4, ->10
   74     8    >   INIT_METHOD_CALL                                         'authenticate'
          9        DO_FCALL                                      0          
   77    10    >   FETCH_OBJ_R                                      ~6      'client'
         11      > RETURN                                                   ~6
   78    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/35cJ5
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
-------------------------------------------------------------------------------------
   87     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_EX                                              'collivery.auth'
          5        DO_FCALL                                      0  $7      
          6        BOOL                                             ~6      $7
          7    > > JMPZ                                                     ~6, ->26
   88     8    >   INIT_STATIC_METHOD_CALL                                  'Cache', 'get'
          9        SEND_VAL_EX                                              'collivery.auth'
         10        DO_FCALL                                      0  $8      
         11        ASSIGN                                                   !0, $8
   90    12        FETCH_DIM_R                                      ~11     !0, 'default_address_id'
         13        ASSIGN_OBJ                                               'default_address_id'
         14        OP_DATA                                                  ~11
   91    15        FETCH_DIM_R                                      ~13     !0, 'client_id'
         16        ASSIGN_OBJ                                               'client_id'
         17        OP_DATA                                                  ~13
   92    18        FETCH_DIM_R                                      ~15     !0, 'user_id'
         19        ASSIGN_OBJ                                               'user_id'
         20        OP_DATA                                                  ~15
   93    21        FETCH_DIM_R                                      ~17     !0, 'token'
         22        ASSIGN_OBJ                                               'token'
         23        OP_DATA                                                  ~17
   95    24      > RETURN                                                   <true>
         25*       JMP                                                      ->113
   97    26    >   INIT_METHOD_CALL                                         'initSoap'
         27        DO_FCALL                                      0  $18     
         28        BOOL_NOT                                         ~19     $18
         29      > JMPZ                                                     ~19, ->31
         30    > > RETURN                                                   <false>
   99    31    >   FETCH_OBJ_R                                      ~20     'config'
         32        FETCH_OBJ_R                                      ~21     ~20, 'user_email'
         33        ASSIGN                                                   !1, ~21
  100    34        FETCH_OBJ_R                                      ~23     'config'
         35        FETCH_OBJ_R                                      ~24     ~23, 'user_password'
         36        ASSIGN                                                   !2, ~24
  103    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
  105    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'
  106    48        FETCH_OBJ_R                                      ~32     'config'
         49        FETCH_OBJ_R                                      ~33     ~32, 'app_version'
         50        ADD_ARRAY_ELEMENT                                ~31     ~33, 'version'
  107    51        FETCH_OBJ_R                                      ~34     'config'
         52        FETCH_OBJ_R                                      ~35     ~34, 'app_host'
         53        ADD_ARRAY_ELEMENT                                ~31     ~35, 'host'
  108    54        FETCH_OBJ_R                                      ~36     'config'
         55        FETCH_OBJ_R                                      ~37     ~36, 'app_url'
         56        ADD_ARRAY_ELEMENT                                ~31     ~37, 'url'
  109    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     
  103    63        ASSIGN                                                   !0, $40
         64      > JMP                                                      ->70
  111    65  E > > CATCH                                       last         'SoapFault'
  112    66    >   INIT_METHOD_CALL                                         'catchSoapFault'
         67        SEND_VAR_EX                                              !3
         68        DO_FCALL                                      0          
  113    69      > RETURN                                                   <false>
  116    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
  117    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_EX                                              'collivery.auth'
         80        SEND_VAR_EX                                              !0
         81        SEND_VAL_EX                                              50
         82        DO_FCALL                                      0          
  119    83    >   FETCH_DIM_R                                      ~49     !0, 'default_address_id'
         84        ASSIGN_OBJ                                               'default_address_id'
         85        OP_DATA                                                  ~49
  120    86        FETCH_DIM_R                                      ~51     !0, 'client_id'
         87        ASSIGN_OBJ                                               'client_id'
         88        OP_DATA                                                  ~51
  121    89        FETCH_DIM_R                                      ~53     !0, 'user_id'
         90        ASSIGN_OBJ                                               'user_id'
         91        OP_DATA                                                  ~53
  122    92        FETCH_DIM_R                                      ~55     !0, 'token'
         93        ASSIGN_OBJ                                               'token'
         94        OP_DATA                                                  ~55
  124    95      > RETURN                                                   <true>
         96*       JMP                                                      ->113
  126    97    >   ISSET_ISEMPTY_DIM_OBJ                         0          !4, 'error_id'
         98      > JMPZ                                                     ~56, ->108
  127    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
  129   108    >   INIT_METHOD_CALL                                         'setError'
        109        SEND_VAL_EX                                              'result_unexpected'
        110        SEND_VAL_EX                                              'No+address_id+returned.'
        111        DO_FCALL                                      0          
  131   112    > > RETURN                                                   <false>
  134   113*     > RETURN                                                   null

End of function authenticate

Function gettowns:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
2 jumps found. (Code = 46) Position 1 = 8, Position 2 = 13
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 20
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
2 jumps found. (Code = 46) Position 1 = 23, Position 2 = 26
Branch analysis from position: 23
2 jumps found. (Code = 46) Position 1 = 27, Position 2 = 34
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 43
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 43
1 jumps found. (Code = 42) Position 1 = 59
Branch analysis from position: 59
2 jumps found. (Code = 43) Position 1 = 61, Position 2 = 91
Branch analysis from position: 61
2 jumps found. (Code = 43) Position 1 = 63, Position 2 = 75
Branch analysis from position: 63
2 jumps found. (Code = 43) Position 1 = 66, Position 2 = 74
Branch analysis from position: 66
1 jumps found. (Code = 42) Position 1 = 88
Branch analysis from position: 88
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 74
Branch analysis from position: 75
2 jumps found. (Code = 43) Position 1 = 78, Position 2 = 88
Branch analysis from position: 78
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 88
Branch analysis from position: 91
2 jumps found. (Code = 43) Position 1 = 93, Position 2 = 102
Branch analysis from position: 93
1 jumps found. (Code = 42) Position 1 = 106
Branch analysis from position: 106
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 102
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
Branch analysis from position: 26
Branch analysis from position: 13
Branch analysis from position: 7
Found catch point at position: 54
Branch analysis from position: 54
2 jumps found. (Code = 107) Position 1 = 55, Position 2 = -2
Branch analysis from position: 55
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/35cJ5
function name:  getTowns
number of ops:  108
compiled vars:  !0 = $country, !1 = $province, !2 = $result, !3 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  144     0  E >   RECV_INIT                                        !0      'ZAF'
          1        RECV_INIT                                        !1      null
  146     2        FETCH_OBJ_R                                      ~4      'check_cache'
          3        IS_EQUAL                                         ~5      ~4, 2
          4      > JMPZ_EX                                          ~5      ~5, ->7
          5    >   TYPE_CHECK                                    2  ~6      !1
          6        BOOL                                             ~5      ~6
          7    > > JMPZ_EX                                          ~5      ~5, ->13
          8    >   INIT_STATIC_METHOD_CALL                                  'Cache', 'has'
          9        CONCAT                                           ~7      'collivery.towns.', !0
         10        SEND_VAL_EX                                              ~7
         11        DO_FCALL                                      0  $8      
         12        BOOL                                             ~5      $8
         13    > > JMPZ                                                     ~5, ->20
  147    14    >   INIT_STATIC_METHOD_CALL                                  'Cache', 'get'
         15        CONCAT                                           ~9      'collivery.towns.', !0
         16        SEND_VAL_EX                                              ~9
         17        DO_FCALL                                      0  $10     
         18      > RETURN                                                   $10
         19*       JMP                                                      ->107
  148    20    >   FETCH_OBJ_R                                      ~11     'check_cache'
         21        IS_EQUAL                                         ~12     ~11, 2
         22      > JMPZ_EX                                          ~12     ~12, ->26
         23    >   TYPE_CHECK                                    2  ~13     !1
         24        BOOL_NOT                                         ~14     ~13
         25        BOOL                                             ~12     ~14
         26    > > JMPZ_EX                                          ~12     ~12, ->34
         27    >   INIT_STATIC_METHOD_CALL                                  'Cache', 'has'
         28        CONCAT                                           ~15     'collivery.towns.', !0
         29        CONCAT                                           ~16     ~15, '.'
         30        CONCAT                                           ~17     ~16, !1
         31        SEND_VAL_EX                                              ~17
         32        DO_FCALL                                      0  $18     
         33        BOOL                                             ~12     $18
         34    > > JMPZ                                                     ~12, ->43
  149    35    >   INIT_STATIC_METHOD_CALL                                  'Cache', 'get'
         36        CONCAT                                           ~19     'collivery.towns.', !0
         37        CONCAT                                           ~20     ~19, '.'
         38        CONCAT                                           ~21     ~20, !1
         39        SEND_VAL_EX                                              ~21
         40        DO_FCALL                                      0  $22     
         41      > RETURN                                                   $22
         42*       JMP                                                      ->107
  152    43    >   INIT_METHOD_CALL                                         'client'
         44        DO_FCALL                                      0  $23     
         45        INIT_METHOD_CALL                                         $23, 'get_towns'
         46        CHECK_FUNC_ARG                                           
         47        FETCH_OBJ_FUNC_ARG                               $24     'token'
         48        SEND_FUNC_ARG                                            $24
         49        SEND_VAR_EX                                              !0
         50        SEND_VAR_EX                                              !1
         51        DO_FCALL                                      0  $25     
         52        ASSIGN                                                   !2, $25
         53      > JMP                                                      ->59
  153    54  E > > CATCH                                       last         'SoapFault'
  154    55    >   INIT_METHOD_CALL                                         'catchSoapFault'
         56        SEND_VAR_EX                                              !3
         57        DO_FCALL                                      0          
  155    58      > RETURN                                                   <false>
  158    59    >   ISSET_ISEMPTY_DIM_OBJ                         0          !2, 'towns'
         60      > JMPZ                                                     ~28, ->91
  159    61    >   TYPE_CHECK                                    2          !1
         62      > JMPZ                                                     ~29, ->75
  160    63    >   FETCH_OBJ_R                                      ~30     'check_cache'
         64        IS_NOT_EQUAL                                             ~30, 0
         65      > JMPZ                                                     ~31, ->74
         66    >   INIT_STATIC_METHOD_CALL                                  'Cache', 'put'
         67        CONCAT                                           ~32     'collivery.towns.', !0
         68        SEND_VAL_EX                                              ~32
         69        CHECK_FUNC_ARG                                           
         70        FETCH_DIM_FUNC_ARG                               $33     !2, 'towns'
         71        SEND_FUNC_ARG                                            $33
         72        SEND_VAL_EX                                              1440
         73        DO_FCALL                                      0          
         74    > > JMP                                                      ->88
  162    75    >   FETCH_OBJ_R                                      ~35     'check_cache'
         76        IS_NOT_EQUAL                                             ~35, 0
         77      > JMPZ                                                     ~36, ->88
         78    >   INIT_STATIC_METHOD_CALL                                  'Cache', 'put'
         79        CONCAT                                           ~37     'collivery.towns.', !0
         80        CONCAT                                           ~38     ~37, '.'
         81        CONCAT                                           ~39     ~38, !1
         82        SEND_VAL_EX                                              ~39
         83        CHECK_FUNC_ARG                                           
         84        FETCH_DIM_FUNC_ARG                               $40     !2, 'towns'
         85        SEND_FUNC_ARG                                            $40
         86        SEND_VAL_EX                                              1440
         87        DO_FCALL                                      0          
  164    88    >   FETCH_DIM_R                                      ~42     !2, 'towns'
         89      > RETURN                                                   ~42
         90*       JMP                                                      ->107
  166    91    >   ISSET_ISEMPTY_DIM_OBJ                         0          !2, 'error_id'
         92      > JMPZ                                                     ~43, ->102
  167    93    >   INIT_METHOD_CALL                                         'setError'
         94        CHECK_FUNC_ARG                                           
         95        FETCH_DIM_FUNC_ARG                               $44     !2, 'error_id'
         96        SEND_FUNC_ARG                                            $44
         97        CHECK_FUNC_ARG                                           
         98        FETCH_DIM_FUNC_ARG                               $45     !2, 'error'
         99        SEND_FUNC_ARG                                            $45
        100        DO_FCALL                                      0          
        101      > JMP                                                      ->106
  169   102    >   INIT_METHOD_CALL                                         'setError'
        103        SEND_VAL_EX                                              'result_unexpected'
        104        SEND_VAL_EX                                              'No+address_id+returned.'
        105        DO_FCALL                                      0          
  171   106    > > RETURN                                                   <false>
  174   107*     > RETURN                                                   null

End of function gettowns

Function searchtowns:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 46) Position 1 = 11, Position 2 = 16
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 23
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
2 jumps found. (Code = 43) Position 1 = 40, Position 2 = 51
Branch analysis from position: 40
2 jumps found. (Code = 43) Position 1 = 43, Position 2 = 49
Branch analysis from position: 43
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 49
Branch analysis from position: 51
2 jumps found. (Code = 43) Position 1 = 53, Position 2 = 62
Branch analysis from position: 53
1 jumps found. (Code = 42) Position 1 = 66
Branch analysis from position: 66
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 62
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
Found catch point at position: 33
Branch analysis from position: 33
2 jumps found. (Code = 107) Position 1 = 34, Position 2 = -2
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/35cJ5
function name:  searchTowns
number of ops:  68
compiled vars:  !0 = $name, !1 = $result, !2 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  185     0  E >   RECV                                             !0      
  187     1        STRLEN                                           ~3      !0
          2        IS_SMALLER                                               ~3, 2
   

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.35 ms | 1420 KiB | 15 Q